I found a question that suggested running the code below to set my PYTHONPATH variable in git bash, which it does fine. However, I am still getting an error on my import statement. Is there something more I need to do to get a file to import? I have been having to use the work around below to add it to the path
Workaround
sys.path.append('../')
What I've tried
- existing python script file in directory x
- existing python
\__init\__.py
file in x
- C:Repositoriesops_tools added to PYTHONPATH variable available to the user
Set Path
winpath=$(echo $MSYS2_WINPATH | tr ";" "
" | sed -e 's/\/\\/g' | xargs -I {} cygpath -u {})
unixpath=''
# Set delimiter to new line
IFS=$'
'
for pth in $winpath; do unixpath+=$(echo $pth)":"; done
export PYTHONPATH$(echo $PYTHONPATH$unixpath | sed -e 's/:$//g')
unset IFS
unset unixpath
unset winpath
Output
The output of $PYTHONPATH
now shows the path. But it still doesn't recognize the import statement.
bash: /c/Repositories/ops_tools:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…