[Geany-Users] Can't import local module

paul Marlin wurfsendungen at xxxxx
Fri Dec 13 16:53:53 UTC 2019


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'


_
_

_
_

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/users/attachments/20191213/1b7e1bf9/attachment.html>


More information about the Users mailing list