Re: question about importing a package

2012-12-06 Thread Terry Reedy
On 12/6/2012 11:50 AM, Matt wrote: It works now. Steven and Alex, thanks for your help! I ended up leaving sample.py and foo.py and bar.p the way they were, and in __init__.py putting: from foo import * from bar import * So my mistake was not importing the foo and bar modules into sub_one/__

Re: question about importing a package

2012-12-06 Thread Matt
It works now. Steven and Alex, thanks for your help! I ended up leaving sample.py and foo.py and bar.p the way they were, and in __init__.py putting: from foo import * from bar import * So my mistake was not importing the foo and bar modules into sub_one/__init__.py. I also see how the __all_

Re: question about importing a package

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 20:58:46 -0800, Matt wrote: > I have a directory structure that looks like this: > > sample.py > sub_one/ > __init__.py # defines only the list __all__ = ['foo', 'bar'] > foo.py # defines the function in_foo() > bar.py # defines the function in_bar()

Re: question about importing a package

2012-12-05 Thread alex23
On 6 Dec, 14:58, Matt wrote: > I have a directory structure that looks like this: > > sample.py > sub_one/ >       __init__.py     # defines only the list    __all__ = ['foo', 'bar'] >       foo.py           # defines the function in_foo() >       bar.py           # defines the function in_bar() >

Re: question about importing a package

2012-12-05 Thread Chris Angelico
On Thu, Dec 6, 2012 at 3:58 PM, Matt wrote: > I have about 30 modules in my package (foos and bars) and I don't want 30 > lines at the top of each file that uses this package. What am I doing wrong? Not necessarily wrong, but definitely something to query: WHY do you have thirty modules in your

question about importing a package

2012-12-05 Thread Matt
I have a directory structure that looks like this: sample.py sub_one/ __init__.py # defines only the list__all__ = ['foo', 'bar'] foo.py # defines the function in_foo() bar.py # defines the function in_bar() In sample.py, I have this command at the

Re: py2exe importing a package not in library.zip

2008-08-25 Thread mypetslug
d If I do include the tests in the library.zip, it works with > the tests that I have now, but then I still can't add any new ones > without the attribute error unless I regenerate the exe every time. > > Basically, it seems like it comes down to importing a package outside > t

py2exe importing a package not in library.zip

2008-08-20 Thread mypetslug
the attribute error unless I regenerate the exe every time. Basically, it seems like it comes down to importing a package outside the library.zip. So, is there any way to do this with py2exe? Or even another exe creating application? Thanks, MyPetSlug -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with importing a package

2006-10-15 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I have to work with matrices on python and for that i need a package > NUMPY. I downloaded it and saved it in the same folder as the program > which imports it. But on running the program it gives an error > "ImportError: No module named numpy". Do we need to save the fi

Problem with importing a package

2006-10-15 Thread [EMAIL PROTECTED]
I have to work with matrices on python and for that i need a package NUMPY. I downloaded it and saved it in the same folder as the program which imports it. But on running the program it gives an error "ImportError: No module named numpy". Do we need to save the file required to be imported in a sp

Re: importing a package

2005-06-22 Thread Benedict Verheyen
Damjan wrote: >>Indeed, when i do this, then it works >>import sys >>sys.path.append('package') >> >>However, why is it that package isn't added automatically to the pad? > > > When you execute a python program the directory where the program is is > automatically added to sys.path. No other dire

Re: importing a package

2005-06-22 Thread Damjan
> Indeed, when i do this, then it works > import sys > sys.path.append('package') > > However, why is it that package isn't added automatically to the pad? When you execute a python program the directory where the program is is automatically added to sys.path. No other directory is added to the d

Re: importing a package

2005-06-22 Thread flupke
Damjan wrote: >>I developed a package with a structure like this >>src/ >>tesfile.py >>dir1/ >>__init__.py >>file1.py >>dir2/ >>__init__.py >>file2.py > > > Importing dir2/file2 from dir1/file1.py works here, because when yuo started > the testfile scri

Re: importing a package

2005-06-22 Thread Damjan
> I developed a package with a structure like this > src/ > tesfile.py > dir1/ > __init__.py > file1.py > dir2/ > __init__.py > file2.py Importing dir2/file2 from dir1/file1.py works here, because when yuo started the testfile script the src/ directory w

importing a package

2005-06-22 Thread flupke
Hi, I developed a package with a structure like this src/ tesfile.py dir1/ __init__.py file1.py dir2/ __init__.py file2.py The testfile is meant to try the code out that is specified in file1.py and file2.py Now i have another project where i want to