Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute 'message' does not exist in IOErrors in Python 3.5 #4

Open
Shihira opened this issue Mar 30, 2017 · 2 comments
Open

Attribute 'message' does not exist in IOErrors in Python 3.5 #4

Shihira opened this issue Mar 30, 2017 · 2 comments
Labels
Milestone

Comments

@Shihira
Copy link

Shihira commented Mar 30, 2017

I encountered such an exception. It said it cannot find a *.dict file while actually a *.dict.dz is there.

>>> d = Dictionary('DrEye-jc')
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/pystardict.py", line 647, in open_file
    return open(regular, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'DrEye-jc.dict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/pystardict.py", line 371, in __init__
    self._file = open_file(dict_filename, dict_filename_dz)
  File "/usr/lib/python3.5/site-packages/pystardict.py", line 649, in open_file
    warn(e.message)
AttributeError: 'FileNotFoundError' object has no attribute 'message'

I then read the code and found it may be the problem of open_file function, where statements like warn(e.message) exists. Some tests I did indicated that expressions like IOError("abc").message work in Python 2.x but 3.x. So there may need some conditional tests before warnings to ensure the compatibility.

Thank you for your great work and hope for a fix.

@lig lig added this to the v0.7.1 milestone Mar 30, 2017
@lig lig added the bug label Mar 30, 2017
@lig
Copy link
Owner

lig commented Mar 30, 2017

@Shihira thanks for the report! I'll dig into it on the weekend.

@lig
Copy link
Owner

lig commented Feb 11, 2018

PR will be welcomed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants