I can't read a specific DXF file with EZDXF cause of "ValueError: Invalid handle 0."

251 views
Skip to first unread message

doo...@gmail.com

unread,
Dec 17, 2020, 11:15:43 PM12/17/20
to python-ezdxf
Hi,Im doomori.
I have a touble with ezdxf.readfile.

  • python 3.6
  • ezdxf 0.13
python code:
  import ezdxf
  doc = ezdxf.readfile('./test.dxf')

i have error code:
ValueError: Invalid handle 0.

other cad app can import test.dxf like below drawing.

test.png
it is very simple drawing.

it is full error message::

File "C:\Users\xxxxxxx\Documents\python\test\test1.py", line 2, in <module>
    doc = ezdxf.readfile('./test.dxf')
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\filemanagement.py", line 136, in readfile
    doc = read(fp, legacy_mode=legacy_mode, filter_stack=filter_stack)
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\filemanagement.py", line 85, in read
    return Drawing.read(stream, legacy_mode=legacy_mode, filter_stack=filter_stack)
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\drawing.py", line 234, in read
    return cls.load(tag_loader, legacy_mode=legacy_mode, filter_stack=filter_stack)
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\drawing.py", line 279, in load
    doc._load(tag_loader)
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\drawing.py", line 326, in _load
    fill_database(sections, self.dxffactory)
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\lldxf\loader.py", line 135, in fill_database
    for index, entity in enumerate(load_dxf_entities(section, factory)):
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\lldxf\loader.py", line 126, in load_dxf_entities
    yield factory.load(entity)
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\entities\factory.py", line 69, in load
    self.doc.entitydb.add(entity)
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\entitydb.py", line 101, in add
    self[handle] = entity
  File "C:\Users\xxxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\ezdxf\entitydb.py", line 44, in __setitem__
    raise ValueError(f'Invalid handle {handle}.')
ValueError: Invalid handle 0.

please help me ,,,,.

thank you

test.dxf

Manfred Moitzi

unread,
Dec 18, 2020, 1:54:22 AM12/18/20
to python-ezdxf


---------- Forwarded message ---------
Von: Manfred Moitzi <manfred...@gmail.com>
Date: Fr., 18. Dez. 2020 um 07:53 Uhr
Subject: Re: [python-ezdxf] I can't read a specific DXF file with EZDXF cause of "ValueError: Invalid handle 0."
To: doo...@gmail.com <doo...@gmail.com>


Hi!

This is a very old DXF R10 file (AC1006), I will try to add support for this old DXF version - thx for the test file.

Best regards,
Manfred

PS: Look at the new GitHub discussions forum. I like it more than the google-groups forum.

--
You received this message because you are subscribed to the Google Groups "python-ezdxf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-ezdxf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-ezdxf/4c8d521a-34a9-4ac2-9bad-b99f19c0fe66n%40googlegroups.com.

doo...@gmail.com

unread,
Dec 18, 2020, 5:01:03 AM12/18/20
to python-ezdxf
Thank you for your reply. I’ll leave the rest up to you.
Thank you for your cooperation.  

2020年12月18日金曜日 15:54:22 UTC+9 manfred...@gmail.com:
Reply all
Reply to author
Forward
0 new messages