나는 Add to python path mac os x을 통해 읽었습니다. 그 일을하는 것이 좋습니다.하지만 여전히 IDLE은 open(filename, mode)
이라는 간단한 호출에 대해 구문 오류가 발생하므로 조금 더 보았습니다. http://developer.apple.com/library/mac/#qa/qa1067/_index.html에 명시된대로해야하고 .MacOSX 폴더에 environment.plist를 설정해야합니다. 그래서 저는 집에 있었지만 여전히 변경이 없었습니다 ... 지금은 잃어버린 것 같습니다 :-)Mac OSX의 Pythonpath
그게 내가 추가 한 것 내 .bash_profile에 파이썬 경로와 (포함하지 않는 : $의 PYTHONPATH) : 내 environment.plist에서 동일한 경로
PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7:$PYTHONPATH"
export PYTHONPATH
편집 :나는 구문 오류를 얻을그게 전부는 ...
import xml.etree.ElementTree as et
import json
app = Bottle()
@app.route('/proPass', method ='POST')
#here happens here, need it further down in the code... which is not really relevant
f = open('/Users/mohi/Desktop/proPass_project/server_service/systems.xml', 'rw')
def getData():
timestamp = request.POST.get('timestamp', '').strip()
data = request.POST.get('data', '').strip()
if timestamp:
processData(data, timestamp)
run()
오류 인터프리터에서 잘 작동합니다
File "proPass_script.py", line 9
f = open('/Users/mohi/Desktop/proPass_project/server_service/systems.xml', 'rw')
^
SyntaxError: invalid syntax
정확한 추적 및 오류를 '
'사이에 넣으십시오. 그러면 문제의 원인을 정확히 알 수 있습니다. 또한 몇 줄의 컨텍스트를 추가하십시오. 오류는 오류를 감지하는 __before__ 행 중 하나에있는 경우가 많습니다. – agf