Path not found when executing my python script from my cmd prompt -


folders

i have python script uses classes file next main.py named 'src'. these classes use images file 'img' next main.py well.

i'm writting path follows :

"img/myimage.gif"

when run python shell works fine can't run using command prompt (path not found).

i tried

"/img/myimage.gif" , "./img/myimage.gif"

and moving 'img' file src, , main.py's parent file doesn't work..

i'm out of ideas.. assistance appreciated, thanks,

this need folder structure,

program    main.py    src       __init__.py //empty py file       classa            __init__.py            classa.py        classb            __init__.py            classb.py  "../../img/myimage.gif"          // use in classa.py file 

more explanation:

if main.py in

    src        main.py     img        myimage.gif 

use this

"../img/myimage.gif" 

if folder structure (moving img inside src)

-src     main.py    -img        myimage.gif 

you need use below

"img/myimage.gif" 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -