And again I'm gonna say BINGO!!!!!!!!! It's like you were doing the same app as I am
Thanks Alberto >From: Danny Yoo <[EMAIL PROTECTED]> >To: Alberto Troiano <[EMAIL PROTECTED]> >CC: [email protected] >Subject: Re: [Tutor] Linux variable to Python >Date: Fri, 13 May 2005 14:00:50 -0700 (PDT) > > > >On Fri, 13 May 2005, Alberto Troiano wrote: > > > 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 > > > > I need to do this from Python but I'm having problems with the Linux > > variable > >Hi Alberto, > >[Tangent: are you running things using the Unix 'root' account? If so, >you may want to consider using a regular user account unless you really >know what you're doing. Running things as root should never be taken >lightly.] > > >You may want to consider using the 'datetime' module for this one. There >are portability and security issues that you may not be considering >whenever you "shell" out. If you use Python's Standard Libraries, you can >avoid these issues. > > >I think you can avoid using 'date' by taking advantage >of datetime.datetime.strftime(): > >###### > >>> import datetime > >>> datetime.datetime.today().strftime("%Y%m%d%H%M%S") >'20050513135531' >###### > >This is portable on any system that supports the Python Standard Library. > > >The problems you are running into with os.system() are related to those >that other people have been asking about this week. It's sorta funny how >these questions come in streaks. *grin* > >For more information on driving external processes with Python, you may >want to look at the messages on "Pipe variable to external command" that >Jeffrey was asking about yesterday: > > http://mail.python.org/pipermail/tutor/2005-May/038341.html > http://mail.python.org/pipermail/tutor/2005-May/038343.html > > > >I hope this helps! > >_______________________________________________ >Tutor maillist - [email protected] >http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
