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

UFPWriter: SettingFunction is not JSON serializable #13675

Closed
1 of 2 tasks
petterssonjonas opened this issue Oct 27, 2022 · 40 comments · Fixed by #14121
Closed
1 of 2 tasks

UFPWriter: SettingFunction is not JSON serializable #13675

petterssonjonas opened this issue Oct 27, 2022 · 40 comments · Fixed by #14121
Labels
Status: On Backlog The issue / feature has been reproduced and is deemed important enough to be fixed. Type: Bug The code does not produce the intended behavior.

Comments

@petterssonjonas
Copy link

Application Version

5.2.1

Platform

Windows 10

Printer

custom

Reproduction steps

Slice
Send to Octoprint

Actual results

Get error "object of type SettingFunction is not JSON serializable"

Expected results

Send to Octoprint works as with 5.1.1.

Checklist of files to include

  • Log file
  • Project file

Additional information & file uploads

Apparently this was a bug in the beta of 5.2, but was "fixed". I did not have the beta installed.
At bottom of log you will see an error from UFPWriter, making octoprint addon not able to proceed with write request.

cura.log

@petterssonjonas petterssonjonas added Status: Triage This ticket requires input from someone of the Cura team Type: Bug The code does not produce the intended behavior. labels Oct 27, 2022
@MariMakes
Copy link
Contributor

Hey @fuzebox1,

Thanks for your report 👍
I'm not sure if this is something that we can solve in Cura. It seems to be related to the Octoprint plug-in.
That is maintained by our wonderful community member @fieldOfView.

Are you sure you have the latest version?
You can find it here:
https://github.com/fieldOfView/Cura-OctoPrintPlugin/releases

@MariMakes MariMakes added Status: Needs Info Needs more information before action can be taken. Status: Under Investigation The issue has been confirmed or is assumed to be likely to be a real issue. It's pending discussion. and removed Status: Triage This ticket requires input from someone of the Cura team labels Oct 28, 2022
@petterssonjonas
Copy link
Author

Hi, I have the latest version, yes.
Fieldofview himself stated it is not a fault in his plugin, but in cura in a discussion thread on the 5.2 beta.
https://community.ultimaker.com/topic/41697-ultimaker-cura-52-released-in-beta/?do=findComment&comment=313331
The issue is said to have been fixed here: #13473
but i am still getting it.

@github-actions github-actions bot removed the Status: Needs Info Needs more information before action can be taken. label Oct 28, 2022
@ckvsoft
Copy link
Contributor

ckvsoft commented Nov 4, 2022

Same mistake
in the Linux Modern app image. Versions 5.2.0 and 5.2.1
Version 5.2 Beta2 works. This problem is not with all my printers.

I don't use Octoprint but send it with Connect Moonraker. But as I said in Beta 2 it works with both installed printers.

If I turn off UFP thumbnails it works.

cura.log

@MariMakes
Copy link
Contributor

Hey @fuzebox1 and @ckvsoft,

I brought your issue up to the team. :flex
They believe it was introduced by this change: #13209

We've added a ticket to the backlog with the intent to improve this.
For internal reference CURA-9859

Thanks for the report! 👍

@MariMakes MariMakes added Status: On Backlog The issue / feature has been reproduced and is deemed important enough to be fixed. and removed Status: Under Investigation The issue has been confirmed or is assumed to be likely to be a real issue. It's pending discussion. labels Nov 7, 2022
@shawnp30
Copy link

shawnp30 commented Nov 7, 2022

Weird mine only happens with 1 printer. My other printer upload from cura via moonraker with ufp enabled just fine. I can cut off ufp and add script from extensions to add thumbnail to gcode
image

@Kedryn
Copy link

Kedryn commented Nov 27, 2022

I just installed the 5.2.1 from 5.1, and i get this error with my S8 using a profile i made for PETG
i DONT get it with the PLA profile for same printer, so the culprit can be one option in the profile.
I'm trying to figure out which one.

@megablue
Copy link

v5.2.1. i am experiencing this problem as well. it was fine last week.

@renatojd
Copy link

I am getting the same problem, I uninstalled and downloaded the latest version, reinstalled and get the same issue. I am connecting via Moonraker.

@jeffoisnz
Copy link

I am getting this issue, printing using Moonraker as well. Weirdly, it was working fine for numerous prints last night, then this morning I am getting the error. No other changes etc. I have restarted Klipper firmware just to make sure, but not resolved. Once this print is finished (manual gcode upload) I will restart the whole environment and see if that helped.

