I started Geany from the Ubunto menu.

I ran:

import sys

print(sys.path)

First I tried Geany and got

/tmp/geany_run_script_UR8SC0.sh: 7: ./sys: Permission denied
------------------
(program exited with code: 126)

Then I tried Idle and got

['/home/paul/py/test', '/home/paul', '/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/home/paul/.local/lib/python3.7/site-packages', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']

From the terminal I got

['', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/home/paul/.local/lib/python3.7/site-packages', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']

I think I see the problem.  Python is looking in

/home/paul/.local/lib/python3.7/site-packages

but I was sure I added

/home/paul/py

to PYTHONPATH

How can I change the path?  An a rhetorical question.  Why is Idle smarter?

Thank you for your response.

Paul
=======================================================================

On 12/14/19 8:28 AM, Georg Klingenberg wrote:
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@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@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users