Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #305

Open
ItsmeEng opened this issue May 5, 2023 · 24 comments
Open

IndexError: list index out of range #305

ItsmeEng opened this issue May 5, 2023 · 24 comments

Comments

@ItsmeEng
Copy link

ItsmeEng commented May 5, 2023

I have installed the plugin an run the M503 command. I cannot analyze any files.
I get always the Error "IndexError: list index out of range".

I am using Cura 5.3.1, Octoprint 1.8.7, latest PTG.
Log attached. Also attached the gcode file.

plugin_PrintTimeGenius_engine.log
AG_Gear_petg.gcode.zip

@eyal0
Copy link
Owner

eyal0 commented May 5, 2023

Hmm. It works fine for me on my computer with those settings. The issue that some users have which is fixed by M503 is not the one that you have.

I see that you are running the aarch64 version. That means that your device or computer is arm64. What kind of device is it?

Do you know how to ssh or telnet to your device and run commands on the device? Can you try running this:

"/usr/local/bin/python" "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py" marlin-calc "/octoprint/octoprint/uploads/Spielzeug/Propeller/AG_Gear_petg.gcode" "M200 D1.75
M200 D0
M92 X80.12 Y80.12 Z399.78 E445.00
M203 X300.00 Y300.00 Z50.00 E40.00
M201 X2000 Y2000 Z100 E10000
M204 P800.00 R10000.00 T2000.00
M205 E5.00 S0.00 T0.00 X8.00 Y8.00 Z0.30"

And let me know what happens. What's supposed to happen is that you get a long output that ends with lines like this:

Progress: 0.99484408864479668, 360.61102238297462463, 615.99770335317577974
Progress: 0.99488947768561276, 360.62692204117774963, 616.04178383403495900
Progress: 0.99495330602426046, 360.64208927750587463, 616.17029417623245990
Progress: 0.99510082040691272, 355.64208927750587463, 617.17719587016290461
Progress: 0.99520010893369792, 355.64208927750587463, 625.76818373494120351
Progress: 0.99521996663905499, 355.64208927750587463, 645.60647925419516469
Progress: 0.99535329694645225, 24.99999943375587463, 651.62196550490284608
Processed 20073 Gcodes and 60 Mcodes. 19744 blocks
Total time: 651.621966
Analysis: {"estimatedPrintTime": 651.62196550490284608, "printingArea": {"maxX": 120.09200286865234375, "maxY": 200.00000000000000000, "maxZ": 6.40000009536743164, "minX": 2.00000000000000000, "minY": 20.00000000000000000, "minZ": 0.20000000298023224}, "dimensions": {"width": 118.09200286865234375, "depth": 180.00000000000000000, "height": 6.20000009238719940}, "filament": {"tool0": {"length": 24.99999943375587463, "volume": 0.06013204552314041}}}

Let me know what you see. If you don't know how to ssh nor telnet, let me know and I will try to help you with that, too.

@ItsmeEng
Copy link
Author

ItsmeEng commented May 6, 2023

Im running octoprint in a docker container on a raspberry pi 4.

The command returned the same issue.

running: "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64" "/octoprint/octoprint/uploads/Spielzeug/Propeller/AG_Gear_petg.gcode" "M200 D1.75
M200 D0
M92 X80.12 Y80.12 Z399.78 E445.00
M203 X300.00 Y300.00 Z50.00 E40.00
M201 X2000 Y2000 Z100 E10000
M204 P800.00 R10000.00 T2000.00
M205 E5.00 S0.00 T0.00 X8.00 Y8.00 Z0.30"
Traceback (most recent call last):  
File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py", line 98, in <module>
    main()  
File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py", line 71, in main
    total_time = progress[-1][1]
IndexError: list index out of range

@eyal0
Copy link
Owner

eyal0 commented May 6, 2023

I wanted you to try it from ssh or telnet. Are you able?

@ItsmeEng
Copy link
Author

ItsmeEng commented May 6, 2023

This is the output from ssh

running: "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64" "/octoprint/octoprint/uploads/Spielzeug/Propeller/AG_Gear_petg.gcode" "M200 D1.75
M200 D0
M92 X80.12 Y80.12 Z399.78 E445.00
M203 X300.00 Y300.00 Z50.00 E40.00
M201 X2000 Y2000 Z100 E10000
M204 P800.00 R10000.00 T2000.00
M205 E5.00 S0.00 T0.00 X8.00 Y8.00 Z0.30"
Traceback (most recent call last):  
File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py", line 98, in <module>
    main()  
