blonc
blonc

Reputation: 313

Python str error

I am using the following script : python script

# Import IQFeed Historical Data to InfluxDB
# 
# optional arguments:
#   -h, --help            show this help message and exit
#   --ticker TICKER       Ticker to request data for. (default: SPY)
#   --ticker-list TICKER_LIST
#                         Path to folder to create files. (default: None)
#   --dbhost DBHOST       InfluxDB hostname. (default: None)
#   --dbport DBPORT       InfluxDB port number. (default: None)
#   --iqhost IQHOST       IQfeed Connect hostname. (default: None)
#   --iqport IQPORT       IQfeed Connect port number. (default: None)
#   --username USERNAME   InfluxDB username. (default: None)
#   --password PASSWORD   InfluxDB password. (default: None)
#   --database DATABASE   InfluxDB database to use. (default: None)
#   --fromdate FROMDATE   Starting date for historical download with format:
#                         YYYY[-MM-DDTHH:MM:SS]. (default: None)
#   --todate TODATE       Ending date for historical download with format: YYYY
#                         [-MM-DDTHH:MM:SS]. (default: None)
#   --debug               Turn on debug logging level. (default: False)
#   --info                Turn on info logging level. (default: False)

I am running it with the following input:

python influx.py --ticker SPY --dbhost 127.0.0.1 --dbport 8088 --iqhost 127.0.0.1 --iqport 9100 --database SPY --fromdate 2017 --todate 2018

and get a str error. even if i change the dates to "20180101" still get the error on line 59. i can not seem to be able to debug it some quick reference.

the error points to the the : when declaring cmd: str

def _send_cmd(self, cmd: str):

if i remove that declaration then it just gives me another error on line 64 with the same issue saying thhe : is wrong in declaring as a str

def iq_query(self, message: str):

The error I got was:

File "influx.py", line 59
  def _send_cmd(self, cmd: str):
                         ^ SyntaxError: invalid syntax

Upvotes: 0

Views: 279

Answers (1)

kichik
kichik

Reputation: 34714

That script requires Python 3.5 and above, but you are using Python 3.4. See typing for more information.

You can upgrade to the latest version of Python or simply remove : str and : np.array from the code.

Upvotes: 1

Related Questions