我有一个100行,3岁的
python刮板,现在的bug.起始行是:
import urllib, re, os, sys, time # line 1: import modules
os.chdir(os.path.dirname(sys.argv[0])) # line 2: all works in script's folder > relative address
# (rest of my script here!)
运行时,
$cd /my/folder/
$python script.py
我收到错误:
python script.py
Traceback (most recent call last):
File "script.py", line 2, in
os.chdir(os.path.dirname(sys.argv[0]))
OSError: [Errno 2] No such file or directory: ''
我应该怎么读这个错误,该怎么办?