User:StasFomin/AviSynth/Bugs/Pyscripter/No import from same directory

From Wiki4Intranet
Jump to: navigation, search

Issue: When Run/debug from PyScripter, it is impossible to import modules from same directory.

Consider two almost empty file python modules a.py and b.py in the same directory, a.py imports b.py.

  • a.py successfully run in console, or from IDE, like Komodo IDE.

Pyscripter. No import from same directory, 01.png

  • In pyscripter, if working directory is not equal to directory of a.py we have «ImportError: No module named b»

Pyscripter. No import from same directory, 02.png

I use «engine type=remote» and RPyc because of http://code.google.com/p/pyscripter/issues/detail?id=256, but I see same problem with internal debug engine.

Now I use ugly workaround:

import inspect, os
curpath = os.path.dirname(inspect.getfile(inspect.currentframe()))
sys.path.append(curpath)

but hope, that the issue can be fixed without it.

Any idea, what is wrong with me or PyScripter?

Thanks all in advance, Sincerely, Stas Fomin