You need to log in to create posts and topics.

gerbil failed 1/3 through print

I was printing a picture at 15 pixels/mm at speed=1000 and about 1/3 through (about 4 hours) gerbil terminated with the following error:

Traceback (most recent call last):


  File "", line 762, in <module>




  File "", line 757, in _main




  File "C:\Program Files (x86)\Inkscape\share\extensions\", line 268, in affect




  File "", line 176, in effect




  File "", line 648, in GcodetoController


    log.write("\n Error rate "+ str(error_count))


UnboundLocalError: local variable 'log' referenced before assignment

Any ideas?

This hard to get an idea of what happened, so the best you can do is breaking up the issue in smaller steps. I would suggest to write the gcode to a file and not stream it. Check it that works. If that is successful then use a g code sender to stream it to Gerbil. Again did it succeed or not? If not then it could be a gcode is. If it succeeds then it could the communication between inkscape and gerbil. If it is a comms issue then we can increase the timeout settings or replace the usb cable for a shorter one. If that all fails then we need to debug it a bit further. Hope this makes sense and let me know your findings. Thanks

First step completed - I always send to a file first to see how big it will get.  This one is 86.3MB and is the largest I have tried to print so far.  I will try to send the file through CNCjs since I saved it from the failed print.  How would I change the timeout settings?

Time out settings can be changed within the python script /

it’s in the share/extensions folder and use notepad++ (txt editor) to modify and save.

around line 604:

verbose = False
settings_mode = False
check_mode = False
f = open(pos_file_gcode, 'r')
if verbose :
log = open(pos_file_log, 'w')
# Initialize
s = serial.Serial(port[0],BAUD_RATE)
s.writeTimeout = 0.2 <- increase
s.timeout = 0.2 <- increase e.g 1.0 or 1.5 etc
#print "Initializing Grbl..."



Thanks Paul.  I have increased the timeout values to 1.5 - my laptop is dedicated to this process so it can't hurt.

Hi Paul,

I noticed that in there are 2 instances of log.write that do not have a if verbose : qualifier and one of them is the error I am seeing.  I have seen this twice now and I believe I should add the qualifier to the 2 log.write statements where it is missing - do you agree?

Also - can verbose be added to the raster2laser_gcode options panel in the Inkscape screen?

After several more failed prints, per your advice I swapped out my USB cable with a new 4 foot one and I have not had a failed print since.  The old cable was several year old and the new one is shielded but the same length of 4 feet - a shorter one would not make the trip to the K40 from my laptop.  Many strange things were happening with the old cable and all of those have vanished.  Thanks for the advice and I am back to enjoying my enhanced engravings.

Forum Registration

Edit Profile