[Geany-Users] Can't import local module

Georg Klingenberg georg.klingenberg at xxxxx
Sat Dec 14 13:28:25 UTC 2019


an whilst you are at it set up a virtual environment (venv) to keep the 
versions nicely apart (batteries are included);
in Geany, each environment corresponds to a particular project (with its 
respective settings)..

-----Original Message----- 
From: Lex Trotman
Sent: Friday, December 13, 2019 10:22 PM
To: Geany general discussion list
Subject: Re: [Geany-Users] Can't import local module

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
_______________________________________________
Users mailing list
Users at lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users 



More information about the Users mailing list