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

PYTHONHUNTER="stdlib=False,Q(filename_contains='venv')" is invalid #89

Open
abitrolly opened this issue Jan 17, 2021 · 5 comments
Open

Comments

@abitrolly
Copy link
Contributor

Running a script with PYTHONHUNTER="stdlib=False,Q(filename_contains='venv')" python a_script.py produces this error.

Failed to load hunter from PYTHONHUNTER environ variable "stdlib=False,Q(filename_contains='venv')": SyntaxError('positional argument follows keyword argument', ('<string>', 1, 47, "trace(stdlib=False,Q(filename_contains='venv'))"))
Failed to load hunter from PYTHONHUNTER environ variable "stdlib=False,Q(filename_contains='venv')": SyntaxError('positional argument follows keyword argument', ('<string>', 1, 47, "trace(stdlib=False,Q(filename_contains='venv'))"))
@ionelmc
Copy link
Owner

ionelmc commented Jan 17, 2021

Unfortunately hunter doesn't have a custom parser, it just uses python. Therefore you must obey python syntax - you can't give a positional argument after a keyword one. Try Q(filename_contains='venv'),stdlib=False instead.

@abitrolly
Copy link
Contributor Author

Do you mean it uses some kind of Python eval to parse the string as function argument?

@ionelmc
Copy link
Owner

ionelmc commented Jan 17, 2021

Yeeep.

@ionelmc
Copy link
Owner

ionelmc commented Jan 17, 2021

Maybe in the future there will be a fancy parser but it's a big feature.

@abitrolly
Copy link
Contributor Author

Strange that Python doesn't ship with some basic parser lib that allows to detect pair braces and stuff.

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

2 participants