LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 04-30-2014, 08:29 PM   #1
CaiFei
LQ Newbie
 
Registered: Apr 2014
Posts: 1

Rep: Reputation: Disabled
Help Me!! I faced with a problem about python


First:
import os
import time
source =['/home/caifei/视频/听风者1.rmvb','/home/caifei/视频/听风者2.rmvb']
target_dir='/home/caifei/important_backup/'
target=target_dir + time.strftime('%Y%m')+'.zip'
zip_command="zip -qr '%s' %s" % (target, ' '.join(source))
if os.system(zip_command)==0:
print 'Successful backup to', target
else:
print 'Backup Failed'

Second:
zip I/O error: Permission denied
zip error: Could not create output file (/home/caifei/important_backup/201405.zip)
Backup Failed



The First is my procedure. When I run it, I will face with the problem, shown in the Second, which I can not resolve. Please tell me how to resolve this problem completely and what I must do for my procedure. Thank you.

Last edited by CaiFei; 04-30-2014 at 08:35 PM.
 
Old 05-01-2014, 04:40 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
looks interesting, but so much is missing from this thread...

please read the link in my signature.
 
Old 05-01-2014, 05:00 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
please use [code]here comes your script[/code] to keep formatting (which is specifically for python is very important).

probably the target directory does not exist.
to improve your code please try subprocess.popen instead of os.system. see for example here: http://www.cyberciti.biz/faq/python-...mand-examples/ and print the error message.
 
Old 03-07-2015, 02:43 PM   #4
GillysWindows
LQ Newbie
 
Registered: Mar 2015
Location: Leicester UK
Distribution: Linux Mint
Posts: 2

Rep: Reputation: Disabled
This is the exact same problem i am having

Hi this is the exact same problem i am having i so hope you managed to sort it out and somehow get to see this message so you can help me sort this out
 
Old 03-08-2015, 12:16 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,874
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
As a atart, run it with 'strace -f python yourscript.py 2>strace.log' and look for errors in strace.log
 
Old 03-09-2015, 09:29 AM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,245

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
I don't know what information everyone thinks is missing. The problem is obviously that the script is being run under an account that doesn't have permission to create (or write to) that zip file in /home/cafei.

You could have easily debugged this by executing the zip command by hand.

Last edited by dugan; 03-11-2015 at 02:13 PM.
 
Old 03-11-2015, 05:48 PM   #7
GillysWindows
LQ Newbie
 
Registered: Mar 2015
Location: Leicester UK
Distribution: Linux Mint
Posts: 2

Rep: Reputation: Disabled
Thanks for the reply's and i did think it was as dugan had said about not having the relevant permissions to execute the script, which is what it was but rather than running the zip command by hand as this would have ment doing that each time i presume, i managed somehow to alter the directory permissions and now it's working fine sorry i'm extremely new to all this so if i sound like i dont have a clue thats because i dont , currently happy fumbling around trying to learn, so if anyone can point me in the direction of the best places for Tutorials for Linux itself and also Python, Flask and also Glade i would appreciate it.

Many Thanks -- GillysWindows(Wayne).
 
Old 03-11-2015, 06:09 PM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,245

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
The best resource for Flask is honestly the Flask homepage.

As for beginner's Python material, it's an embarrassment of riches. These are pretty common recommendations:

https://developers.google.com/edu/python/?csw=1
http://www.greenteapress.com/thinkpython/
http://www.swaroopch.com/notes/python/

I think the last one might be for Python 3.
 
  


Reply



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
Problem faced while using find_first_not_of bhavyakm Programming 2 11-22-2009 10:10 PM
Problem faced during 'make install'.. Help me! Awg Semile Apong Linux - Software 2 03-05-2009 03:28 AM
weird problems faced while incorporating ruby and python! wrapster Programming 2 10-05-2008 06:40 AM
Problem I faced in using rsyslog prakash.akumalla Linux - Software 0 06-26-2008 03:13 AM
problem faced regarding gcc amolbhor Programming 2 01-20-2007 03:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration