Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

/usr/lib/python2.7/subprocess.py:OSError: [Errno 2] No such file or directory

14 views
Skip to first unread message

Marco Ippolito

unread,
Jan 6, 2014, 12:20:27 PM1/6/14
to pytho...@python.org
Hi everybody,
I'm trying to use MEGAM with NLTK.

running the file:

[Found /home/ubuntu/nltk_data/megam_i686.opt:
/home/ubuntu/nltk_data/megam_i686.opt]
Traceback (most recent call last):
File "classifying.py", line 494, in <module>
me_classifier = MaxentClassifier.train(train_feats, algorithm='megam')
File "/usr/local/lib/python2.7/dist-packages/nltk/classify/maxent.py",
line 319, in train
gaussian_prior_sigma, **cutoffs)
File "/usr/local/lib/python2.7/dist-packages/nltk/classify/maxent.py",
line 1522, in train_maxent_classifier_with_megam
stdout = call_megam(options)
File "/usr/local/lib/python2.7/dist-packages/nltk/classify/megam.py",
line 167, in call_megam
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, ininit
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

subprocess.py exists:

# subprocess - Subprocesses with accessible I/O streams
#
# For more information about this module, see PEP 324.
#
# This module should remain compatible with Python 2.2, see PEP 291.
#
# Copyright (c) 2003-2005 by Peter Astrand <ast...@lysator.liu.se>
#
# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/2.4/license for licensing details.

r"""subprocess - Subprocesses with accessible I/O streams

Any hints or suggestions?

Thank you very much for your help.

Marco

Chris Angelico

unread,
Jan 7, 2014, 12:21:38 AM1/7/14
to pytho...@python.org
On Tue, Jan 7, 2014 at 4:20 AM, Marco Ippolito <ippolit...@gmail.com> wrote:
> File "/usr/local/lib/python2.7/dist-packages/nltk/classify/megam.py",
> line 167, in call_megam
> p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
> File "/usr/lib/python2.7/subprocess.py", line 679, ininit
> errread, errwrite)
> File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
>
> subprocess.py exists:

The problem isn't inside subprocess itself, which is raising the
error. It looks like the problem is with the command being executed
via Popen. I would look in megam.py (the first line that I quoted
here) and see what the command is, and then see if you have that
installed correctly. It ought to be listed as a prerequisite.

ChrisA
0 new messages