I tried the following:

from pystl import PySTL
with PySTL('stl_test.stl') as stl:
    stl.add_triangle((0,0,0),(1,0,0),(0,1,0))

I got the following error message:

Traceback (most recent call last):
  File 
"C:/Users/pr/AppData/Local/Programs/Python/Python35-32/Lib/idlelib/pystl_module_test_1.py",
 line 3, in <module>
    with PySTL('stl_test.stl') as stl:
  File 
"c:\users\pr\appdata\local\continuum\anaconda3\lib\site-packages\pystl\pystl.py",
 line 62, in __enter__
    self.write_stl_header()
  File 
"c:\users\pr\appdata\local\continuum\anaconda3\lib\site-packages\pystl\pystl.py",
 line 75, in write_stl_header
    self.f.write(struct.pack("80s", header_str))
struct.error: argument for 's' must be a bytes object



Poul Riis





Den onsdag den 17. august 2016 kl. 08.49.29 UTC+2 skrev Steven D'Aprano:
> On Wednesday 17 August 2016 16:36, Poul Riis wrote:
> 
> > Can someone deliver a minimal, fully working example with the pystl module,
> > https://pypi.python.org/pypi/pystl/
> > 
> > The only example code mentioned is the following:
> > 
> > with PySTL(‘stl_test.stl’) as stl:
> >     stl.add_triangle( (0.0, 0.0, 0.5), (0.0, 1.0, 0.0), (1.0, 1.0, 0.5) )
> > 
> > 
> > but no matter what 'import'-statement I try I cannot make it work.
> 
> Don't make us guess. What have you tried, and what happens when you do? Cut 
> and 
> paste the *actual* code you try, and the *actual* results.
> 
> http://mattgemmell.com/what-have-you-tried/
> 
> http://www.sscce.org/
> 
> 
> > I have installed the module and a program containing only the following line
> > 
> > from pystl import PySTL
> > 
> > runs without any error message.
> 
> Great. Then try this:
> 
> from pystl import PySTL
> with PySTL(‘stl_test.stl’) as stl:
>     stl.add_triangle( (0.0, 0.0, 0.5), (0.0, 1.0, 0.0), (1.0, 1.0, 0.5) )
> 
> 
> 
> If it doesn't work, what does it do?
> 
> 
> 
> -- 
> Steve

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to