M
marco
Hello,
I having a problem creating directories with Python 2.3.4
(compiled with gcc 3.2.2, under Linux 2.4.20-31.9).
I'm writing a plugin which works in the following way:
GUI -- talks to --> Perl backend
Perl backend -- talks to --> Python plugin
Python plugin -- talks to --> Python script
I can see the exact command the Python plugin uses to
call the Python script (e.g. "foo.py -o file -w dir arg2")
When I run the command from the GUI I get the follwing
error:
Traceback (most recent call last):
File "/home/marco/bin/ogm_encoder.py", line 652, in ?
do_encode()
File "/home/marco/bin/ogm_encoder.py", line 333, in do_encode
mpegv = tempfile.mkstemp('.mpv', '', work_dir)[1]
File "/usr/lib/python2.3/tempfile.py", line 282, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/lib/python2.3/tempfile.py", line 216, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/tmp/991319584/metd/3vYjxJ.mpv'
However, if I run the Python script using the exact same
parameters which it gets from the GUI and in the same
directory everything works fine, temp files and dirs
are created OK.
I first create the dir as follows:
work_dir = opts.get('-w', img_dir)
work_dir = os.path.abspath(work_dir)
if not os.path.isdir(work_dir):
if not quiet: print 'Creating ' + work_dir
try:
os.makedirs(work_dir)
except:
print 'Could not create the work directory ' + \
work_dir
raise SystemExit
This works fine. To make sure, I even added a check right
before making the tempfile:
print os.path.isdir('/tmp/991319584/metd/')
mpegv = tempfile.mkstemp('.mpv', '', work_dir)[1]
The "os.path.isdir" says "True". Here's the kicker:
after the tempfile.mkstemp error, the "metd" directory
disappears! It's deleted!
So, running the Python script on its own creates the
temp file OK, no problem, but when I call is from the
I having a problem creating directories with Python 2.3.4
(compiled with gcc 3.2.2, under Linux 2.4.20-31.9).
I'm writing a plugin which works in the following way:
GUI -- talks to --> Perl backend
Perl backend -- talks to --> Python plugin
Python plugin -- talks to --> Python script
I can see the exact command the Python plugin uses to
call the Python script (e.g. "foo.py -o file -w dir arg2")
When I run the command from the GUI I get the follwing
error:
Traceback (most recent call last):
File "/home/marco/bin/ogm_encoder.py", line 652, in ?
do_encode()
File "/home/marco/bin/ogm_encoder.py", line 333, in do_encode
mpegv = tempfile.mkstemp('.mpv', '', work_dir)[1]
File "/usr/lib/python2.3/tempfile.py", line 282, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/lib/python2.3/tempfile.py", line 216, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '/tmp/991319584/metd/3vYjxJ.mpv'
However, if I run the Python script using the exact same
parameters which it gets from the GUI and in the same
directory everything works fine, temp files and dirs
are created OK.
I first create the dir as follows:
work_dir = opts.get('-w', img_dir)
work_dir = os.path.abspath(work_dir)
if not os.path.isdir(work_dir):
if not quiet: print 'Creating ' + work_dir
try:
os.makedirs(work_dir)
except:
print 'Could not create the work directory ' + \
work_dir
raise SystemExit
This works fine. To make sure, I even added a check right
before making the tempfile:
print os.path.isdir('/tmp/991319584/metd/')
mpegv = tempfile.mkstemp('.mpv', '', work_dir)[1]
The "os.path.isdir" says "True". Here's the kicker:
after the tempfile.mkstemp error, the "metd" directory
disappears! It's deleted!
So, running the Python script on its own creates the
temp file OK, no problem, but when I call is from the