OK I've had a modicum of success! However I was forced to add the path
to my application folder to sys.path, which I suppose is the closest I
can get to what I want. The example given then works in the shell.
Apache is another problem. I added the same path to the script then
Apache finds the appl
> Peter Otten wrote:
> |-- alpha
> | |-- __init__.py
> | |-- beta
> | | |-- __init__.py
> | | `-- one.py
> | `-- two.py
> `-- main.py
>
> 2 directories, 5 files
> $ cat main.py
> import alpha.beta.one
> $ cat alpha/beta/one.py
> from ..alpha import two
> $ cat alpha/two.py
> print "s
Peter Otten wrote:
> Peter Otten wrote:
>
>> Gnarlodious wrote:
>>
>>> On Nov 3, 2:51 am, Peter Otten wrote:
>>>
Slightly generalized: have the importing module print its __name__.
There has to be at least one dot in the name for
from .. import whatever
to succeed.
Peter Otten wrote:
> Gnarlodious wrote:
>
>> On Nov 3, 2:51 am, Peter Otten wrote:
>>
>>> Slightly generalized: have the importing module print its __name__.
>>> There has to be at least one dot in the name for
>>>
>>> from .. import whatever
>>>
>>> to succeed.
>>
>> Just spent about 3 hours t
Gnarlodious wrote:
> On Nov 3, 2:51 am, Peter Otten wrote:
>
>> Slightly generalized: have the importing module print its __name__. There
>> has to be at least one dot in the name for
>>
>> from .. import whatever
>>
>> to succeed.
>
> Just spent about 3 hours trying every permutation I could th
On Nov 3, 2:51 am, Peter Otten wrote:
> Slightly generalized: have the importing module print its __name__. There
> has to be at least one dot in the name for
>
> from .. import whatever
>
> to succeed.
Just spent about 3 hours trying every permutation I could think of,
and searching Google for e
MRAB wrote:
> On 03/11/2010 01:48, Gnarlodious wrote:
>> I admit I don't understand any of what was said here. Or why it is so
>> hard what I am trying to do. I searched Google for a few hours looking
>> for a way to import a module from an absolute path, but that was a
>> waste of time too.
>>
>>
On 03/11/2010 01:48, Gnarlodious wrote:
I admit I don't understand any of what was said here. Or why it is so
hard what I am trying to do. I searched Google for a few hours looking
for a way to import a module from an absolute path, but that was a
waste of time too.
To reiterate, I am trying to
I admit I don't understand any of what was said here. Or why it is so
hard what I am trying to do. I searched Google for a few hours looking
for a way to import a module from an absolute path, but that was a
waste of time too.
To reiterate, I am trying to import a Def function from a file one
leve
On 11/1/2010 6:54 AM, Gnarlodious wrote:
On Nov 1, 2:16 am, Steven D'Aprano wrote:
On Mon, 01 Nov 2010 01:08:52 -0700, Gnarlodious wrote:
On Oct 31, 11:09 am, Дамјан Георгиевски wrote:
from .. import Data.DumpHT as DumpHT
That doesn't work. Any more ideas?
Define "doesn't work".
LOL.
I
Gnarlodious wrote:
> On Nov 1, 5:36 am, Peter Otten wrote:
>
>> Remove the directory containing the importing file from your sys.path.
> I removed all sys.path customizations and rebooted.
>
> In the following scenario, I am programming in one.py attempting to
> import Data.py which is in the al
On Nov 1, 5:36 am, Peter Otten wrote:
> Remove the directory containing the importing file from your sys.path.
I removed all sys.path customizations and rebooted.
In the following scenario, I am programming in one.py attempting to
import Data.py which is in the alpha folder:
> $ tree
> .
> `-- al
Gnarlodious wrote:
> On Nov 1, 2:16 am, Steven D'Aprano t...@cybersource.com.au> wrote:
>> On Mon, 01 Nov 2010 01:08:52 -0700, Gnarlodious wrote:
>> > On Oct 31, 11:09 am, Дамјан Георгиевски wrote:
>> >> from .. import Data.DumpHT as DumpHT
>>
>> > That doesn't work. Any more ideas?
>>
>> Define
On Nov 1, 2:16 am, Steven D'Aprano wrote:
> On Mon, 01 Nov 2010 01:08:52 -0700, Gnarlodious wrote:
> > On Oct 31, 11:09 am, Дамјан Георгиевски wrote:
> >> from .. import Data.DumpHT as DumpHT
>
> > That doesn't work. Any more ideas?
>
> Define "doesn't work".
LOL.
I get error:
from .. import
On Mon, 01 Nov 2010 01:08:52 -0700, Gnarlodious wrote:
> On Oct 31, 11:09 am, Дамјан Георгиевски wrote:
>> from .. import Data.DumpHT as DumpHT
>
> That doesn't work. Any more ideas?
Define "doesn't work". Does it?
Print a warning message but continue execution?
Import the wrong module?
Abort
> I am loathe to duplicate programming in files that should just load a
> copy from a module. I tried all kinds of tricks to import a module
> from one level up. What's the secret?
>
> It works if I say:
>
> from Data import DumpHT
>
> but ONLY if the search path in sys.path. I want a relative
I am loathe to duplicate programming in files that should just load a
copy from a module. I tried all kinds of tricks to import a module
from one level up. What's the secret?
It works if I say:
from Data import DumpHT
but ONLY if the search path in sys.path. I want a relative path import
indepen
17 matches
Mail list logo