Closed yupinov closed 5 years ago
I don't think that's relevant at all, even though I'm not really aware of prefixes. What I've seen inside stl.py is that get() strips the line, so from 'solid ' it becomes 'solid'. Then its beginning is compared with 'solid ' and the warning is printed. Obviously it would not happen with any non-empty name.
You are absolutely right, this has long since been taken care of by @WoLpH by enforcing everything to bytes literals anyway. My bad.
Do you have a reproducible example we can work with and some information on your python and numpy-stl versions?
Alright, disregard that. I have some other issue with the way I write my STL files, it seems. This warning gets printed with literally any STL ASCII file with an empty name (and shouldn't be), but the minimal ASCII file actually gets loaded, so it's not critical. Numpy-stl is 2.7.0 from pip, using python 3.5.2.
python3 -c "from stl import mesh; m = mesh.Mesh.from_file('min.stl.txt'); print('Points count ' + str(len(m.points)))"
Clear.
It is a warning message, yet no Exception is raised if the mesh is in proper order.
(tried adding some other polygons, no issue with loading, although it complains about the header).
Maybe we can think about adding support for empty headers. Technically an ASCII STL can be valid with empty header, although the trailing whitespace after solid
is still mandatory.
Issue is with line 156 in stl.py
. Stripping whitespace will flag the technically correct b'solid '
the same as b'solid'
which should indeed raise the warning.
if not line.startswith(b('solid ')) and line.startswith(b('solid')):
cls.warning('ASCII STL files should start with solid <space>. '
'The application that produced this STL file may be '
'faulty, please report this error. The erroneous '
'line: %r', line)
should be moved to within the get
method.
I think it might be best to simply remove that check, it probably doesn't matter anyhow :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
When loading an ASCII mesh which has the first line as 'solid ', numpy-stl issues a warning:
And then falls back to binary loading which also fails.
The name of the solid is optional, I believe.