@jeffoisnz
Copy link

I am getting this issue, printing using Moonraker as well. Weirdly, it was working fine for numerous prints last night, then this morning I am getting the error. No other changes etc. I have restarted Klipper firmware just to make sure, but not resolved. Once this print is finished (manual gcode upload) I will restart the whole environment and see if that helped.

After rebooting everything, and doing an update on everything to do with Klipper for good measure, I am still getting this issue. Note that inbetween it working and not, I hadn't even closed Cura (I had restarted it now though)

@jeffoisnz
Copy link

I am getting this issue, printing using Moonraker as well. Weirdly, it was working fine for numerous prints last night, then this morning I am getting the error. No other changes etc. I have restarted Klipper firmware just to make sure, but not resolved. Once this print is finished (manual gcode upload) I will restart the whole environment and see if that helped.

After rebooting everything, and doing an update on everything to do with Klipper for good measure, I am still getting this issue. Note that inbetween it working and not, I hadn't even closed Cura (I had restarted it now though)

If I disable UFP format, it seems to work (was successfully using UFP previously)

@DM5KA
Copy link

DM5KA commented Dec 4, 2022

Hi @jeffoisnz,
same issue and same behaviour here, 5.2.0b2 works fine.

@rochford77
Copy link

rochford77 commented Dec 18, 2022

same issue here. Moonraker connection giving the error. Worked great all day then poof. Log attached.
cura.log

Edit: as a workaround, I just created a new printer the menu, move over all my settings and start/end gcode and its working on the "new" printer but not the "old" printer. same machine, same instance of mainsail/moonraker. also, a "duplicate printer" button would be nice :-D

Edit 2: that was a lie. my profile changed with the new machine. Using the old profile, i get the error. Actually, any of my custom profiles get the error, and the built in ones do not. I tried duplicating my profiles but no dice.

@rburema
Copy link
Member

rburema commented Dec 23, 2022

We have some trouble trying to reproduce this. Could any of you maybe send us the profiles it's errored for?

@rochford77
Copy link

We have some trouble trying to reproduce this. Could any of you maybe send us the profiles it's errored for?

curaprof.zip

sure, enclosed are 2 profiles, broken and working, named accordingly. settings should be "more or less the same"

The plugins I have in cura are:

Moonraker Connectoin 1.6.4 by emtrax
Octoprint Connection 3.7.2 by fieldOfView
Thnigibrowser 3.0.0 by Chris ter bake
XML Material Profiles 1.0.1 by Ultimaker B.V.
Z Offset Setting 3.6.0 by FieldofView

This is in cura 5.2.1 and uploading to moonraker v0.7.1-780-gdde9bcc mainsail v2.4.1 running klipper v0.11.0-22

hope this helps

@rburema
Copy link
Member

rburema commented Dec 23, 2022

@rochford77 Yes, I'm now able to reproduce! Thanks :-)

@jellespijker
Copy link
Member

Should be fixed for the 5.3 release

@rochford77

I noticed that you use some complex logic in your profiles, which were causing additional errors. This happened due to the missing resolveOrValue('<setting_name>') call which is needed when the serialization takes place.

This can be fixed by defining values such as:

wall_line_count = =1 if magic_spiralize else max(1, round((wall_thickness - wall_line_width_0) / wall_line_width_x) + 1) if wall_thickness != 0 else 0

as

wall_line_count = =1 if resolveOrValue('magic_spiralize') else max(1, round((resolveOrValue('wall_thickness') - resolveOrValue('wall_line_width_0')) / resolveOrValue('wall_line_width_x')) + 1) if resolveOrValue('wall_thickness') != 0 else 0

See the following documentation for a more in-depth explanation: https://github.com/Ultimaker/Cura/blob/main/docs/profiles/getting_a_setting_value.md

@ckvsoft
Copy link
Contributor

ckvsoft commented Dec 30, 2022

The error also occurs with the Anycubic Chiron profile included in Cura.
Above all, it still worked in version 5.2 beta under Linux

@ckvsoft
Copy link
Contributor

ckvsoft commented Dec 30, 2022

