我要运行下面的文件,但我遇到了一个错误。我不知道怎么解决这个问题。请引导我。谢谢对所有人。在
我有个错误:
Traceback(most recent call last) :
File "scripts/generate_simulated_pair.py", line 55, in <module>
pair, d.strftime("%Y%m%d")
File "home/farshad/venv/qsforex/lib/python2.7/posixpath.py", line 77, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
错误引用的部分文件:
^{pr2}$我的设置.py公司名称:
from decimal import Decimal
import os
ENVIRONMENTS = {
"streaming": {
"real": "stream-fxtrade.oanda.com",
"practice": "stream-fxpractice.oanda.com",
"sandbox": "stream-sandbox.oanda.com"
},
"api": {
"real": "api-fxtrade.oanda.com",
"practice": "api-fxpractice.oanda.com",
"sandbox": "api-sandbox.oanda.com"
}
}
CSV_DATA_DIR = os.environ.get('desktop/trading python files/trading system/qsforex-backtesting-data', None)
OUTPUT_RESULTS_DIR = os.environ.get('desktop/trading python files/trading system/qsforex-backtesting-results', None)
DOMAIN = "practice"
STREAM_DOMAIN = ENVIRONMENTS["streaming"][DOMAIN]
API_DOMAIN = ENVIRONMENTS["api"][DOMAIN]
ACCESS_TOKEN = os.environ.get('OANDA_API_ACCESS_TOKEN', None)
ACCOUNT_ID = os.environ.get('OANDA_API_ACCOUNT_ID', None)
BASE_CURRENCY = "USD"
EQUITY = Decimal("1000.00")
引发异常是因为
settings.CSV_DATA_DIR
,os.path.join()
的第一个参数被设置为None
。在它被设置为
None
,因为环境变量desktop/trading python files/trading system/qsforex-backtesting-data
不存在:os.environ
对象是一个映射,如果第一个参数(键)不存在,.get()
方法返回第二个参数(None
)。在相关问题 更多 >
编程相关推荐