You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of now, before running a study script for the first time (e.g. in a new terminal) the PYTHONPATH variable needs to be set by running export PYTHONPATH="." on Unix or set PYTHONPATH = <path> on Windows. The specified path then gets added to sys.path which Python uses for locating its imports.
One issue is that you need to set this every time you start a new terminal.
Another issue is that "." is a relative path, so if you are working in another directory it does not work any more.
The following code adds the absolute pycopancore path directly to sys.path if added in a study script (that is located in the studies folder).
from os.path import dirname
import sys
sys.path.insert(0, dirname(dirname(__file__)))
Maybe it makes sense to add this to run scripts in general.
The text was updated successfully, but these errors were encountered:
As of now, before running a study script for the first time (e.g. in a new terminal) the PYTHONPATH variable needs to be set by running
export PYTHONPATH="."
on Unix orset PYTHONPATH = <path>
on Windows. The specified path then gets added tosys.path
which Python uses for locating its imports.One issue is that you need to set this every time you start a new terminal.
Another issue is that
"."
is a relative path, so if you are working in another directory it does not work any more.The following code adds the absolute
pycopancore
path directly tosys.path
if added in a study script (that is located in thestudies
folder).Maybe it makes sense to add this to run scripts in general.
The text was updated successfully, but these errors were encountered: