Closed nbolten closed 6 years ago
Done by 350973d (I used a BASE_DIR
variable). Can you confirm it works?
Thank you! :)
Hey! Your solution is better because it avoids running os.chdir
at all.
It does have a redundant os.path.dirname
though, just a heads up.
main.py
still runs os.chdir
, and it's messing up my scripts because it changes the meaning of __file__
somehow, or something like that. So far as I can tell, its purpose is to make it so that field_parser.py
can find the .ebnf file. I think this would fix it:
main.py
:os.chdir(os.path.dirname(os.path.realpath(__file__)))
field_parser.py
:From:
base_dir = os.path.realpath(os.path.join(
os.getcwd(), os.path.dirname(__file__)
))
To:
base_dir = is.path.dirname(os.path.realpath(__file__))
Thank you! Done with a1bdc6e, can you confirm (again) please?
Ping @nbolten. ;)
I wanted to use a fork (temporarily), and found that the default
setup.py
fails on my system (Python 3.5, Ubuntu 16.04) as it usessys.path[0]
in an attempt to find the development directory. I assume this is because the main dev environment involves prepending to $PYTHONPATH. However, this makes the package non-portable -system.path[0]
is set to''
by default, sosetup.py
raises aFileNotFoundError
when attempting to change to that directory.To indicate the directory of
setup.py
, use__file__
:os.path.chdir(os.path.dirname(os.path.realpath(__file__)))