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

Error in self.__source_file in reader.py #10

Open
ayrtondenner opened this issue Apr 24, 2018 · 3 comments
Open

Error in self.__source_file in reader.py #10

ayrtondenner opened this issue Apr 24, 2018 · 3 comments

Comments

@ayrtondenner
Copy link

Hello. I'm trying to run NERCRF.py, and when it hits the instruction self.__source_file = open(file_path, 'r') in the method __init__ (line 104), it runs without problems, but the variable self.__source_file is shown as "not defined", throwing an error in the instruction self.__source_file.close() in method close(self) (line 112). It should work, but somehow this source file variable is not being defined to be used after that. Also, the path is correct, I've already checked that.

image

Any idea how to fix it?

@XuezheMax
Copy link
Owner

Hi,

Actually, I did not see any errors in the code. I am not sure how you used the reader or maybe it is an issue of python environment?

@ayrtondenner
Copy link
Author

Hi, thanks for the fast response.

So, in conll03_data,py, method read_data (line 150), the code will first instantiate CoNLL03Reader, where will define the variable self.__source_file as the file its opening, but whenever after that I try to use this variable, I get the error shown above (AttributeError: 'CoNLL03Reader' object has no attribute '__source_file').

Don't know if it is an issue in my python environment, because I could any other script or any other instructions in your project without any problems. My Python version is 3.6.5 by the way.

@ducalpha
Copy link

I use Python 2.7 and don't have any problem on running the code, and the code CoNLL03Reader looks good for me.

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

No branches or pull requests

3 participants