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

setup.py: fix installation under pip #1

Merged
merged 1 commit into from Apr 9, 2014
Merged

setup.py: fix installation under pip #1

merged 1 commit into from Apr 9, 2014

Conversation

bazsi
Copy link
Contributor

@bazsi bazsi commented Apr 9, 2014

pip installs pynlpl by invoking the setup.py without a fully specified path,
causing the chdir() invocation to fail with this message:

Downloading PyNLPl-0.6.5.1.tar.gz (121kB): 121kB downloaded
Running setup.py egg_info for package pynlpl
Traceback (most recent call last):
File "", line 16, in
File "/tmp/pip_build_bazsi/pynlpl/setup.py", line 11, in
os.chdir(os.path.dirname(sys.argv[0]))
OSError: [Errno 2] No such file or directory: ''
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 16, in

File "/tmp/pip_build_bazsi/pynlpl/setup.py", line 11, in

os.chdir(os.path.dirname(sys.argv[0]))

The workaround is to tell pip not to clean up the sources and install
pynlpl manually. This fix solves the problem by not using
argv[0] that might lack a fully specified path, but rather using file,
that Python already fills nicely for us.

Signed-off-by: Balazs Scheidler bazsi@balabit.hu

pip installs pynlpl by invoking the setup.py without a fully specified path,
causing the chdir() invocation to fail with this message:

  Downloading PyNLPl-0.6.5.1.tar.gz (121kB): 121kB downloaded
  Running setup.py egg_info for package pynlpl
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip_build_bazsi/pynlpl/setup.py", line 11, in <module>
        os.chdir(os.path.dirname(sys.argv[0]))
    OSError: [Errno 2] No such file or directory: ''
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/tmp/pip_build_bazsi/pynlpl/setup.py", line 11, in <module>

    os.chdir(os.path.dirname(sys.argv[0]))

The workaround is to tell pip not to clean up the sources and install
pynlpl manually. This fix solves the problem by not using
argv[0] that might lack a fully specified path, but rather using __file__,
that Python already fills nicely for us.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
proycon added a commit that referenced this pull request Apr 9, 2014
setup.py: fix installation under pip , use __file__ instead of sys.argv[0]
@proycon proycon merged commit a4a215d into proycon:master Apr 9, 2014
@proycon
Copy link
Owner

proycon commented Apr 9, 2014

Thanks for your fix!

@proycon
Copy link
Owner

proycon commented Apr 9, 2014

I have pushed the fix to the Python Package Index as well now.

@bazsi
Copy link
Contributor Author

bazsi commented Apr 9, 2014

great, thanks. This patch didn't solve all pip install problems though. I might have some followups, but great to know there's a responsive author.

thanks for the great product.

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

Successfully merging this pull request may close these issues.

None yet

2 participants