【发布时间】:2016-03-10 13:16:29
【问题描述】:
我将运行以下文件,但出现错误。我不知道如何解决这个问题。请指导我。谢谢大家。
我收到了这个错误:
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'
错误所指的部分文件:
# Loop over every day in the month and create a CSV file
# for each day, e.g. "GBPUSD_20150101.csv"
for d in days:
print(d.day)
current_time = current_time.replace(day=d.day)
outfile = open(
os.path.join(
settings.CSV_DATA_DIR,
"%s_%s.csv" % (
pair, d.strftime("%Y%m%d")
)
),
"w")
outfile.write("Time,Ask,Bid,AskVolume,BidVolume\n")>
我的设置.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是None。
标签: python attributeerror