Home > front end >  How to use $PYTHONPATH to change cwd
How to use $PYTHONPATH to change cwd

Time:10-05

Goal: I want my run file test_data_module.py code via. bash in this working directory:

/home/me/.ssh/workers-python/workers/ontology_tagger/ontology_tagger/tests

Attempts:

PYTHONPATH=$PYTHONPATH:/home/danielbellio/.ssh/workers-python/workers/ontology_tagger/ontology_tagger/tests test_data_module.py

Error:

bash: test_data_module.py: command not found

CodePudding user response:

Use an explicit path for your Python program, i.e.

 ~/your/script/dir/test_data_module.py

if the script is executable, or

python ~/your/script/dir/test_data_module.py

respectively

python3 ~/your/script/dir/test_data_module.py

if it is not.

CodePudding user response:

PYTHONPATH is a list of folders, not files, so try with PYTHONPATH=$PYTHONPATH:/home/danielbellio/.ssh/workers-python/workers/ontology_tagger/ontology_tagger/

  • Related