Hey

Another problem

Here is an example of what I want to do:

I run over Linux shell the following command:

[EMAIL PROTECTED] root]# fec=cam`date +%Y%m%d%H%M%S`.jpg
[EMAIL PROTECTED] root]# echo $fec
cam2005051255702.jpg
[EMAIL PROTECTED] root]# mv hola.txt grabacion/$fec

To explain for those who doesn't know:
The first line creates a variable named "fec" with the value cam(a Linux 
function returning year month day hour minute second).jpg
The second show the value of "fec"
The third moves hola.txt to the directory grabacion and puts the "fec" value 
as the new name for the file

I need to do this from Python but I'm having problems with the Linux 
variable
I don't get any errors when I execute the commands
Here is what I'm doing

import os
>>>os.system("fec=cam`date +%Y%m%d%H%M%S`.jpg")
0
>>>os.system("echo $fec")
0
>>>os.system("mv hola.txt grabacion/$fec")
0

Then I check for the file and turns out that it moved hola.txt to grabacion 
with the same name
I think that for some extrange way it is not accepting the linux variable

I'm using Python 2.2.2 over Red Hat 9.0

Thanks in advanced

Alberto


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to