Closed ankit51 closed 7 years ago
Could you please paste the whole exception?
Here it is:
Traceback (most recent call last):
File "crf_test_only.py", line 36, in
Do you by chance run this script from python-crfsuite source checkout? What's the output of
>>> import pycrfsuite
>>> print(pycrfsuite.__file__)
I am getting this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pycrfsuite' has no attribute '__file__'
Hm, that's strange. What does import inspect; inspect.getfile(pycrfsuite)
return? I'm trying to figure out where pycrfsuite is imported from; likely it is not imported from a right location, and that's the cause of the error.
I am getting this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/synology/data/home/a.malik/anaconda3/lib/python3.5/inspect.py", line 607, in getfile
raise TypeError('{!r} is a built-in module'.format(object))
TypeError: <module 'pycrfsuite' (namespace)> is a built-in module
Hey thanks
I have found the error. The export path was incorrect.
It should have been: export PATH="/home/tomcat/anaconda3/bin:$PATH"
Really sorry to bother you.
That's strange because pycrfsuite is not a built-in module, pycrfsuite top-level module is pure Python: https://github.com/scrapinghub/python-crfsuite/blob/master/pycrfsuite/__init__.py.
I think you may need to print import sys; print(sys.path)
and look for files and subfolders named pycrfsuite located under these paths. Usual suspect is the current directory - do you have anything named pycrfsuite in it?
Ah, glad to see you've resolved it!
Do you by chance run this script from python-crfsuite source checkout? What's the output of
>>> import pycrfsuite >>> print(pycrfsuite.__file__)
I am getting same issue. For print(pycrfsuite.file) command, I am getting the path to the init.py file of pycrfsuite. Can you give me some more pointers>
I am trying to run a python script from Linux command line and I am getting this error when declaring Tagger.
tagger = pycrfsuite.Tagger()
I am using Python 3.5.2 |Anaconda 4.2.0 (64-bit) This was running fine on some other Linux machine.
What could be the possible solution?