Skip to content

Importing in sitecustomize.py breaks python command line #99

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

Open
agibli opened this issue Dec 14, 2016 · 0 comments
Open

Importing in sitecustomize.py breaks python command line #99

agibli opened this issue Dec 14, 2016 · 0 comments

Comments

@agibli
Copy link

agibli commented Dec 14, 2016

This is related to a setproctitle issue (which unfortunately is marked closed): dvarrazzo/py-setproctitle#49

Importing pystatsd imports the pystatsd.server module, which attempts to import setproctitle, if it is available.

As a consequence of the linked issue, importing pystats within a sitecustomize.py will cause python to fail to execute scripts with command line arguments (if setproctitle is available):

$ touch test.py
$ echo "import pystatsd" > sitecustomize.py
$ export PYTHONPATH=.:$PYTHONPATH
$ python test.py --some-arg
python test.py --some-arg: can't open file 'test.py --some-arg': [Errno 2] No such file or directory

Absent an upstream fix, it may be worth somehow adding an option to disable use of setproctitle, and/or lazily importing it to work around the issue.

Thanks!

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

No branches or pull requests

1 participant