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.
This is related to a setproctitle issue (which unfortunately is marked closed): https://github.com/dvarrazzo/py-setproctitle/issues/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):
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!