File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py", line 71, in main
    total_time = progress[-1][1]
IndexError: list index out of range

@eyal0
Copy link
Owner

eyal0 commented May 6, 2023

That doesn't look like the output from ssh.

Hmm. Can you show me the ssh output of pwd?

What is the command that you ran to start an ssh session?

@eyal0
Copy link
Owner

eyal0 commented May 6, 2023

Oops, wait, nevermind, i sent you the wrong command. One moment...

@eyal0
Copy link
Owner

eyal0 commented May 6, 2023

"/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64" "/octoprint/octoprint/uploads/Spielzeug/Propeller/AG_Gear_petg.gcode" "M200 D1.75
M200 D0
M92 X80.12 Y80.12 Z399.78 E445.00
M203 X300.00 Y300.00 Z50.00 E40.00
M201 X2000 Y2000 Z100 E10000
M204 P800.00 R10000.00 T2000.00
M205 E5.00 S0.00 T0.00 X8.00 Y8.00 Z0.30"

This is the one.

@ItsmeEng
Copy link
Author

ItsmeEng commented May 6, 2023

I run the command on ssh.

"/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64" "/octoprint/octoprint/uploads/Spielzeug/Propeller/AG_Gear_petg.gcode" "M200 D1.75
M200 D0
M92 X80.12 Y80.12 Z399.78 E445.00
M203 X300.00 Y300.00 Z50.00 E40.00
M201 X2000 Y2000 Z100 E10000
M204 P800.00 R10000.00 T2000.00
M205 E5.00 S0.00 T0.00 X8.00 Y8.00 Z0.30"
-bash: /octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64: No such file or directory

@eyal0
Copy link
Owner

eyal0 commented May 6, 2023

Okay, that's the problem. Can you try running the other versions of marlin-calc that are in that directory and tell me if one of them works?

Also, run uname -a.

PTG is not correctly identifying which system you have.

@eyal0
Copy link
Owner

eyal0 commented May 6, 2023

https://github.com/eyal0/OctoPrint-PrintTimeGenius/tree/master/octoprint_PrintTimeGenius/analyzers

That file is supposed to exist on your computer. Why isn't it in the directory?

ls /octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers

@ItsmeEng
Copy link
Author

ItsmeEng commented May 6, 2023

The command uname -a returns

Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

the folder /home/pi/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers

analyze_gcode_comments.py  marlin-calc.amd64   marlin-calc.darwin-x86_64  marlin-calc.windows-AMD64.exe  __pycache__
analyze_progress.py        marlin-calc.armv6l  marlin-calc.i686           marlin-calc.windows-x86.exe    README.md
marlin-calc.aarch64        marlin-calc.armv7l  marlin-calc.mips           marlin-calc.x86_64

It works with "All gcode analyzers"

@eyal0
Copy link
Owner

eyal0 commented May 7, 2023

I can see the aarch64 file in there. So how come when you ran the command, it said no such file or directory.

@Jealy91
Copy link

Jealy91 commented May 9, 2023

I'm getting the same issue, running the exact same setup (Octoprint inside Docker on Pi4).

I'm able to run the commands successfully inside SSH, but the analyze_progress returns "IndexError: list index out of range" error within Octoprint.

EDIT: Tried with "analyze_gcode_comments" which worked within Octoprint, same as @ItsmeEng.

Error with "analyze_progress":

2023-05-09 07:24:33,149 Failed to run '"/usr/local/bin/python" "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py" marlin-calc "/octoprint/octoprint/uploads/Stuff.gcode" "M200 D1.75
M200 D0
M92 X80.00 Y80.00 Z400.00 E140.00
M203 X500.00 Y500.00 Z10.00 E100.00
M201 X5000.00 Y5000.00 Z100.00 E8000.00
M204 P2000.00 R3000.00 T1500.00
M205 B20000.00 E5.00 S0.00 T0.00 X10.00 Y10.00 Z0.40"'
Traceback (most recent call last):
  File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/__init__.py", line 348, in _do_analysis
	raise Exception(results_err)
