Hi there. I have an odd problem.
The API works great and does normally what I intend to do. However. Now I have a simple calibration print that i want to print with some of mine changes. However if I try to send Layer(Block) 32 back to the printer I get this error:
Something
Something
Something
Layer 32 done
Traceback (most recent call last):
File "/home/pi/OpenFL-master/calib_debug.py", line 16, in <module>
p.write_block(i, layer)
File "/home/pi/OpenFL-master/OpenFL/Printer.py", line 327, in write_block
return self.write_block_flp(block, data)
File "/home/pi/OpenFL-master/OpenFL/Printer.py", line 351, in write_block_flp
self.write_block(block, bytearray(flp.tostring()), skip_audit=True)
File "/home/pi/OpenFL-master/OpenFL/Printer.py", line 340, in write_block
expect_success=True)
File "/home/pi/OpenFL-master/OpenFL/Printer.py", line 180, in _command
r = self._wait_for_packet(wait, verbose=verbose)
File "/home/pi/OpenFL-master/OpenFL/Printer.py", line 195, in _wait_for_packet
p = self.poll()
File "/home/pi/OpenFL-master/OpenFL/Printer.py", line 220, in poll
self._process_raw(raw)
File "/home/pi/OpenFL-master/OpenFL/Printer.py", line 145, in _process_raw
while self.packet[0] != self.SOF:
IndexError: bytearray index out of range
So it fails during the p.write_block(i, layer) in my code. I am stuck and do not know where to start, hence in my test code down below I do not do something with this Layer, I just want to write it back to the printer.
Thanks
ohh and here my code
from OpenFL import Printer, FLP
p=Printer.Printer()
assert 0 in p.list_blocks() # I0 this fails, then there are no layers on the printer
for i in xrange(31,40):
layer = p.read_block_flp(block=i)
assert isinstance(layer, FLP.Packets)
assert isinstance(layer, list)
for l in xrange(0,len(layer)):
print 'Something'
print 'Layer ',i, 'done'
p.write_block(i, layer)
print 'Layer ',i, 'send to printer'
print 'Upload complete!'