Project not saving correctly

Issue #286 resolved
Victor Benso created an issue

This doesn't happen all the time, actually the problem seems to happen when after importing geometries and performing some operations (Painting, PCB Cutting) on them. Some CNC jobs are generated fine and then, when project is saved the file is created (no project on it, file looks empty). The log shows the following message:

[DEBUG][Dummy-7] FCVisibleProcessContainer.on_change()
[DEBUG][Dummy-7] save_project--> FlatCAMObj.read_form()
[WARNING][Dummy-7] Failed to read option from field: tooldia
[WARNING][Dummy-7] Failed to read option from field: dwell
[WARNING][Dummy-7] Failed to read option from field: dwelltime
[WARNING][Dummy-7] Failed to read option from field: type
[WARNING][Dummy-7] Failed to read option from field: plot_kind
[WARNING][Dummy-7] Failed to read option from field: coords_decimals
[WARNING][Dummy-7] Failed to read option from field: fr_decimals
[WARNING][Dummy-7] Failed to read option from field: steps_per_circle
[WARNING][Dummy-7] Failed to read option from field: Tools_in_use
[WARNING][Dummy-7] Failed to read option from field: tool_dia
[WARNING][Dummy-7] Failed to read option from field: xmin
[WARNING][Dummy-7] Failed to read option from field: ymin
[WARNING][Dummy-7] Failed to read option from field: xmax
[WARNING][Dummy-7] Failed to read option from field: ymax
[ERROR][Dummy-7] Could not evaluate: 
[ERROR][Dummy-7] Could not evaluate: 
[ERROR][Dummy-7] Abnormal termination of process!
[ERROR][Dummy-7] <class 'ValueError'>
[ERROR][Dummy-7] Circular reference detected
[ERROR][Dummy-7] <traceback object at 0x7f6202c5f2c8>
[DEBUG][Dummy-7] FCVisibleProcessContainer.on_done()
[DEBUG][Dummy-7] FCVisibleProcessContainer.on_done()
[DEBUG][MainThread] register_recent()

I'll figure out how to reproduce. Tested after merge 06ac0b0

