[Geany-Users] Can't import local module
Lex Trotman
elextr at xxxxx
Fri Dec 13 21:22:44 UTC 2019
How are you starting Geany? Its possible you are starting it in a way
that PYTHONPATH is not set. Perhaps test it by running a small Python
program with Geany to print sys.path.
Cheers
Lex
On Sat, 14 Dec 2019 at 02:54, paul Marlin <wurfsendungen at biketrain.net> wrote:
>
> This is a variation of the many questions complaining that one can't import exotic external modules, even though the import works from the terminal. The many answers suggest fixing the execute command in the Build screen. The difference here is that I can't import a module from my own machine, but that it works at both the terminal and Idle. I suspect my problem is a PATH issue. Geany seems like a very nice editor/IDE. But if I can't import even my own modules, it's not very useful.
>
> My simplified directory structure:
>
> py - root for storing python MODULES (apps) and a module of user defined functions (included in PYTHONPATH)
>
> ----| main
>
> main.py
>
> ----| common (for storing functions accessible by multiple modules
>
> fun.py
>
> The code:
>
> main.py
>
> from common import fun
>
> fun.test()
>
> fun.py
>
> def test():
>
> print('testing')
>
> Ouput from Idle
>
> ========================== RESTART: C:/py/test/main.py =========================
> testing
> >>>
>
> Output from Geany
>
>
> ModuleNotFoundError: No module named 'py'
>
> Original exception was:
> Traceback (most recent call last):
> File "test.py", line 1, in <module>
> from py.common import fun
> ModuleNotFoundError: No module named 'py'
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list