Re: __init__.py and package help

2009-01-05 Thread TechieInsights
Thanks J. Cliff Dyer wrote: > On Mon, 2009-01-05 at 11:49 -0800, TechieInsights wrote: > > Ok I have read all of the tutorials and documents I could find. I am > > running Python 2.6 on windows. The problem I am having with packages > > is that they don't show up! > > > > Simple example of what

Re: __init__.py and package help

2009-01-05 Thread J. Cliff Dyer
On Mon, 2009-01-05 at 11:49 -0800, TechieInsights wrote: > Ok I have read all of the tutorials and documents I could find. I am > running Python 2.6 on windows. The problem I am having with packages > is that they don't show up! > > Simple example of what isn't working... > Structure- > > pyte

Re: __init__.py and package help

2009-01-05 Thread TechieInsights
Ok... I figured it out... you can only import packages via the __all__ = ['subpackage/folder']... if you include a module such as hello.py, it will fail. Go figures I'd find this right after posting here... Greg TechieInsights wrote: > Ok I have read all of the tutorials and documents I could fi

Re: __init__.py file

2008-04-09 Thread Jeffrey Barish
cesco wrote: > I need to instantiate an object (my_object) whose methods I have to > use in two files (file1.py and file2.py) which are in the same > directory. Is it possible to instantiate such object in the > __init__.py file and then directly use it in file1.py and file2.py? > If not, as I seem

Re: __init__.py file

2008-04-08 Thread Gabriel Genellina
En Tue, 08 Apr 2008 17:51:21 -0300, cesco <[EMAIL PROTECTED]> escribió: > I need to instantiate an object (my_object) whose methods I have to > use in two files (file1.py and file2.py) which are in the same > directory. Is it possible to instantiate such object in the > __init__.py file and then

Re: __init__.py file

2008-04-08 Thread Steven W. Orr
On Tuesday, Apr 8th 2008 at 16:51 -, quoth cesco: =>Hi, => =>I need to instantiate an object (my_object) whose methods I have to =>use in two files (file1.py and file2.py) which are in the same =>directory. Is it possible to instantiate such object in the =>__init__.py file and then directly u

Re: __init__.py

2007-03-27 Thread Tina I
Jorgen Grahn wrote: > On Mon, 26 Mar 2007 08:27:19 +0200, Tina I <[EMAIL PROTECTED]> wrote: >> Tina I wrote: >>> When looking at other peoples code (to learn from it) I keep seeing an >>> empty file named "__init__.py". What's the purpose of this? >>> >>> Thanks >>> Tina >> Duh! Never mind... foun

Re: __init__.py

2007-03-27 Thread Steve Holden
Jorgen Grahn wrote: > On Mon, 26 Mar 2007 08:27:19 +0200, Tina I <[EMAIL PROTECTED]> wrote: >> Tina I wrote: >>> When looking at other peoples code (to learn from it) I keep seeing an >>> empty file named "__init__.py". What's the purpose of this? >>> >>> Thanks >>> Tina >> Duh! Never mind... foun

Re: __init__.py

2007-03-27 Thread Jorgen Grahn
On Mon, 26 Mar 2007 08:27:19 +0200, Tina I <[EMAIL PROTECTED]> wrote: > Tina I wrote: >> When looking at other peoples code (to learn from it) I keep seeing an >> empty file named "__init__.py". What's the purpose of this? >> >> Thanks >> Tina > > Duh! Never mind... found it. > Kinda neat actuall

Re: __init__.py

2007-03-25 Thread Tina I
Tina I wrote: > When looking at other peoples code (to learn from it) I keep seeing an > empty file named "__init__.py". What's the purpose of this? > > Thanks > Tina Duh! Never mind... found it. Kinda neat actually :) T -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__.py

2006-11-14 Thread km
Hi, wow ! i tried it and it works like charm! could access  variables  declared at root module dir  in submodules. also i would like to know if i can have an abstract class declared in __init__.py  with common variables ? regards, KMOn 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: "km" wrote

