tsroten / pynlpir

A Python wrapper around the NLPIR/ICTCLAS Chinese segmentation software.
MIT License
566 stars 135 forks source link

Cannot open file KeyBlackList.pdat #75

Closed tanhu1230 closed 7 years ago

tanhu1230 commented 7 years ago

I got the pynlpir through pip and it works well yesterday,but today it seem to get some problems when I try to initial it.The runtime error showing below:

/home/swan/anaconda2/lib/python2.7/site-packages/pynlpir/__init__.pyc in open(data_dir, encoding, encoding_errors, license_code)
    106     if not nlpir.Init(data_dir, encoding_constant, license_code):
    107         _attempt_to_raise_license_error(data_dir)
--> 108         raise RuntimeError("NLPIR function 'NLPIR_Init' failed.")
    109     else:
    110         logger.debug("NLPIR API initialized.")

RuntimeError: NLPIR function 'NLPIR_Init' failed.

I hava downloaded the latest NLPIR.user file from https://github.com/NLPIR-team/NLPIR/tree/master/License and replace it in Data document,but still have this problem.

tsroten commented 7 years ago

@tanhu1230 Hmm, that is odd. In the Data directory, can you see if there are any files that have names that end with .err or .log? If you do, post what they say in them.

They are typically named with the date and time, like 20170418.err.

Thanks!

tanhu1230 commented 7 years ago
[2017-04-19 11:46:44]   Cannot open file 
[2017-04-19 11:46:44]   /home/swan/anaconda2/lib/python2.7/site-packages/pynlpir/Data/KeyBlackList.pdat
tsroten commented 7 years ago

@tanhu1230 It looks like it is a permission error. I'm not that familiar with anaconda, but you might try making sure that your user owns the anaconda2 folder:

$ sudo chown -R swan /home/swan/anaconda2

Or:

$ sudo chown -R swan /home/swan/anaconda2/lib/python2.7/site-packages/pynlpir/Data
tanhu1230 commented 7 years ago

OK,it is working now,thank you very much!

tsroten commented 7 years ago

No problem! Good luck with your coding :)