2014-02-19 61 views
0

我有一个运行raspbmc的rPi,我创建了启动时运行的autoexec.py。里面autoexec.py,我把下面的代码:Python复制命令(shutil?)

import os 
import shutil 

shutil.copyfile(/mnt/usb/scripts/guisettings.xml, /home/pi/.xbmc/userdata/guisettings.xml) 

不过,我每次我试图运行此脚本时得到一个错误。我检查了日志文件,它只能说明如下:

-->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<-- 

我在做什么错在这里?过去一小时我一直在尝试这个。

+0

一件事我能想到的是,你需要加上引号的源和目标 – karthikr

回答

1

需要引用文字字符串在Python:

shutil.copyfile('/mnt/usb/scripts/guisettings.xml', 
       '/home/pi/.xbmc/userdata/guisettings.xml')