Encoding issue
Hi, I'm not a programmer and I'm new to github, but I found this repo and I think it can help me as I'm working with some old paradox DB's. I'm getting an error regarding encoding. Can I somehow pass the encoing as a parameter? I happen to know the encoding I need is 'iso-8859-1'.
The error: UnicodeEncodeError: 'ascii' codec can't encode character '\xe6' in position 64: ordinal not in range(128)
Hi and welcome to programming and GitHub. The answer to your question is yes:
table = Table('data.db', encoding='iso-8859-1')
Thank you!
However I'm still getting the same error:
line 44, in __init__
if PX_open_file(self.pxdoc, file_path.encode(self.PX_ENCODING)) != 0:
UnicodeEncodeError: 'ascii' codec can't encode character '\xe6' in position 64: ordinal not in range(128)
The code looks like this:
import os.path
from pypxlib import Table
import pandas as pd
mappe = os.path.dirname(os.path.realpath(__file__))+'/TN25/'
table = Table(mappe+'HIGHLOW.DB', encoding='iso-8859-1')
I thought I might be a path error, but I don't think so.
Sorry, I don't have time to help with this further. I'd suggest you ask your question on StackOverflow.
For those who are interested I resolved the issue by editing the __init__.py file changing the hardcoded encoding 'ascii' in PX_ENCODING to the correct encoding of the .DB file.
class Table(object):
PX_ENCODING = 'ascii'