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

Importing setproctitle changes argv #49

Closed
MarcBruenink opened this issue Jun 9, 2016 · 4 comments
Closed

Importing setproctitle changes argv #49

MarcBruenink opened this issue Jun 9, 2016 · 4 comments

Comments

@MarcBruenink
Copy link

MarcBruenink commented Jun 9, 2016

Importing setproctitle changes argv in unexpected ways.
Test case attached.
test_setproctitle.zip

Before import:
argv[0]: ./test_setproctitle
argv[1]: 1
argv[2]: 2
argv[3]: 3

After import:
argv[0]: ./test_setproctitle 1 2 3
argv[1]: 1 2 3
argv[2]: 2 3
argv[3]: 3

This is related to #45 and #46. But it is also different.
This was very hard to find (took me 1 day). Also, it is a show stopper. Thus, the severity is quite high (for me).
Tested with 1.1.7 and 1.1.10.

@dvarrazzo
Copy link
Owner

This is how setproctitle works.

If it is a showstopper for you, don't use it.

@MarcBruenink
Copy link
Author

This means you can only use the module in a restricted setting.
Please document the constraints in a prominent position.

@agibli
Copy link

agibli commented Dec 14, 2016

Just ran into this. As a result, if setproctitle is imported during execution of a sitecustomize.py, it is not possible to pass arguments to python scripts:

$ touch test.py
$ echo "import setproctitle" > 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

In my case the import of setproctitle was a consequence of importing pystatsd.

@wookayin
Copy link

wookayin commented Dec 24, 2018

Well, I think this is supper weird. Why do you intend such a behavior? It changes the sensible default behavior.

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

4 participants