Re: [Python] ImportError and sys.path

2016-02-10 Per discussione Carlos Catucci
2016-02-10 19:21 GMT+01:00 Giovanni Porcari : > Sembra pure a me. > > Forse hai ragione: sarà l'età. > Non mi espirmo prima di avere approfondito, pero' in effetti molte cose come dice Marco (Beri) sono fatte come dovevano essere fatte (concettualmente) da sempre, altre non so. Certto vedevo il f

Re: [Python] ImportError and sys.path

2016-02-10 Per discussione Giovanni Porcari
> Il giorno 10 feb 2016, alle ore 11:03, Nicola Larosa ha > scritto: > > Marco Beri wrote: >> Con Python 2 ti serve __init__.py nella directory. > > Anche con Python 3.0, 3.1 e 3.2. > > Inoltre, da Python 3.3 in poi, se non metti il file __init__.py nelle > directory stai usando i namespace p

Re: [Python] ImportError and sys.path

2016-02-10 Per discussione Nicola Larosa
Marco Beri wrote: > Con Python 2 ti serve __init__.py nella directory. Anche con Python 3.0, 3.1 e 3.2. Inoltre, da Python 3.3 in poi, se non metti il file __init__.py nelle directory stai usando i namespace package: e non è det

Re: [Python] ImportError and sys.path

2016-02-10 Per discussione Roberto Polli
Il 10 febbraio 2016 08:34, Marco Beri ha scritto: > Con Python 2 ti serve __init__.py nella directory. Vabbé ma così è troppo facile ;) Pace, R. ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python

Re: [Python] ImportError and sys.path

2016-02-10 Per discussione Pietro
2016-02-10 8:34 GMT+01:00 Marco Beri : > Con Python 2 ti serve __init__.py nella directory. Grazie Marco ( e anche a Carlo che mi ha dato la soluzione via chat!) è stato sufficiente aggiungere i file __init__.py {{{ $ touch testlib/libgreen/__init__.py $ touch testlib/libhydro/__init__.py }}} e

Re: [Python] ImportError and sys.path

2016-02-09 Per discussione Marco Beri
Il 09 feb 2016 6:10 PM, "Pietro" ha scritto: > > Ciao, > > Sto scrivendo un programma che aggiorna il sys.path e controlla che > una certa libreria sia diventata importabile. Con Python 2 ti serve __init__.py nella directory. Ciao. Marco. ___ Python ma

Re: [Python] ImportError and sys.path

2016-02-09 Per discussione Roberto Polli
2016-02-09 18:18 GMT+01:00 Pietro : >> strace -e open python3 test_imp.py |& grep libgreen > non so bene come interpretare l'output di strace... Dovresti andare alla ricerca del file mancante con ENOENT, tipo il seguente. Prova a sostituire -e open con -e file > open("libpython3.5m.so.1.0", O_RD

Re: [Python] ImportError and sys.path

2016-02-09 Per discussione Pietro
Ciao Roberto, On Tue, Feb 9, 2016 at 6:12 PM, Roberto Polli wrote: > strace -e open python3 test_imp.py |& grep libgreen grazie per la risposta fulminea! non so bene come interpretare l'output di strace... {{{ $ strace -e open python3 test_imp.py |& grep libgreen imp.find_module('libgreen'

[Python] ImportError and sys.path

2016-02-09 Per discussione Pietro
Ciao, Sto scrivendo un programma che aggiorna il sys.path e controlla che una certa libreria sia diventata importabile. Nella mia home (sono su linux) ho creato una cartella strutturata nel seguente modo: {{{ $ mkdir -p testlib/libgreen $ touch testlib/libgreen/test0.py $ touch testlib/libgreen/

Re: [Python] ImportError and sys.path

2016-02-09 Per discussione Roberto Polli
Il 9 febbraio 2016 18:09, Pietro ha scritto: > $ python3 test_imp.py > Traceback (most recent call last): > File "test_imp.py", line 6, in > imp.find_module('libgreen') > File "/usr/lib/python3.5/imp.py", line 296, in find_module > raise ImportError(_ERR_MSG.format(name), name=name)