evereux / pycatia

python module for CATIA V5 automation
MIT License
204 stars 53 forks source link

[BUG] CATPart, CATProduct documents.read issue #216

Closed gggstamm closed 5 months ago

gggstamm commented 6 months ago

Describe the bug I'm facing this issue: File "...\pycatia\in_interfaces\documents.py", line 309, in read return document_typesdoc_suffix


KeyError: 'CATPart'

**To Reproduce**
Really simple script
    catia_com = catia()
    documents = catia_com.documents
    documents.read(str(c:\hello.CATPart))

It is working if I'm using 
documents.new_from
but it does no have exactly the same behavior.

I think that the issue here:
https://github.com/evereux/pycatia/blob/9f48c90e11539d3e6ae387ca3244a10e18ef8160/pycatia/in_interfaces/documents.py#L309
is that CATPart key is not present here
https://github.com/evereux/pycatia/blob/9f48c90e11539d3e6ae387ca3244a10e18ef8160/pycatia/types/document.py#L57
the key present is 'Part'

**Expected behavior**
no error !!

**Desktop (please complete the following information):**
 - OS: Windows 10
 - CATIA V5 version V5-R27
 - pycatia version : 0.7.0
evereux commented 6 months ago

Yeah on the face of it this looks like a bug introduced when I re-wrote how document_types are handled recently. D'oh.

I'll get this fixed, probably at the weekend, and roll out a new version.

Thanks for reporting.

gggstamm commented 6 months ago

Yeah on the face of it this looks like a bug introduced when I re-wrote how document_types are handled recently. D'oh.

I'll get this fixed, probably at the weekend, and roll out a new version.

Thanks for reporting.

thanks for your very quick answer... and thanks in advanced for having a look strange that nobody noticed the problem before in the mean time, I went back to v0.6.8 ... that is working fine for me

evereux commented 6 months ago

I suspect it's a combination of not many people using the read method and the bug only being introduced a couple of weeks ago in 0.6.9 (not many updating?).

evereux commented 5 months ago

0.7.1 has now been released and should fix this issue.

Please note that the Documents.read() and Documents.open() now expect a pathlib.Path object. Strings should still work though.

evereux commented 5 months ago

0.7.2 has now been released. This will actually now accept strings too.

gggstamm commented 5 months ago

Upgraded to 0.7.2... it is working fine. many thanks