P
per9000
Dear Black Knight,
I have no quarrel with you sir Knight, but I must import your parents.
SHORT VERSION:
I tried three variants of "from ../brave.py import sir_robin", one
works. I want to use it in a py-file to execute command-line-style and
that does not work.
Can someone please give me, not a bucket with the desert(s) on top, but
just the thin chocolate?
/per9000 (per nine thousand at gmail dot com)
LONG VERSION:
Since I do not want to use absoute paths I want to import a file from
two folders up and then one down.
This problem seems to be discussed in:
http://starship.python.net/pipermail/python-au/2005/000543.html
I tried following it but I did not understand and/or try hard enough
and/or my father smells of elderberrys.
So...
....first I tried this: "from ../brave.py import sir_robin" (and
variants)
But all I got was syntax or import error(s).
----------
Then I tried to fool python by walking the path up with os.chdir('..')
in the line-by-line interpreter.
This (surprisingly) worked just fine.
C:\my\holy\grail\that_old_bridge>python
----------
When I tried putting this into a program to execute command-line-style:
the interesting code:
import os
cwd = os.getcwd()
os.chdir('../../py_scripts')
print os.listdir('.')
from raw2nice_def.py import raw2nice
os.chdir(cwd)
output:
Traceback (most recent call last):
File "C:my\holy\grail\that_old_bridge\rawhtml2nicehtml_template.py",
line 10, in ?
from raw2nice_def.py import raw2nice
ImportError: No module named raw2nice_def.py
The worst part here is that os.listdir('.') returns ['raw2nice_def.py',
'raw2nice_def.pyc', 'temp'] - meaning (to me) that Python really should
"feel" my nice file but somehow still does not see it.
To me this also means that python::command_line does not concurr with
python::line_by_line(!?!)
Can someone please give me, not a bucket with the desert(s) on top, but
just the thin chocolate?
/per9000 (per nine thousand at gmail dot com)
I have no quarrel with you sir Knight, but I must import your parents.
SHORT VERSION:
I tried three variants of "from ../brave.py import sir_robin", one
works. I want to use it in a py-file to execute command-line-style and
that does not work.
Can someone please give me, not a bucket with the desert(s) on top, but
just the thin chocolate?
/per9000 (per nine thousand at gmail dot com)
LONG VERSION:
Since I do not want to use absoute paths I want to import a file from
two folders up and then one down.
This problem seems to be discussed in:
http://starship.python.net/pipermail/python-au/2005/000543.html
I tried following it but I did not understand and/or try hard enough
and/or my father smells of elderberrys.
So...
....first I tried this: "from ../brave.py import sir_robin" (and
variants)
But all I got was syntax or import error(s).
----------
Then I tried to fool python by walking the path up with os.chdir('..')
in the line-by-line interpreter.
This (surprisingly) worked just fine.
C:\my\holy\grail\that_old_bridge>python
<function raw2nice at 0x00A28230>import os
os.chdir('../../py_scripts')
os.getcwd() 'C:\\my\\holy\\py_scripts'
from raw2nice_def import raw2nice
os.listdir('.') ['raw2nice_def.py', 'raw2nice_def.pyc', 'temp']
raw2nice
----------
When I tried putting this into a program to execute command-line-style:
the interesting code:
import os
cwd = os.getcwd()
os.chdir('../../py_scripts')
print os.listdir('.')
from raw2nice_def.py import raw2nice
os.chdir(cwd)
output:
['raw2nice_def.py', 'raw2nice_def.pyc', 'temp']"C:\another_bridge\python\python.exe" rawhtml2nicehtml_template.py
Traceback (most recent call last):
File "C:my\holy\grail\that_old_bridge\rawhtml2nicehtml_template.py",
line 10, in ?
from raw2nice_def.py import raw2nice
ImportError: No module named raw2nice_def.py
The worst part here is that os.listdir('.') returns ['raw2nice_def.py',
'raw2nice_def.pyc', 'temp'] - meaning (to me) that Python really should
"feel" my nice file but somehow still does not see it.
To me this also means that python::command_line does not concurr with
python::line_by_line(!?!)
Can someone please give me, not a bucket with the desert(s) on top, but
just the thin chocolate?
/per9000 (per nine thousand at gmail dot com)