Add to python path mac os xを読んで、それを行うのは良い考えだと思いましたが、それでも IDLE は の単純な呼び出しの構文エラーを返すopen(filename, mode)
ので、もう少し調べたところ、できることがわかりましたhttp://developer.apple.com/library/mac/#qa/qa1067/_index.htmlに記載されているように、.MacOSXフォルダーにenvironment.plistを設定したので、ホームディレクトリでそれを行いましたが、まだ変更はありません...私は今迷っています:-)
それは、.bash_profile に python-path として追加し、environment.plist に同じパスを追加したものです (:$PYTHONPATH なし):
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