0

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
asked Feb 19, 2014 at 3:33
1
  • one thing I can think of is you need to put the source and destination in quotes Commented Feb 19, 2014 at 3:36

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.