To read files I like to use a context manager to guarantee that the file is closed:
with open(filename) as f:
product_uuid = f.read().strip()
Besides this, I'm not sure about the expected UUID format, but maybe using a regular
expression is a good idea.
Finally, when is the IOError expected to happen? If it's related to permissions,
then checking the permissions before opening the file might be clearer and explicit.
To read files I like to use a context manager to guarantee that the file is closed:
with open(filename) as f:
product_uuid = f.read().strip()
Besides this, I'm not sure about the expected UUID format, but maybe using a regular
expression is a good idea.
Finally, when is the IOError expected to happen? If it's related to permissions,
then checking the permissions before opening the file might be clearer and explicit.