kliment / Printrun

Pronterface, Pronsole, and Printcore - Pure Python 3d printing host software
GNU General Public License v3.0
2.36k stars 997 forks source link

ValueError: could not convert string to float: #521

Closed lordofhyphens closed 10 years ago

lordofhyphens commented 10 years ago

ValueError: could not convert string to float: Traceback (most recent call last): File "/home/builder/Printrun/printrun/printcore.py", line 228, in _readline try: self.recvcb(line) File "/home/builder/Printrun/printrun/pronsole.py", line 1458, in recvcb self.status.update_tempreading(l) File "/home/builder/Printrun/printrun/pronsole.py", line 422, in update_tempreading elif "T" in temps and temps["T"][1] is not None: hotend_setpoint = float(temps["T"][1])

Related to the fix to #519.

iXce commented 10 years ago

Which firmware is this ? What does M105 outputs ?

lordofhyphens commented 10 years ago

This is Marlin, last updated a couple weeks ago.

M105 response: ok T:179.7 /180.0 B:0.0 /0.0 T0:179.7 /180.0 @:63 B@:0

It was appearing to behave properly with pronterface (watching temps). It's my first time using pronsole. Pronsole is running on a raspi, but I'm fairly certain that shouldn't affect anything.

iXce commented 10 years ago

Uh oh, weird. I just tried with this exact same M105 response and not getting an error :/ Does the traceback happen all the time ?

lordofhyphens commented 10 years ago

On 04/03/2014 04:47 PM, Guillaume Seguin wrote:

Uh oh, weird. I just tried with this exact same M105 response and not getting an error :/ Does the traceback happen all the time ?

— Reply to this email directly or view it on GitHub https://github.com/kliment/Printrun/issues/521#issuecomment-39509177.

It had been happening, but did not happen when I ran M105. I have the printer printing something currently, so I can't change anything w/o breaking it. It isn't screaming about it at all, either.

--Joseph Lenox, BS, MS I'm an engineer. I solve problems.

iXce commented 10 years ago

Yeah it shouldn't hopefully break much (it's well protected inside a try: except: block). What I'd need to debug this is that you put the printer in loud mode by doing !self.p.loud = True It will then output everything that's sent or received from the printer, which would greatly help corner the problematic M105 responnse :)

pzl commented 10 years ago

I had a similar error, with the same line of code, in a different file:

Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float:

This occurred only when clicking "print" after loading some gcode from the current git slic3r. It then would not execute the print, just spit this error out every 0.7s or so.

I put a try/except in there to print out temps["T"][1] and it turned out to be empty string. So I modified that line (1655) in printrun/pronterface.py to be:

elif temps["T"][1] is not None and temps["T"][1] != "": setpoint = float(temps["T"][1])

then, loading the same gcode and printing, no more error, and the print started. Seems to have fixed it.

Note: I am very new to 3D printing (but not software in general), so if you have questions about my environment or firmware version, bear with me as I probably don't know how to find that out for you yet.

iXce commented 10 years ago

Can you do what I suggested before ? Enable the Debug communications option (or do !self.p.loud = True in the console) and post the log of communications which will appear in the console here ?

pzl commented 10 years ago

Sure, here's the output after rolling back my empty-string change, and doing the following:

