LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-18-2006, 11:59 AM   #1
Millenniumman
Member
 
Registered: Apr 2006
Posts: 81

Rep: Reputation: 15
Python Script Issue*


I am writing a script in Python. It is supposed to go in a bunch of folders in a folder. In each folder is a picture and an XML file. It will then copy the picture file to a new folder, and rename it according to some information in the XML file. Here is what I have so far:

print "Beginning"
top = "~/Comics/Dilbert"
for dirs in os.walk(top, topdown=False):
print "Starting walk"
for files in dirs:
print "Getting files"
currentXML = open(glob.glob('*.plist'),"r")
print "Got XML"
currentPicture = open(glob.glob('*.gif'), "r")
copyfile(currentPicture, "~/Comics2")
print "copied Picture"

It should be copying the image (the XML parsing isn't there yet), but all it does is print "Beginning". What have I done incorrectly? If it is relevant, and I did not think it was for something this simple, I am using Mac OS X 10.4.6.

Edit: Posting this did not keep my indentation, but I believe it is correct.

Last edited by Millenniumman; 06-18-2006 at 12:01 PM.
 
Old 06-18-2006, 09:21 PM   #2
Dan04
Member
 
Registered: Jun 2006
Location: Texas
Distribution: Ubuntu
Posts: 207

Rep: Reputation: 37
glob.glob looks in the current directory by default, and you aren't chdiring to the folders.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python cgi script and premature end of script headers Neruocomp Programming 1 07-28-2005 11:43 AM
how do I do this in Python? (simple sh script) johnMG Programming 6 12-22-2004 10:05 PM
can anyone help me pl with this eror i a python script safrout Programming 0 08-03-2004 02:38 AM
Python issue coolman0stress Programming 7 05-11-2004 01:35 PM
python script LinuxLala Programming 14 04-07-2004 06:19 AM


All times are GMT -5. The time now is 10:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration