En Tue, 11 Nov 2008 09:29:44 -0200, Stef Mientki [EMAIL PROTECTED]
escribió:
On Tue, Nov 11, 2008 at 8:46 AM, Markus Mayer [EMAIL PROTECTED] wrote:
I'm new to python and have a slight problem importing - or maybe
understanding - modules. I'm writing a GUI application using Qt4 and
wanted to
Markus Mayer schrieb:
Hi folks.
I'm new to python and have a slight problem importing - or maybe
understanding - modules. I'm writing a GUI application using Qt4 and
wanted to separate the business from the view logic. So I have my folder
structure as following:
project/ main.py
Diez B. Roggisch schrieb:
By placing a __init__.py into project, and then
import project.main
import project.gui.mainwindow
Diez
Ouch. Thanks.
Markus
--
PGP/GPG key 0x2EB39BF9
--
http://mail.python.org/mailman/listinfo/python-list
It works when the program you are executing is in the current working
directory, because Python always puts the directory containing the
program you are executing (not the current working directory) on the path.
Aha, that makes sense.
I also found with a quick test that importing a module from
Almar Klein wrote:
If your main file is in the root of the project, you can just
use absolute imports. So you can use gui.anotherwindow
or project.important from all files.
I'm not sure this is good practice though...
I was first under the impression that you can always import
modules
Steve Holden schrieb:
If you want shorter names in your main code, of course, you can use
import project.main as main
import project.gui.mainwindow as window
or somethihg similar.
regards
Steve
Yeah, I was going with the from x import y scheme by now, didn't know
as was available as
On Tue, Nov 11, 2008 at 7:08 AM, Markus Mayer [EMAIL PROTECTED] wrote:
Steve Holden schrieb:
If you want shorter names in your main code, of course, you can use
import project.main as main
import project.gui.mainwindow as window
or somethihg similar.
regards
Steve
Are
If your main file is in the root of the project, you can just
use absolute imports. So you can use gui.anotherwindow
or project.important from all files.
I'm not sure this is good practice though...
I was first under the impression that you can always import
modules that are in your current
On Tue, Nov 11, 2008 at 8:46 AM, Markus Mayer [EMAIL PROTECTED] wrote:
Hi folks.
I'm new to python and have a slight problem importing - or maybe
understanding - modules. I'm writing a GUI application using Qt4 and
wanted to separate the business from the view logic. So I have my folder
Markus Mayer wrote:
Diez B. Roggisch schrieb:
By placing a __init__.py into project, and then
import project.main
import project.gui.mainwindow
Diez
Ouch. Thanks.
If you want shorter names in your main code, of course, you can use
import project.main as main
import
Hi folks.
I'm new to python and have a slight problem importing - or maybe
understanding - modules. I'm writing a GUI application using Qt4 and
wanted to separate the business from the view logic. So I have my folder
structure as following:
project/ main.py
important.py
project/ gui/
11 matches
Mail list logo