WARNING:root:Memory-efficient GCoder implementation unavailable: No module named gcoder_line
[WARNING] Could not setup DBus for sleep inhibition: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ScreenSaver was not provided by any .service files
[ERROR] Bad value for variable 'extruders', expecting type 'int' (invalid literal for int() with base 10: '1.0')
Connecting...
[INFO] SENT: M105
[INFO] RECV: start
Printer is now online.
[INFO] RECV: echo:Marlin 1.0.0
[INFO] RECV: echo: Last Updated: MendelMax_2-0_RAMBo_1-2 on Apr 10 2014 12:10:11 | Author: Maker's Tool Works edited Jan 7, 2014
[INFO] RECV: Compiled: Apr 10 2014
[INFO] RECV: echo: Free Memory: 5295  PlannerBufferBytes: 1232
[INFO] RECV: echo:Hardcoded Default Settings Loaded
[INFO] RECV: echo:Steps per unit:
[INFO] RECV: echo:  M92 X80.00 Y80.00 Z1600.00 E460.00
[INFO] RECV: echo:Maximum feedrates (mm/s):
[INFO] RECV: echo:  M203 X500.00 Y500.00 Z5.00 E25.00
[INFO] RECV: echo:Maximum Acceleration (mm/s2):
[INFO] RECV: echo:  M201 X3000 Y3000 Z100 E10000
[INFO] RECV: echo:Acceleration: S=acceleration, T=retract acceleration
[INFO] RECV: echo:  M204 S3000.00 T3000.00
[INFO] RECV: echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)
[INFO] RECV: echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
[INFO] RECV: echo:Home offset (mm):
[INFO] RECV: echo:  M206 X0.00 Y0.00 Z0.00
[INFO] RECV: echo:PID settings:
[INFO] RECV: echo:   M301 P11.26 I0.71 D44.48
[INFO] SENT: M105
[INFO] RECV: ok T:24.4 /0.0 B:24.1 /0.0 T0:24.4 /0.0 @:0 B@:0
[INFO] SENT: M105
[INFO] RECV: ok T:24.4 /0.0 B:24.0 /0.0 T0:24.4 /0.0 @:0 B@:0
[INFO] SENT: M105
[INFO] RECV: ok T:24.4 /0.0 B:24.1 /0.0 T0:24.4 /0.0 @:0 B@:0
[INFO] SENT: M105
[INFO] RECV: ok T:24.4 /0.0 B:24.2 /0.0 T0:24.4 /0.0 @:0 B@:0
Loaded /home/dan/dev/printer/40mm Fan Mount.gcode, 15657 lines
357.82mm of filament used in this print
The print goes:
- from 100.23 mm to 150.15 mm in X and is 49.91 mm wide
- from 116.59 mm to 198.41 mm in Y and is 81.81 mm deep
- from 0.00 mm to 10.25 mm in Z and is 10.25 mm high
Estimated duration: 34 layers, 0:11:22
[INFO] SENT: M105
[INFO] RECV: ok T:24.3 /0.0 B:24.3 /0.0 T0:24.3 /0.0 @:0 B@:0
[INFO] SENT: M105
[INFO] RECV: ok T:24.4 /0.0 B:24.2 /0.0 T0:24.4 /0.0 @:0 B@:0
[INFO] SENT: M105
[INFO] RECV: ok T:24.4 /0.0 B:24.0 /0.0 T0:24.4 /0.0 @:0 B@:0
[INFO] SENT: N-1 M110*15
[INFO] RECV: ok
Print started at: 15:51:44
[INFO] SENT: N0 G21*26
Locking interface.
[INFO] RECV: ok
[INFO] SENT: N1 M107*36
[INFO] RECV: ok
[INFO] SENT: N2 M190 S80*82
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.41 E:0 B:24.0
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.37 E:0 B:24.2
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.41 E:0 B:24.1
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.30 E:0 B:24.2
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.37 E:0 B:24.2
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.37 E:0 B:24.2
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.37 E:0 B:24.3
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.37 E:0 B:24.3
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.41 E:0 B:24.3
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.37 E:0 B:24.3
Unlocking interface.
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.34 E:0 B:24.4
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.37 E:0 B:24.5
Print paused at: 15:51:56
[ERROR] Failed to set power settings:
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronsole.py", line 1438, in endcb
    powerset_print_stop()
  File "/home/dan/dev/printer/Printrun/printrun/power/__init__.py", line 100, in powerset_print_stop
    reset_priority()
  File "/home/dan/dev/printer/Printrun/printrun/power/__init__.py", line 93, in reset_priority
    set_nice(0 if platform.system() != "Windows" else psutil.NORMAL_PRIORITY_CLASS)
  File "/home/dan/dev/printer/Printrun/printrun/power/__init__.py", line 87, in set_nice
    p.nice = nice
  File "/usr/lib/pymodules/python2.7/psutil/__init__.py", line 946, in nice
    return self.set_nice(value)
  File "/usr/lib/pymodules/python2.7/psutil/__init__.py", line 174, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/psutil/__init__.py", line 477, in set_nice
    return self._platform_impl.set_process_nice(value)
  File "/usr/lib/pymodules/python2.7/psutil/_pslinux.py", line 472, in wrapper
    raise AccessDenied(self.pid, self._process_name)
AccessDenied: (pid=9554)
[INFO] SENT: M105
[INFO] SENT: M105
[INFO] SENT: M105
[INFO] SENT: M105
[INFO] SENT: M105
Disconnected.
Traceback (most recent call last):
  File "/home/dan/dev/printer/Printrun/printrun/pronterface.py", line 1655, in update_tempdisplay
    elif temps["T"][1] is not None: setpoint = float(temps["T"][1])
ValueError: could not convert string to float: 
[INFO] RECV: T:24.30 E:0 B:24.7
iXce commented 10 years ago

Oh okai. I can very well see when it can happen. Here's a potential fix !