Re: Project layout / Import files from different subdirectories

2008-11-15 Thread Gabriel Genellina
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

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Almar Klein
> 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 fr

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Steve Holden
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 > mod

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Almar Klein
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 worki

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Jeremiah Dodds
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 > >

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Markus Mayer
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 a

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Steve Holden
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 p

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Stef Mientki
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 folde

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Markus Mayer
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

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Diez B. Roggisch
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 import

Project layout / Import files from different subdirectories

2008-11-10 Thread Markus Mayer
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/ __