Exception: Running: "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64" "/octoprint/octoprint/uploads/Stuff.gcode" "M200 D1.75
M200 D0
M92 X80.00 Y80.00 Z400.00 E140.00
M203 X500.00 Y500.00 Z10.00 E100.00
M201 X5000.00 Y5000.00 Z100.00 E8000.00
M204 P2000.00 R3000.00 T1500.00
M205 B20000.00 E5.00 S0.00 T0.00 X10.00 Y10.00 Z0.40"
Traceback (most recent call last):
  File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py", line 98, in <module>
	main()
  File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_progress.py", line 71, in main
	total_time = progress[-1][1]
IndexError: list index out of range

@eyal0
Copy link
Owner

eyal0 commented May 9, 2023

Analyze those comments means that it's using the comments in addition to marlin calc. It's best if marlin calc works.

Can you figure out why marlin calc is failing? It should work if you ssh to the device and run marlin calc.

@Jealy91
Copy link

Jealy91 commented May 9, 2023

I can confirm that marlin-calc works through SSH.

"/octoprint/plugins/lib/python3.8/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64" "/octoprint/octoprint/uploads/Stuff.gcode" "M200 D1.75
M200 D0
M92 X80.00 Y80.00 Z400.00 E140.00
M203 X500.00 Y500.00 Z10.00 E100.00
M201 X5000.00 Y5000.00 Z100.00 E8000.00
M204 P2000.00 R3000.00 T1500.00
M205 B20000.00 E5.00 S0.00 T0.00 X10.00 Y10.00 Z0.40"

I get the result

Analysis: {"estimatedPrintTime": 27042.10713611936080270, "printingArea": {"maxX": 239.22200012207031250, "maxY": 230.78799438476562500, "maxZ": 25.20000076293945312, "minX": 10.100000381469
72656, "minY": 20.00000000000000000, "minZ": 0.20000000298023224}, "dimensions": {"width": 229.12199974060058594, "depth": 210.78799438476562500, "height": 25.00000075995922089}, "filament":
 {"tool0": {"length": 26482.20458984375000000, "volume": 63.69716672070993724}}}

But still errors through OctoPrint.

@eyal0
Copy link
Owner

eyal0 commented May 9, 2023

Do you also get any "Progress:" lines like I did above?

1 similar comment
@eyal0
Copy link
Owner

eyal0 commented May 9, 2023

Do you also get any "Progress:" lines like I did above?

@Jealy91
Copy link

Jealy91 commented May 9, 2023

Yeah it ran through all the progress lines then spat out the JSON response.

@Jealy91
Copy link

Jealy91 commented May 9, 2023

Just tried it without using Docker on the Pi4 (using OctoPi) and it all works fine. So it would seem that could be the contributing factor.

@eyal0
Copy link
Owner

eyal0 commented May 10, 2023

Can you figure out what's going on? I don't have rPi. If you know programming.... That script is not so complicated!

@noelandresg
Copy link

I'm having the exact same issue with my setup (Octoprint running on RPi4 on Docker). Did someone found out the solution? @Jealy91

@Jealy91
Copy link

Jealy91 commented Aug 10, 2023

I'm having the exact same issue with my setup (Octoprint running on RPi4 on Docker). Did someone found out the solution? @Jealy91

Unfortunately not sorry, I just left my RPi4 running OctoPi without Docker and moved some containers elsewhere.

@vanimal
Copy link

vanimal commented Sep 22, 2023

I'm running into the same issue in the same setup (RPI 4, 64-bit, Octoprint running in docker). Here's the output I get from the commands listed above:

root@c00f9f224285:/octoprint# uname -a
Linux c00f9f224285 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
root@c00f9f224285:/octoprint# plugins/lib/python3.10/site-packages/octoprint_PrintTimeGenius/analyzers/marlin-calc.aarch64 octoprint/uploads/Puzzle.gcode "M200 D1.75
M200 D0
M92 X80.12 Y80.12 Z399.78 E445.00
M203 X300.00 Y300.00 Z50.00 E40.00
M201 X2000 Y2000 Z100 E10000
M204 P800.00 R10000.00 T2000.00
M205 E5.00 S0.00 T0.00 X8.00 Y8.00 Z0.30"
Bad system call (core dumped)
root@c00f9f224285:/octoprint#

If I modify the command to marlin-calc.armv7l, it does produce the Progress: messages.

@eyal0
Copy link
Owner

eyal0 commented Sep 26, 2023

Maybe it's guess the wrong version of marlin-calc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants