i have been encountering many errors when using Ibridgepy with Interactive brokers Demo account.
below errors is just one of such errors:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1035: character maps to <undefined>
Hello John,
Assuming, it's from some file you're writing yourself, this happens when you haven't specified the encoding of the file that you're trying to parse. Each encoding is like a different language. To be able to understand the encoding/language the file is encoded in, you might need to explicitly point out the name of the encoding. If its a file you're opening manually, it's done as below:
file = open(filename, encoding="utf8")
Where utf8, is a kind of encoding. Another common one is, Latin-1. There are similar options for other packages like pandas etc to specify an encoding.
Assuming its from some file within the ibridgepy codebase, you'll have to specify where exactly this error occurs.
Do get back for further assistance.
Hi John,
It seems like a default encoding in your system and the encoding for the configuration.txt file is different.
You can add the encoding as utf8 in run_me.py file while reading the file as shown below.
with open('configuration.txt', encoding="utf8") as f: script = f.read()
The details on the solution for the same error message can be found here.
If you continue to get this error, could you please send us the full stack trace for the error message. This will help us to debug faster.
We do understand that you have received many error messages. I hope the DLL load failed error is resolved. We do hope similarly this and any other error messages are resolved quickly and you can start your paper trading and/or live trading journey.
Thank you!
Ishan
I have the same problem too. When I delete the #
from fileName = 'example_get_historical_data.py'
The following error occur. Can anyone help? -
runfile('C:/Users/…/IBridgePy_Win_Anaconda37_64/RUN_ME.py', wdir='C:/Userss/…/IBridgePy_Win_Anaconda37_64')
Traceback (most recent call last):
File "C:\Users.…\IBridgePy_Win_Anaconda37_64\RUN_ME.py", line 56, in <module>
run_me(fileName, globals())
File "C:\Users.…\IBridgePy_Win_Anaconda37_64\configuration.py", line 30, in run_me
userConfig = _build_config(fileName, userManualInput, userConfig)
File "C:\Users.…\IBridgePy_Win_Anaconda37_64\configuration.py", line 84, in _build_config
script = f.read()
File "D:\anaconda\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1035: character maps to <undefined>
Could you please add encoding="utf8", highlighted below in line number 83 of configuration.py file. This file is located at C:\Users.…\IBridgePy_Win_Anaconda37_64\configuration.py
with open(os.path.join(os.getcwd(), 'Strategies', fileName), encoding="utf8") as f:
script = f.read()
Let us know if this works.
Thanks!