On Sat, Aug 20, 2011 at 10:52 AM, Kevin Zhang wrote:
> Found a few solution in python docs.
> A. sys.path.append
> I think A is not so pretty, and I don't have root privilege to use B and C.
> So any both more elegant and practical solutions?
If, as I understand from your directory tree, ttt.py
Hi,
This is the directory tree.
project
└── sme
├── src
│ ├── a.pth
│ ├── sss.py
└── test
└── ttt.py
I need to import sss.py in ttt.py.
Found a few solution in python docs.
A. sys.path.append
B. add ***.pth file
C. edit .../site-packages/site.py
I found out that a.pt
Sion Arrowsmith wrote:
> Peter Otten <[EMAIL PROTECTED]> wrote:
>>tow wrote:
>>> sys.path.append(os.path.join(project_directory, os.pardir))
>>> project_module = __import__(project_name, {}, {}, [''])
>>> sys.path.pop()
>>Ouch.
>
> I presume that "Ouch" is in consideration of what mi
On Aug 12, 4:59 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> tow wrote:
> > On Aug 12, 9:56 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> >> tow wrote:
>
> >> > Basically, I had thought that import and imp.find_module used exactly
> >> > the same
> >> > search path, but the above example shows that
Peter Otten <[EMAIL PROTECTED]> wrote:
>tow wrote:
>> sys.path.append(os.path.join(project_directory, os.pardir))
>> project_module = __import__(project_name, {}, {}, [''])
>> sys.path.pop()
>Ouch.
I presume that "Ouch" is in consideration of what might happen if
the subject of the __
tow wrote:
> On Aug 12, 9:56 am, Peter Otten <[EMAIL PROTECTED]> wrote:
>> tow wrote:
>
>> > Basically, I had thought that import and imp.find_module used exactly
>> > the same
>> > search path, but the above example shows that at least in this
>> > circumstance they
>> > don't; import is picking
On Aug 12, 9:56 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> tow wrote:
> > Basically, I had thought that import and imp.find_module used exactly
> > the same
> > search path, but the above example shows that at least in this
> > circumstance they
> > don't; import is picking up additional search
tow wrote:
>>> > I have a python script (part of a django application, if it makes any
>> > difference) which is exhibiting the following behaviour:
>>
>> > import my_module # succeeds
>> > imp.find_module("my_module") # fails, raising ImportError
>>
>> > which is completely baffling me. According
On Aug 12, 4:59 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 11 Aug 2008 19:19:19 -0300, tow <[EMAIL PROTECTED]>
> escribi :
>
> > I have a python script (part of a django application, if it makes any
> > difference) which is exhibiting the following behaviour:
>
> > import my_mod
En Mon, 11 Aug 2008 19:19:19 -0300, tow <[EMAIL PROTECTED]>
escribi�:
I have a python script (part of a django application, if it makes any
difference) which is exhibiting the following behaviour:
import my_module # succeeds
imp.find_module("my_module") # fails, raising ImportError
which is
I have a python script (part of a django application, if it makes any
difference) which is exhibiting the following behaviour:
import my_module # succeeds
imp.find_module("my_module") # fails, raising ImportError
which is completely baffling me. According to sys.path, both should
fail; the direct
SMALLp wrote:
> remember worked file when i wrote eg. import myFile but now in
> Ubuntu it says Module not found. (I'm using Ubuntu and I've
> installed python 2.5 and wxPython 2.8.4, and I'm using GedIt as my
> favorite text editor). The question is how to make this work
> (files are in the same
[EMAIL PROTECTED] wrote:
> On Dec 14, 3:44 pm, SMALLp <[EMAIL PROTECTED]> wrote:
>> Hy!
>> I'm new in Linux, and i feel little less newer in python.
>>
>> I need advice and help. I'm making an application witch purpose is
>> irrelevant. It has a lot of code for now and I've only made interface.
>>
On Dec 14, 3:44 pm, SMALLp <[EMAIL PROTECTED]> wrote:
> Hy!
> I'm new in Linux, and i feel little less newer in python.
>
> I need advice and help. I'm making an application witch purpose is
> irrelevant. It has a lot of code for now and I've only made interface.
> So I've tried to split code into
Hy!
I'm new in Linux, and i feel little less newer in python.
I need advice and help. I'm making an application witch purpose is
irrelevant. It has a lot of code for now and I've only made interface.
So I've tried to split code into separate files and in windows as I
remember worked file when i
> Accepted strategy? It doesn't seem very portable. It assumes that
> everyone puts their library
> modules in the exact same place. Or do they just figure that changing
> the sys.path.append
> line is easy enough?
Portability has nothing to do with it. If you arrange your project in a way
that th
Diez B. Roggisch wrote:
> >> Maybe Jython expert has the perfect answer but til then.
> >>
> >> Did you try:
> >>
> >> sys.path.append('path to search')
> >>
> >> Usually this works if nothing else does.
> >>
> >> -Larry
> >
> > Thanks. That's a good workaround, but I would like to know the
> > "
Russ wrote:
> On Feb 21, 4:15 pm, Larry Bates <[EMAIL PROTECTED]> wrote:
>> Russ wrote:
>> > I have a Python program that I want to run in Jython so I can get Java
>> > bytecode output. The program runs fine in Python, but when I change
>> > the first line of the main program to make it run in Jyt
On Feb 21, 4:15 pm, Larry Bates <[EMAIL PROTECTED]> wrote:
> Russ wrote:
> > I have a Python program that I want to run in Jython so I can get Java
> > bytecode output. The program runs fine in Python, but when I change
> > the first line of the main program to make it run in Jython, it fails
> > t
Russ wrote:
> I have a Python program that I want to run in Jython so I can get Java
> bytecode output. The program runs fine in Python, but when I change
> the first line of the main program to make it run in Jython, it fails
> to find some of the imported modules. These are just plain Python
> im
I have a Python program that I want to run in Jython so I can get Java
bytecode output. The program runs fine in Python, but when I change
the first line of the main program to make it run in Jython, it fails
to find some of the imported modules. These are just plain Python
imports of code I wrote
Mike Meyer wrote:
> "SHELTRAW, DANIEL" <[EMAIL PROTECTED]> writes:
>>If a Python program has an import statement like:
>>import FFT
>>
>>how do I determine the path to the imported file?
>
> guru% python
> Python 2.4.1 (#2, Apr 25 2005, 21:42:44)
> [GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
> Typ
Mike Meyer wrote:
> "SHELTRAW, DANIEL" <[EMAIL PROTECTED]> writes:
>>If a Python program has an import statement like:
>>
>>import FFT
>>
>>how do I determine the path to the imported file?
>
>
> guru% python
> Python 2.4.1 (#2, Apr 25 2005, 21:42:44)
> [GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
"SHELTRAW, DANIEL" <[EMAIL PROTECTED]> writes:
> Hello Python list
>
> If a Python program has an import statement like:
>
> import FFT
>
> how do I determine the path to the imported file?
guru% python
Python 2.4.1 (#2, Apr 25 2005, 21:42:44)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "hel
Hello Python list
If a Python program has an import statement like:
import FFT
how do I determine the path to the imported file?
Thanks,
Daniel
--
http://mail.python.org/mailman/listinfo/python-list
25 matches
Mail list logo