Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError: GzipFile.read() takes from 1 to 2 positional arguments but 3 were given #41

Open
Allison1991 opened this issue Jul 20, 2023 · 1 comment · May be fixed by #42
Open

TypeError: GzipFile.read() takes from 1 to 2 positional arguments but 3 were given #41

Allison1991 opened this issue Jul 20, 2023 · 1 comment · May be fixed by #42

Comments

@Allison1991
Copy link

Allison1991 commented Jul 20, 2023

Hi, Team

Thank you for developing this well-done tool for parsing stdf.

It's really a great experience to use it to solve my problem.

However, there are some issues, some of ATE platforms(machines) produce the result which cannot be parsed by this tool.

The error message shows here, please help us to find way out, thank you.

message1

Traceback (most recent call last):
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\Test.py", line 76, in
process_file(sys.argv[1:])
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\Test.py", line 65, in process_file
p.parse()
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 183, in parse
self.parse_records(count)
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 162, in parse_records
fields = recParser(self, header, [])
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 36, in newRecordParser
fields.append(action(*args))
^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 195, in
return lambda self, header, fields: parseFn(header, fieldType)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 231, in
"Vn": lambda header, fmt: self.readVn(header)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 115, in readVn
vn.append(self.vnMapfldtype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 239, in
0: lambda header: self.inp.read(header, 1),
^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GzipFile.read() takes from 1 to 2 positional arguments but 3 were given

massage 2

raceback (most recent call last):
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\test.py", line 77, in
process_file(sys.argv[1:])
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\test.py", line 70, in process_file
p.parse()
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 183, in parse
self.parse_records(count)
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 162, in parse_records
fields = recParser(self, header, [])
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 34, in newRecordParser
fields = fn(*args)
^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 34, in newRecordParser
fields = fn(*args)
^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 34, in newRecordParser
fields = fn(*args)
^^^^^^^^^
[Previous line repeated 3 more times]
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 36, in newRecordParser
fields.append(action(*args))
^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 195, in
return lambda self, header, fields: parseFn(header, fieldType)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 228, in
"Cn": lambda header, fmt: self.readCn(header),
^^^^^^^^^^^^^^^^^^^
File "C:\Users\A701763\Desktop\Pystdf1\pystdf-master\pystdf\IO.py", line 90, in readCn
return val.decode("ascii")
^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

@cmars
Copy link
Owner

cmars commented Jul 22, 2023

The first error looks like a bug that's easy enough to fix, I can propose a PR but it'd be great if you could try the branch out and confirm the fix. I no longer work in the semicon industry and don't have access to a test floor with ATEs anymore :)

The second is a string codec problem. Do you know what encoding is being used here? Is it UTF-8 or something else? Today it's pretty much a given that everything uses UTF-8 but STDF is an older format from a time when encodings were more localized. Would it be useful to make the codec a reader parameter?

cmars added a commit that referenced this issue Jul 22, 2023
@cmars cmars linked a pull request Jul 22, 2023 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants