Search code examples
pythonpython-2.7pos-tagger

Genia Tagger cannot find file in Python2.7 (using Windows)


(The OS on my computer is Windows8) I tried to install and run geniatagger by following these steps:

In cmd:

python setup.py install

In Python shell:

from geniatagger import Geniatagger
tagger = GeniaTagger('C:\Users\wen\Downloads\geniatagger\geniatagger')

error messages:

Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
    tagger = GeniaTagger('C:\Users\wen\Downloads\geniatagger\geniatagger')
  File "build\bdist.win-amd64\egg\geniatagger.py", line 21, in __init__
    stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  File "D:\Program Files\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "D:\Program Files\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

I have looked for many solutions but the error still can't be fixed. How can I fix it?


Solution

  • Notice that the error says D: instead of C:. Something in your shell setup seems to be defaulting to the D drive. Is this script is being run from the C drive or D? If it's the C drive, you could try using relative pathing instead of absolute. If it's running from the D drive, can you run it from C? If it must run from D, you'll have to dig into the genia tagger docs to figure out how to do some custom configuration.