miguelmoreto / pycomtrade

pyComtrade is a python module that provides you a transparent way for reading and writing oscillographic files in Comtrade format
http://pypi.python.org/pypi/pyComtrade
GNU General Public License v3.0
31 stars 30 forks source link

Problems with *.cfg with frequency and sample rate as floats #6

Closed ldemattos closed 7 years ago

ldemattos commented 7 years ago

The .cfg file that I'm attempting to read has the frequency and sample rate data as:

60.000000000 1 15360.000000000,42240

Then, when I try to read it, I get:

pyComtrade instance created! Traceback (most recent call last): File "example1_l.py", line 44, in comtradeObj = pyComtrade.ComtradeRecord(dataFile) File "/home/leonardo/projects/pycomtrade/src/pyComtrade.py", line 105, in init self.ReadCFG() File "/home/leonardo/projects/pycomtrade/src/pyComtrade.py", line 210, in ReadCFG self.lf = int(self.filehandler.readline()) ValueError: invalid literal for int() with base 10: '60.000000000\r\n'

I already have a proposition that I will submit as pull request.

miguelmoreto commented 7 years ago

Is this .cfg compliant with the standard? I had to check the newer comtrade standard but I think that this is a problem with the device that generates your .cfg. This field should be an integer. I don't know if we should deal with non standard cfg file (unless this is supported in the last version of standard).

Best regards!

ldemattos commented 7 years ago

Hey, @miguelmoreto!

I don't know if this cfg file is compliant and I don't have further informations about the recorder device. Sorry.

Anyhow, I do agree with you that we should stick to IEEE standard, however the proposed solution is so simple and don't harm the reading of a cfg file have the frequency field/sample rate as integers that I don't see it as a problem.

Best regards,

miguelmoreto commented 7 years ago

I accepted your PR. Thanks! best regards!

ldemattos commented 7 years ago

Glad to help! Best regards.