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

SyntaxError: invalid syntax ERROR: could not load C:\**\**\conftest.py #3354

Closed
akra7777 opened this issue Mar 29, 2018 · 6 comments
Closed
Labels
type: bug problem that needs to be addressed type: question general question, might be closed after 2 weeks of inactivity

Comments

@akra7777
Copy link

akra7777 commented Mar 29, 2018

Traceback (most recent call last):
File "c:\python27\lib\site-packages_pytest\config.py", line 371, in importco nftest
mod = conftestpath.pyimport()
File "c:\python27\lib\site-packages\py_path\local.py", line 668, in pyimport
import(modname)
File "c:\python27\lib\site-packages_pytest\assertion\rewrite.py", line 213, i n load_module
py.builtin.exec
(co, mod.dict)
File "c:\python27\lib\site-packages\py_builtin.py", line 221, in exec_
exec2(obj, globals, locals)
File "", line 7, in exec2
File "C:**\conftest.py", line 8, in
from lambo_dbus import LamboDbus
File "C:**\samp_dbus.py", line 108
def on_signal_received(self, args, received_signal_name):
^
SyntaxError: invalid syntax
ERROR: could not load C:*
**\conftest.py

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Mar 29, 2018
@RonnyPfannschmidt RonnyPfannschmidt added the type: question general question, might be closed after 2 weeks of inactivity label Mar 29, 2018
@pytestbot
Copy link
Contributor

GitMate.io thinks possibly related issues are #572 (Syntax error in docs (redux ;)), #1404 (conftest.py loaded in wrong order.), #612 (Syntax error on assertion reinterpretation), #561 (SyntaxError in docs), and #520 (Silent crash when exec produces a syntax error involving Unicode).

@RonnyPfannschmidt
Copy link
Member

it looks like you try to run python3 code with python2

the syntax on the last line is supported on python 3 and not on python2

as far as i can tell pytest cant help that at all, please set up your env correctly

@akra7777
Copy link
Author

@RonnyPfannschmidt thanks for an update in env I have to set python.exe path or something more??

@RonnyPfannschmidt
Copy link
Member

i am not fluent with python version setup on windows,
its only clear that your setup uses a python2, and you need a setup with a python3

@The-Compiler
Copy link
Member

The-Compiler commented Mar 29, 2018

I agree this isn't any kind of pytest issue.

@nicoddemus
Copy link
Member

@akra7777 on Windows you can use the py launcher to execute pytest in any version you like:

py -3.7 -m pytest ....

But this is indeed not related to pytest itself, is basic Python environment setup. I'm sure there are plenty of tutorials on the web about that, you should also look in how to setup virtual environments or using conda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed type: question general question, might be closed after 2 weeks of inactivity
Projects
None yet
Development

No branches or pull requests

5 participants