2
votes

Code: sh 'python ./selenium/xy_python/run_tests.py'

Error: Traceback (most recent call last): File "./selenium/xy_python/run_tests.py", line 6, in import nose ImportError: No module named nose

2

2 Answers

0
votes

I recommend explicitly activating a python env before you run your script in your jenkinsfile to ensure you are in an environment which has nose installed.

Please check out virtualenv, tox, or conda for information on how to do so.

0
votes

Does it run successfully if you start it manually? If yes, then you might have problems with PYTHONPATH. You can use withEnv to set it.

withEnv(['PYTHONPATH=/your/pythonpath']) {
    sh  'python ./selenium/xy_python/run_tests.py'
}