roskakori / cutplace

validate data stored in CSV, PRN, ODS or Excel files
http://cutplace.readthedocs.org/
GNU Lesser General Public License v3.0
18 stars 20 forks source link

No decimal separator for CID in excel format #119

Open magsoftware opened 6 years ago

magsoftware commented 6 years ago

I have data file in excel format. 2 columns: Text and Decimal.

CID file - as attached.

Result of validating CID and data file is:

$ python cval.py
Traceback (most recent call last):
  File "cval.py", line 11, in <module>
    cid = cutplace.Cid(cid_file)
  File "/Users/marek/.local/share/virtualenvs/import-H57toZwk/lib/python3.6/site-packages/cutplace/interface.py", line 77, in __init__
    self.read(cid_path, rowio.auto_rows(cid_path))
  File "/Users/marek/.local/share/virtualenvs/import-H57toZwk/lib/python3.6/site-packages/cutplace/interface.py", line 262, in read
    self.add_field_format_row(row_data)
  File "/Users/marek/.local/share/virtualenvs/import-H57toZwk/lib/python3.6/site-packages/cutplace/interface.py", line 385, in add_field_format_row
    field_name, field_is_allowed_to_be_empty, field_length, field_rule, self._data_format)
  File "/Users/marek/.local/share/virtualenvs/import-H57toZwk/lib/python3.6/site-packages/cutplace/fields.py", line 380, in __init__
    self.decimal_separator = data_format.decimal_separator
  File "/Users/marek/.local/share/virtualenvs/import-H57toZwk/lib/python3.6/site-packages/cutplace/data.py", line 260, in decimal_separator
    return self._decimal_separator
AttributeError: 'DataFormat' object has no attribute '_decimal_separator'

Converting data file to CSV and changing format in CID from excel to delimited plus defining "Decimal separator" like below:

D Decimal separator ,

is doing well. So I guess probably some issue with excel processing. Decimal separator can not be defined if format = excel, so I guess it should be read from excel data file (where it must be stored somewhere).

dec_data.xlsx dec_test.xlsx