Comments (6)

  1. Marius Stanciu

    This will be a tough nut to crack. I use to have similar problems in the beginning related to JSON serialization but after porting the app to Python3 the issue solved by itself. That "circular reference detected" was the 'death of me', made me loose a night of sleep at that time.

    If you can find the steps to reproduce the issue, it will help tremendously.

  2. Victor Benso reporter

    Open FlatCAM 1 - Import this .svg file as Geometry. 2 - Save the project. The application hangs, the following info is in the console:

    [DEBUG][MainThread] build_ui--> FlatCAMObj.build_ui()
    [DEBUG][MainThread] Mouse button pressed on list
    [DEBUG][MainThread] register_recent()
    [DEBUG][MainThread]    project
    [DEBUG][Dummy-4] save_project()
    [DEBUG][MainThread]    /home/victor/shared_VM/design/Tampas Victor/gcode_repetidor/FUNDO-holes.FlatPrj
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_change()
    [DEBUG][Dummy-4] save_project--> FlatCAMObj.read_form()
    [WARNING][Dummy-4] Failed to read option from field: toolchangexy
    [WARNING][Dummy-4] Failed to read option from field: startz
    [WARNING][Dummy-4] Failed to read option from field: cnctooldia
    [WARNING][Dummy-4] Failed to read option from field: segx
    [WARNING][Dummy-4] Failed to read option from field: segy
    [WARNING][Dummy-4] Failed to read option from field: f_plunge
    [WARNING][Dummy-4] Failed to read option from field: circle_steps
    [WARNING][Dummy-4] Failed to read option from field: xmin
    [WARNING][Dummy-4] Failed to read option from field: ymin
    [WARNING][Dummy-4] Failed to read option from field: xmax
    [WARNING][Dummy-4] Failed to read option from field: ymax
    [ERROR][Dummy-4] Could not evaluate: 
    [ERROR][Dummy-4] Could not evaluate: 
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_done()
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_done()
    

    GUI says that the application is saving the project, but it actually hangs forever.

    If I import this file, edit it (in my test case, selected all the objects and did an internal buffering of 0.75mm), deleted the original objects, saved & closed the editor. Then the circular reference error comes:

    [INFO][MainThread] FlatCAM Starting...
    [DEBUG][MainThread] Application path is /opt/software/flatcam_victor
    [DEBUG][MainThread] Started in /opt/software/flatcam_victor
    [DEBUG][MainThread] FlatCAMGUI.__init__() --> UI state restored.
    [DEBUG][MainThread] FlatCAM defaults loaded from: current_defaults
    [DEBUG][MainThread] App.__init__() --> Applied English language.
    [DEBUG][MainThread] Options --> 0
    [DEBUG][MainThread] Finished GUI form initialization.
    [DEBUG][MainThread] Finished creating Object Collection.
    [DEBUG][MainThread] Finished Canvas initialization in 1.4817135334014893 seconds.
    [ERROR][MainThread] Could not evaluate: 
    [ERROR][MainThread] Could not evaluate: 
    [ERROR][MainThread] Could not evaluate: 
    [ERROR][MainThread] Could not evaluate: 
    [ERROR][MainThread] Could not evaluate: 
    [ERROR][MainThread] Could not evaluate: 
    [DEBUG][MainThread] Finished adding Geometry and Excellon Editor's.
    [DEBUG][MainThread] Recent items list has been populated.
    [DEBUG][MainThread] setup_shell()
    [DEBUG][MainThread] TCL Shell has been initialized.
    [DEBUG][MainThread] Tools are installed.
    [DEBUG][MainThread] END of constructor. Releasing control.
    [DEBUG][MainThread] on_file_importsvg()
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_change()
    [DEBUG][Dummy-4] new_object()
    [DEBUG][Dummy-4] Calling object constructor...
    [ERROR][Dummy-4] Could not evaluate: 
    [ERROR][Dummy-4] Could not evaluate: 
    [DEBUG][Dummy-4] 0.033656 seconds before initialize().
    [WARNING] Unknown kind: defs
    [WARNING] Unknown kind: guide
    [WARNING] Unknown kind: guide
    [WARNING] Unknown kind: guide
    [WARNING] Unknown kind: format
    [WARNING] Unknown kind: type
    [WARNING] Unknown kind: title
    [DEBUG] ***PATH***
    [DEBUG] ***PATH***
    [DEBUG] ***PATH***
    [DEBUG] ***PATH***
    [DEBUG] ***CIRCLE***
    [DEBUG] ***CIRCLE***
    [DEBUG] ***CIRCLE***
    [DEBUG] ***PATH***
    [DEBUG][Dummy-4] 0.024817 seconds executing initialize().
    [DEBUG] Geometry->bounds()
    [DEBUG][Dummy-4] Moving new object back to main thread.
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_done()
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_done()
    [DEBUG][MainThread] on_object_created()
    [DEBUG][MainThread] on_object_created --> OC.append()
    [DEBUG] FlatCAMGeometry.set_ui()
    [DEBUG][MainThread] set_ui --> FlatCAMObj.to_form()
    [DEBUG][Dummy-5] FCVisibleProcessContainer.on_change()
    [DEBUG][MainThread] register_recent()
    [DEBUG][MainThread]    svg
    [DEBUG][MainThread]    /home/victor/shared_VM/design/Tampas Victor/FUNDO CAIXA 120MM - REPETIDOR - NOVO RECORTE - furos.svg
    [DEBUG][Dummy-5] plot --> FlatCAMObj.plot()
    [DEBUG][Dummy-5] 0.177664 seconds adding object and plotting.
    [DEBUG][Dummy-5] FCVisibleProcessContainer.on_done()
    [DEBUG][Dummy-5] FCVisibleProcessContainer.on_done()
    [DEBUG][MainThread] build_ui--> FlatCAMObj.build_ui()
    [DEBUG][MainThread] Mouse button pressed on list
    [DEBUG][MainThread] on_tool_select('select')
    [DEBUG][MainThread] select is checked.
    [DEBUG][MainThread] on_tool_select('buffer')
    [DEBUG][MainThread] buffer is checked.
    [DEBUG][MainThread] on_tool_select('select')
    [DEBUG][MainThread] select is checked.
    [DEBUG] Geometry->bounds()
    [DEBUG][MainThread] plot --> FlatCAMObj.plot()
    [DEBUG][Dummy-4] save_project()
    [DEBUG][MainThread] register_recent()
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_change()
    [DEBUG][MainThread]    project
    [DEBUG][MainThread]    /home/victor/shared_VM/design/Tampas Victor/gcode_repetidor/FUNDO-holes.FlatPrj
    [DEBUG][Dummy-4] save_project--> FlatCAMObj.read_form()
    [WARNING][Dummy-4] Failed to read option from field: toolchangexy
    [WARNING][Dummy-4] Failed to read option from field: startz
    [WARNING][Dummy-4] Failed to read option from field: cnctooldia
    [WARNING][Dummy-4] Failed to read option from field: segx
    [WARNING][Dummy-4] Failed to read option from field: segy
    [WARNING][Dummy-4] Failed to read option from field: f_plunge
    [WARNING][Dummy-4] Failed to read option from field: circle_steps
    [WARNING][Dummy-4] Failed to read option from field: xmin
    [WARNING][Dummy-4] Failed to read option from field: ymin
    [WARNING][Dummy-4] Failed to read option from field: xmax
    [WARNING][Dummy-4] Failed to read option from field: ymax
    [ERROR][Dummy-4] Could not evaluate: 
    [ERROR][Dummy-4] Could not evaluate: 
    [ERROR][Dummy-4] Abnormal termination of process!
    [ERROR][Dummy-4] <class 'ValueError'>
    [ERROR][Dummy-4] Circular reference detected
    [ERROR][Dummy-4] <traceback object at 0x7f7659233208>
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_done()
    [DEBUG][Dummy-4] FCVisibleProcessContainer.on_done()
    

    In this test case, in the TCL shell I'm getting the following messages: notice the last warning:

    FlatCAM 8.913 (c)2014-2019 Juan Pablo Caram (Type help to get started)
    
    [success] Opened: /home/victor/shared_VM/design/Tampas Victor/FUNDO CAIXA 120MM - REPETIDOR - NOVO RECORTE - furos.svg
    [WARNING_NOTCL] Editor is activated ...
    Create buffer geometry ...
    [success] Interior buffer geometry created.
    [success] Done. Buffer Int Tool completed.
    [WARNING] Object empty after edit.
    

    If after this failed attempt of saving, I re-open the geometry in the editor and save & close it (without any changes, not even a click on the editor's canvas), the project saving is successful.

  3. Marius Stanciu

    Hi, I think that the issue has to do with the error that comes up when you "Save & Close Editor" after you've done the buffering followed by delete old geo.

    'InteriorRingSequence' object has no attribute 'bounds'
    

    I think that in one of your pull requests you've added the interior rings. This may have caused the issue, we need to track the effects. (Not so)

    LE: Actually I fixed the issue in commit 1307026. I was adding the entire object.interiors into the shapes storage instead of adding them one by one. FlatCAMGeoEditor.buffer_int()

  4. Log in to comment