I have a rPi running raspbmc and I created autoexec.py which runs on startup. Inside autoexec.py, I put the following code:
import os
import shutil
shutil.copyfile(/mnt/usb/scripts/guisettings.xml, /home/pi/.xbmc/userdata/guisettings.xml)
However, I am getting an error every time I attempt to run this script. I have checked the log files and it only shows the following:
-->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.SyntaxError'>
Error Contents: ('invalid syntax', ('autoexec.py', 4, 17, 'shutil.copyfile(/mnt/usb/scripts/guisettings.xml, /home/pi$
SyntaxError: ('invalid syntax', ('autoexec.py', 4, 17, 'shutil.copyfile(/mnt/usb/scripts/guisettings.xml, /home/pi/.x$
-->End of Python script error report<--
What am I doing wrong here? I have been attempting this for the past hour.
isedev
19.7k3 gold badges65 silver badges60 bronze badges
-
one thing I can think of is you need to put the source and destination in quoteskarthikr– karthikr2014年02月19日 03:36:59 +00:00Commented Feb 19, 2014 at 3:36
1 Answer 1
You need to quote literal strings in Python:
shutil.copyfile('/mnt/usb/scripts/guisettings.xml',
'/home/pi/.xbmc/userdata/guisettings.xml')
answered Feb 19, 2014 at 3:38
isedev
19.7k3 gold badges65 silver badges60 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py