This profile doesn't look very complex

    "version": 2,
    "name": "Anycubic Chiron",
    "inherits": "fdmprinter",
    "metadata":
    {
        "visible": true,
        "author": "Patrick Glatt",
        "manufacturer": "Anycubic",
        "file_formats": "text/x-gcode",
        "platform": "anycubic_chiron_platform.obj",
        "platform_texture": "anycubic-chiron.png",
        "has_materials": true,
        "preferred_material": "generic_pla",
        "has_machine_quality": true,
        "quality_definition": "anycubic_chiron",
        "preferred_quality_type": "normal",
        "machine_extruder_trains":
        {
            "0": "anycubic_chiron_extruder_0"
        },
        "firmware_file": "MarlinChiron.hex"
    },

    "overrides":
    {
        "machine_name":
        {
            "default_value": "Anycubic Chiron"
        },
        "machine_heated_bed":
        {
            "default_value": true
        },
        "machine_width":
        {
            "default_value": 400
        },
        "machine_height":
        {
            "default_value": 450
        },
        "machine_depth":
        {
            "default_value": 400
        },
        "machine_center_is_zero":
        {
            "default_value": false
        },
        "gantry_height":
        {
            "value": "35"
        },
        "machine_head_with_fans_polygon":
        {
            "default_value":
            [
                [-45, 50],
                [-45, -45],
                [45, 50],
                [45, -45]
            ]
        },
        "machine_gcode_flavor":
        {
            "default_value": "RepRap (Marlin/Sprinter)"
        },
        "machine_start_gcode":
        {
            "default_value": "M107 ;Start with the fan off\nG21 ;Set units to millimeters\nG91 ;Change to relative positioning mode for retract filament and nozzle lifting\nG1 F200 E-3 ;Retract 3mm filament for a clean start\nG92 E0 ;Zero the extruded length\nG1 F1000 Z5 ;Lift the nozzle 5mm before homing axes\nG90 ;Absolute positioning\nM82 ;Set extruder to absolute mode too\nG28 X0 Y0 ;First move X/Y to min endstops\nG28 Z0 ;Then move Z to min endstops\nG1 F1000 Z15 ;After homing lift the nozzle 15mm before start printing\n"
        },
        "machine_end_gcode":
        {
            "default_value": "G91 ;Change to relative positioning mode for filament retraction and nozzle lifting\nG1 F200 E-4;Retract the filament a bit before lifting the nozzle\nG1 F1000 Z5;Lift nozzle 5mm\nG90 ;Change to absolute positioning mode to prepare for part rermoval\nG1 X0 Y400 ;Move the print to max y pos for part rermoval\nM104 S0 ; Turn off hotend\nM106 S0 ; Turn off cooling fan\nM140 S0 ; Turn off bed\nM84 ; Disable motors\n"
        }
    }
}```

@jellespijker
Copy link
Member

jellespijker commented Jan 1, 2023

@ckvsoft The error occurs in the profile which @rochford77 shared https://github.com/Ultimaker/Cura/files/10296063/curaprof.zip the Anycubic Chiron is not a profile but a printer definition. If you are encountering problems it is probably something in the profiles *.def.cfg

@tispokes
Copy link
Contributor

Same here, not in beta 5.0.0
still exists in 5.2.1 after updating plugins

@rburema
Copy link
Member

rburema commented Jan 24, 2023

@tispokes This isn't in the plugins though, you'll have to wait for 5.3-beta at least.

@sampascucci
Copy link

sampascucci commented Jan 26, 2023

I'm running Cura 5.3.0-alpha+xmas, and I'm receiving this error with custom profiles just like others reported. The exact change I made to trigger the error was to change "Printing Temperature Initial Layer" and save those changes to the profile. The profile became broken after that, and the only way to make it work is to modify "Printing Temperature Initial Layer" to anything else, then it works fine. Even if I change it back to the original value, if it has that blue reset arrow (changes not saved to profile) it works fine. As soon as I hit the blue reset arrow on that field, it breaks again.
cap1
cap2

@MariMakes
Copy link
Contributor

Hey @sampascucci,

As mentioned in the discussion:
5.3.0 Alpha + Xmas is just a special version of 5.2. The only changes we introduced compared to UltiMaker Cura 5.2.1 are those which are needed for the new supports. So keep in mind, this is not a sneak peek for Cura 5.3 (there are some really cool new features coming up) but a spotlight release highlighting this new version of tree supports.

So, unfortunately, you'll have to wait for an official 5.3 to see this fix.
Apologies for the inconvenience.

@hybridview
Copy link

This issue just happened to me suddenly today for the first time on 5.2.1. I also use Moonraker. I tried changing the print temp initial layer as suggested, but it did not work for me. Changing UFP to regular GCODE did fix it though. Error log mentions UFPWriter.
cura - Copy.log

@rburema
Copy link
Member

rburema commented Feb 10, 2023

@hybridview Thanks for the report. As mentioned previously in this thread a number of times, we've fixed this for 5.3, which isn't out yet. The actual 5.3-beta should be out (very?) shortly though!

@fieldOfView
Copy link
Collaborator

we've fixed this for 5.3, which isn't out yet.

To further clarify something that has also been brought up before: The fix is not yet part of the Cura 5.3 alpha from last december.

@FumbledAgain
Copy link

FumbledAgain commented Mar 1, 2023

I can confirm that this issue still exists in 5.2.1. HOWEVER, there is also a easy workaround because it appears to only occur (in my limited testing) in a specific instance: when the Line Width setting is automatically calculated. If Line Width is entered manually, the problem is resolved. All child settings Wall Line Width, Top/Bottom Line Width, etc.) can all be calculated; only calculating the parent Line Width setting itself causes the problem to be duplicated. Hopefully this helps track this down, if it remains an issue after 5.3.

UPDATE: The plot thickens. Other settings also cause this issue, and sometimes in more complex ways. For example, Top Surface Skin Speed and Top/Bottom Speed are both set to automatically calculate, the problem reappears. If either of these settings are manually set, the problem disappears again.

@jellespijker
Copy link
Member

the 5.3.0 beta is out can you that version

@fabiradi
Copy link

fabiradi commented Mar 5, 2023

the 5.3.0 beta is out can you that version

👍🏻 5.3.0 beta2 solves it for me.

👎🏻 Line width settings did not solve it.

@ckvsoft
Copy link
Contributor

ckvsoft commented Mar 6, 2023

Beta2 not available, only source

@fieldOfView
Copy link
Collaborator

Beta2 not available

It is, as a download for Beta1. The downloads ("assets") for beta1 were replaced with beta2, but the title of the release was not changed.

@ckvsoft
Copy link
Contributor

ckvsoft commented Mar 6, 2023

Thx, Of course I didn't scroll down that far

@goldjunge91
Copy link

for in 5.3.0 it is fixed but i don't want to update my 5.2.2 version any solution to fix this in 5.2.2 ?

@tispokes
Copy link
Contributor

for in 5.3.0 it is fixed but i don't want to update my 5.2.2 version any solution to fix this in 5.2.2 ?

Install Auto backup Plugin, then update with no trouble at all.

@MariMakes
Copy link
Contributor

Hey @goldjunge91,

You can have two installations next to each other.
Installing a new version doesn't automatically uninstall the previous version.

Can you share what is preventing you to upgrade to 5.3?

@goldjunge91
Copy link

@MariMakes never change a running system more not :-D
and I feel all slicers get over the years worst then better of course couple of good futures was implemented but all available slicer right now are not top edge software that runs 100% perfect this is why I don't like to update

@ckvsoft
Copy link
Contributor

ckvsoft commented Mar 15, 2023

@MariMakes never change a running system more not :-D and I feel all slicers get over the years worst then better of course couple of good futures was implemented but all available slicer right now are not top edge software that runs 100% perfect this is why I don't like to update

are you a newbie ? If I had never made an update I would probably still be on version 2.
Version 5.2.2 isn't exactly old. above all, it doesn't seem to be running smoothly.

@MariMakes
Copy link
Contributor

Everyone is free to choose which version of Cura they are running. There is no need for name-calling.

The reason I ask is to understand what hurdles there are that we can take away. Usually, it's things like "IT is stopping me" "I'm worried about losing settings", or "This one bug is completely blocking my workflow". That is something I can help with.

The feeling that slicers are getting worse is not something I can influence without concrete examples.

I cannot give you the best of both worlds, but I can point you towards the place where the fix has been applied.
That's in these two places.

  1. [CURA-9859] Account for settingfunction value that evaluates to another settingfunction. #14121
  2. Print stacktrace of current location. Uranium#864

Hope this helps 👍

@Hunkoys
Copy link

Hunkoys commented Apr 12, 2023

Mine had something to do with the profile settings. There are functions in the profiles, like getting the # of perimeters based on the line width and total wall thickness. It seems like when I overridden the auto values, it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: On Backlog The issue / feature has been reproduced and is deemed important enough to be fixed. Type: Bug The code does not produce the intended behavior.
Projects
None yet