Re: __init__.py

2006-11-14 Thread Fredrik Lundh
"km" wrote: > wow ! i tried it and it works like charm! > could access variables declared at root module dir in submodules. > also i would like to know if i can have an abstract class declared in > __init__.py with common variables ? you don't really need our permission to try things out, you

Re: __init__.py

2006-11-14 Thread Fredrik Lundh
"km" wrote: > I have a structure like this : > foo/__init__.py > foo/bar/__init__.py > foo/bar/firstmodule.py > foo/abc/__init__.py > foo/abc/secondmodule.py > > now i have some variables (paths to data files) common, to be used in > first module and second modules respectively. > can i set those

Re: __init__.py

2006-11-14 Thread km
Hi, I have a structure like this : foo/__init__.py foo/bar/__init__.py foo/bar/firstmodule.py foo/abc/__init__.py foo/abc/secondmodule.py now i have some variables (paths to data files) common, to be used in first module and second modules respectively. can i set those variables in foo/

Re: __init__.py

2006-11-14 Thread Fredrik Lundh
km wrote: > what is the use of __init__.py file in a module dir ? it tells Python that the directory is a package directory. if you have mydir/foo/__init__.py mydir/foo/module.py and mydir is on the path, you can do "import foo.module" or "from foo import module". if you remove the

Re: __init__.py, __path__ and packaging

2006-05-05 Thread Sandro Dentella
> Now, why you couldn't do "dbg.DBG = ..."? Very simple... "from > module import *" doesn't give you a dbg /module/, it only gives you > references to each piece inside the module. really the reason why I wanted that should probably be solved in other ways. I just wanted to split my dbg

Re: __init__.py, __path__ and packaging

2006-05-04 Thread Sandro Dentella
In comp.lang.python, hai scritto: > Sandro Dentella wrote: >> The structure of my package: >> >> python/ >> `-- dbg/ >>|-- __init__.py >>`-- lib >>|-- __init__.py >>|-- debug.py >>`-- gtk_dbg.py >> >> my sys.path includes 'python' and I wanted that the content of d

Re: __init__.py, __path__ and packaging

2006-05-03 Thread Scott David Daniels
Sandro Dentella wrote: > The structure of my package: > > python/ > `-- dbg/ >|-- __init__.py >`-- lib >|-- __init__.py >|-- debug.py >`-- gtk_dbg.py > > my sys.path includes 'python' and I wanted that the content of debug.py was > simply included by: 'import dbg',

Re: __init__.py in packages

2005-06-08 Thread Greg Ewing
Gary Wilson Jr wrote: I would really like to see an example or situation that makes good use of the __init__.py file. I've attached a non-trivial example, from my PyGUI package. It uses some trickery to switch in one of a number of subdirectories of platform specific code, and then imports a bu

Re: __init__.py in packages

2005-06-08 Thread Jarek Zgoda
Gary Wilson Jr napisał(a): > What is intended use for __init__.py files? > Well, I found this: http://www.python.org/doc/essays/packages.html >>From what I can gather it is for initialization of the package when doing an > import, but I would really like to see an example or situation that makes g

Re: __init__.py in packages

2005-06-08 Thread F. Petitjean
Le Wed, 08 Jun 2005 10:34:38 -0500, Gary Wilson Jr a écrit : > I'm creating a python package foo. > > What is intended use for __init__.py files? > Well, I found this: http://www.python.org/doc/essays/packages.html >>From what I can gather it is for initialization of the package when doing an > im

Re: __init__.py question

2005-04-23 Thread Terry Hancock
On Friday 22 April 2005 07:19 am, codecraig wrote: > Ok, I have the following directory structure > > C:\pycode >--> blah.py >--> mynewdir > --> __init__.py > --> abc.py > > [[ C:\pycode\mynewdir\abc.py ]] > > def doFoo(): > print "hi" > > def doBar(): > print "bye"