vlas-sokolov / bayesian-ngc1333

Nested sampling of the GAS DR1 NGC1333 ammonia data
MIT License
2 stars 3 forks source link

Compatibility issue with Python 2.7 #1

Closed jpinedaf closed 5 years ago

jpinedaf commented 6 years ago

I run into the following problem when using Python 2.7 NameError: name 'FileNotFoundError' is not defined which is related to this line https://github.com/vlas-sokolov/bayesian-ngc1333/blob/master/innocent_script.py#L179

and changing

    except (FileNotFoundError, OSError) as e:

into

    except (IOError, OSError) as e:

seems to solve the issue. Is there a better way to avoid this? Would this break the Python 3 version?

vlas-sokolov commented 6 years ago

Looks like what should be done is to make an extra compatibility check for Python 2 versions:

try: FileNotFoundErrorexcept NameError: FileNotFoundError = IOError

because those two errors seem to be the same

On Fri, 21 Sep 2018 at 09:44, Jaime Pineda notifications@github.com wrote:

I run into the following problem when using Python 2.7 NameError: name 'FileNotFoundError' is not defined which is related to this line

https://github.com/vlas-sokolov/bayesian-ngc1333/blob/master/innocent_script.py#L179

and changing

except (FileNotFoundError, OSError) as e:

into

except (IOError, OSError) as e:

seems to solve the issue. Is there a better way to avoid this? Would this break the Python 3 version?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vlas-sokolov/bayesian-ngc1333/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ALSW6wNwJgYaJ_Kjotz1btFTHbi4t74Xks5udJj3gaJpZM4Wznlz .