我已经编写了一个python 代码来将我的android 物理设备与笔记本(ubuntu 14.04)一起安装。
我提到了这个 http://www.anythingbutipod.com/forum/showthread.php?t=32817
$ sudo apt-get install libmtp mtptools mtpfs
#Once all of that is installed, you will need to create a mountpoint for your device.
$ sudo mkdir /media/MyZen
$ sudo chmod 775 /media/MyZen
#Next, plug in your player and mount it:
$ sudo mtpfs -o allow_other /media/MyZen
#Your player should appear on your desktop as a regular drive. Be aware that, depending on the device, access might be slow.
#IMPORTANT: DO NOT DISCONNECT YOUR DEVICE WITHOUT UNMOUNTING IT FIRST!
$ sudo umount /media/MyZen
这是我写的代码:specificfolder.py
import os
import pymtp
os.getcwd()
print ('AT FOLDER :')
print os.getcwd()
os.chdir("/media/")
os.getcwd()
print ('AT FOLDER :')
print os.getcwd()
print ('')
#killall gvfs-gphoto2-volume-monitor
#killall gvfs-mtp-volume-monitor
if not os.path.exists("/media/karthik"):
os.makedirs("/media/karthik")
os.chmod('karthik', 0755)
oMTP = pymtp.MTP()
oMTP.connect()
os.listdir("/media/karthik/Int*/Maverick")
os.listdir("/media/karthik/Int*/Maverick | wc -l")
当我运行文件specificfolder.py时,我收到此错误
karthik@dkarnik2-Vostro-3558:~/appiumworkspace/appium-1.4.13/submodules/sample-code/examples/python$ python specificfolder.py
AT FOLDER :
/home/karthik/appiumworkspace/appium-1.4.13/submodules/sample-code/examples/python
AT FOLDER :
/media
Traceback (most recent call last):
File "specificfolder.py", line 20, in <module>
os.chmod('/media/karthik', 0755)
OSError: [Errno 1] Operation not permitted: '/media/karthik'
karthik@dkarnik2-Vostro-3558:~/appiumworkspace/appium-1.4.13/submodules/sample-code/examples/python$
我该如何解决?