Maker Pro
Maker Pro

Need help with some python debugging

We are trying to switch from a LED controlled solar hot water heater system to one which uses a Raspberry Pi A (we need the Pi anyway because we wish to send temps to web) an H-Bridge, pysolar - a program which will give the Sun's position if given Latitude, Longitud, etc., an IMU (to help pysolar locate the position of the solar collector) and Jay Dosher's program which brings everything together and finally outputs run commands to the motor.

We have been trying to debug Jay's program. Since we don't program, we think we've done pretty well on the Pi. We suspect he made the original progam in Python-2.x and since we didn't realize this, we've been trying to use/debug it in Python-3.x. We've gotten to line 337 or so of his 450 line program, so we think we're pretty much there - lol. We've had the most problems with what appear to be strings and numbers as you can see below - our most recent error


Traceback (most recent call last):

File "solarrobot7-core.py", line 373, in <module>

writeline=("actual_elevation: " + str(round((float(getcurangle())),1))+ "\n")

TypeError: float() argument must be a string or a number

Some helpful soul on Stackoverflow i think it was suggested we use some sort of print statement to figure out what values getcurangle actually has but we don't know where to place what - lol.

Any help would be appreciated. Have a great day! :)

P.D. The uploaded file solarrobot7-core.txt is really a .py file and is the file we are working on.
The other file, solarrobot7-core_Original_no_Cambiar.txt is Jay Dosher's original file. It, too, is a .py file.
 

Attachments

  • solarrobot7-core.txt
    17.2 KB · Views: 185
  • solarrobot7-core_Original_no_Cambiar.txt
    16.9 KB · Views: 146
Last edited:
We are trying to switch from a LED controlled solar hot water heater system to one which uses a Raspberry Pi A (we need the Pi anyway because we wish to send temps to web) an H-Bridge, pysolar - a program which will give the Sun's position if given Latitude, Longitud, etc., an IMU (to help pysolar locate the position of the solar collector) and Jay Dosher's program which brings everything together and finally outputs run commands to the motor.

We have been trying to debug Jay's program. Since we don't program, we think we've done pretty well on the Pi. We suspect he made the original progam in Python-2.x and since we didn't realize this, we've been trying to use/debug it in Python-3.x. We've gotten to line 337 or so of his 450 line program, so we think we're pretty much there - lol. We've had the most problems with what appear to be strings and numbers as you can see below - our most recent error


Traceback (most recent call last):

File "solarrobot7-core.py", line 373, in <module>

writeline=("actual_elevation: " + str(round((float(getcurangle())),1))+ "\n")

TypeError: float() argument must be a string or a number

Some helpful soul on Stackoverflow i think it was suggested we use some sort of print statement to figure out what values getcurangle actually has but we don't know where to place what - lol.

Any help would be appreciated. Have a great day! :)

P.D. The uploaded file solarrobot7-core.txt is really a .py file and is the file we are working on.
The other file, solarrobot7-core_Original_no_Cambiar.txt is Jay Dosher's original file. It, too, is a .py file.


"We have been trying to debug Jay's program.
Since we don't program, we think we've done pretty well ..."
That doesn't compute :confused:.
Must be my Spanish or your Englisho_O

Anyways,
A simple line may help you while debugging.
It will print the type that causes your problem.

put it before line#373:

type ( getcurangle() )
 
You guys are great! You read it correctly - we don't have any formal training in programming. We only know enough to d/l the programs and install them on the Pi. Most of them were pretty good at indicating where they should be placed in the subdirectories. The web server that is called for is also pretty easy to set up - i am so happy we switched to Linux several years ago - such a great learning experience. Then, it was just a matter of figuring out how to "run" the program and once it started throwing errors - fix them - until i couldn't. Like they say - it's not rocket science - lol.

i am surprised that i finally got some suggestions from this forum. Very happy - and both of them will be helpful. Thanks again for your help and we'll see how far we can get with it.

Have a great day! :)
 
Top