Flatcam tcl script does not work anymore

Issue #389 resolved
Leandro Heck created an issue

I was using a script to do flatcam job. The following snippet was working before. Many times.

I am using Flatcam v8.991

set pcb_path /home/lheck/board
set gerber_path $pcb_path/gerbers
set output_path $pcb_path/flatcam/gcodes

open_gerber \
    ${gerber_path}/board-B_Cu.gbr \
    -outname board-B_Cu.gbr

The script was working but now, it suddenly and inexplicably does not work anymore. I have no idea what I am doing wrong since it was working for the whole day. I had it replicated in three board folders so I am sure it is the same, nothing has changed. All of these three scripts are not working anymore. As I can remember the only thing that could change is that I made the apt upgrade command today. Maybe something external has changed, but what?

This is the output, I am attaching it here, maybe you can see easily something strange.

flatcam --shellfile=$(pwd)/flatcam.tcl
/home/lheck/board/flatcam
Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
[INFO][MainThread] FlatCAM Starting...
[DEBUG][MainThread] Application path is /home/lheck/Apps/flatcam/8.991-beta
[DEBUG][MainThread] Started in /home/lheck/board/flatcam
[DEBUG][MainThread] FlatCAM defaults loaded from: current_defaults
[DEBUG][MainThread] FlatCAMGUI.__init__() --> UI state restored.
[DEBUG][MainThread] FlatCAMGUI.__init__() --> UI layout restored from QSettings.
[DEBUG][MainThread] App.__init__() --> Applied English language.
[DEBUG][MainThread] Finished Preferences GUI form initialization.
[DEBUG][MainThread] Finished creating Object Collection.
[DEBUG][MainThread] Finished Canvas initialization in 0.2283458709716797 seconds.
[DEBUG][MainThread] Finished creating Workers crew.
[DEBUG][MainThread] Finished connecting Signals.
[DEBUG][MainThread] setup_shell()
[DEBUG][MainThread] TCL Shell has been initialized.
[DEBUG][MainThread] Tools are installed.
[DEBUG][MainThread] Recent items list has been populated.
[DEBUG] Initialization of the FlatCAM Geometry Editor is finished ...
[DEBUG][MainThread] Initialization of the FlatCAM Excellon Editor is finished ...
[DEBUG][MainThread] Initialization of the FlatCAM Gerber Editor is finished ...
[DEBUG][MainThread] Finished adding FlatCAM Editor's.
[DEBUG][MainThread] END of constructor. Releasing control.
[DEBUG][MainThread] TCL command '<class 'tclCommands.TclCommandSetSys.TclCommandSetSys'>' executed.
[DEBUG][MainThread] TCL command '<class 'tclCommands.TclCommandOpenGerber.TclCommandOpenGerber'>' executed.
[DEBUG][Dummy-4] new_object()
[ERROR][MainThread] Exec command Exception: 
    while executing
"open_gerber \
    ${gerber_path}/board-B_Cu.gbr \
    -outname board-B_Cu.gbr"

[DEBUG][Dummy-4] Calling object constructor...
[DEBUG][Dummy-4] FlatCAMObj.visible()
[DEBUG][Dummy-4] 0.002829 seconds before initialize().
[DEBUG][Dummy-4] Gerber format found. (%FSLAX46Y46*%) 
[DEBUG][Dummy-4] Gerber format found. Gerber zeros = L (L-omit leading zeros, T-omit trailing zeros, D-no zero supression)
[DEBUG][Dummy-4] Gerber format found. Coordinates type = Absolute (Absolute or Relative)
[DEBUG][Dummy-4] Gerber units found = MM
[WARNING][Dummy-4] Joining 56 polygons.
[DEBUG][Dummy-4] Union by buffer...
[WARNING][Dummy-4] Union(buffer) done.
[DEBUG][Dummy-4] 0.383006 seconds executing initialize().
[DEBUG][Dummy-4] parseGerber.Gerber.bounds()
[DEBUG][Dummy-4] Moving new object back to main thread.
[DEBUG][MainThread] on_object_created()
[DEBUG][MainThread] on_object_created --> OC.append()
[DEBUG][MainThread] FlatCAMGerber.set_ui()
[DEBUG][MainThread] set_ui --> FlatCAMObj.to_form()
[DEBUG][MainThread] build_ui--> FlatCAMObj.build_ui()
[DEBUG][MainThread] build_ui--> FlatCAMObj.build_ui()
[DEBUG][MainThread] register_recent()
[DEBUG][MainThread]    gerber
[DEBUG][MainThread]    /home/lheck/board/gerbers/board-B_Cu.gbr

When I run the .tcl snippet I added before with the `open_gerber` command, it works, but it yields this red output.

System info: Platform: Ubuntu 18.10

Also, I could get the list of the packages upgraded today I am adding here in the case you identify something important has changed. Maybe something related to this python3-uranium module.

Start-Date: 2020-04-08  01:17:42
Commandline: apt upgrade -y
Requested-By: lheck (1000)
Upgrade: 
    cura-plugin-curadrive:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura-plugin-gcodereader:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura-plugin-postprocessing:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura-plugin-sliceinfo:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura-plugin-ultimakermachineactions:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura-plugin-um3networkprinting:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura-plugin-usbprinting:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura-plugin-x3dreader:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1)
    cura-plugins-all:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    cura:amd64 (1:4.6~202004070138~rev4516~pkg346~ubuntu19.10.1, 1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1),
    firefox-locale-en:amd64 (74.0.1+build1-0ubuntu0.19.10.1, 75.0+build3-0ubuntu0.19.10.1),
    firefox:amd64 (74.0.1+build1-0ubuntu0.19.10.1, 75.0+build3-0ubuntu0.19.10.1),
    freecad-daily-common:amd64 (0.19~pre2~202004061401~ubuntu19.10.1, 0.19~pre2~202004071405~ubuntu19.10.1),
    freecad-daily-python3:amd64 (0.19~pre2~202004061401~ubuntu19.10.1, 0.19~pre2~202004071405~ubuntu19.10.1),
    freecad-daily:amd64 (0.19~pre2~202004061401~ubuntu19.10.1, 0.19~pre2~202004071405~ubuntu19.10.1),
    gir1.2-json-1.0:amd64 (1.4.4-2, 1.4.4-2ubuntu0.19.10.1),
    google-chrome-stable:amd64 (80.0.3987.163-1, 81.0.4044.92-1),
    libfreecad-daily-python3-0.19:amd64 (0.19~pre2~202004061401~ubuntu19.10.1, 0.19~pre2~202004071405~ubuntu19.10.1),
    libgnutls30:amd64 (3.6.9-5ubuntu1, 3.6.9-5ubuntu1.1),
    libjson-glib-1.0-0:amd64 (1.4.4-2, 1.4.4-2ubuntu0.19.10.1),
    libjson-glib-1.0-common:amd64 (1.4.4-2, 1.4.4-2ubuntu0.19.10.1),
    python3-uranium:amd64 (1:4.6~202004062214~rev3103~pkg346~ubuntu19.10.1, 1:4.6~202004072206~rev3104~pkg346~ubuntu19.10.1),
    uranium-plugins:amd64 (1:4.6~202004062214~rev3103~pkg346~ubuntu19.10.1, 1:4.6~202004072206~rev3104~pkg346~ubuntu19.10.1),
End-Date: 2020-04-08  01:18:05

Start-Date: 2020-04-08  22:18:25
Commandline: apt upgrade
Requested-By: lheck (1000)
Upgrade: 
    freecad-daily-common:amd64 (0.19~pre2~202004071405~ubuntu19.10.1, 0.19~pre2~202004081423~ubuntu19.10.1),
    freecad-daily-python3:amd64 (0.19~pre2~202004071405~ubuntu19.10.1, 0.19~pre2~202004081423~ubuntu19.10.1),
    freecad-daily:amd64 (0.19~pre2~202004071405~ubuntu19.10.1, 0.19~pre2~202004081423~ubuntu19.10.1)
    libfreecad-daily-python3-0.19:amd64 (0.19~pre2~202004071405~ubuntu19.10.1, 0.19~pre2~202004081423~ubuntu19.10.1),
    python3-uranium:amd64 (1:4.6~202004072206~rev3104~pkg346~ubuntu19.10.1, 1:4.6~202004082326~rev3105~pkg346~ubuntu19.10.1),
    uranium-plugins:amd64 (1:4.6~202004072206~rev3104~pkg346~ubuntu19.10.1, 1:4.6~202004082326~rev3105~pkg346~ubuntu19.10.1),
End-Date: 2020-04-08  22:18:34

Start-Date: 2020-04-08  23:30:12
Commandline: apt upgrade -y
Requested-By: lheck (1000)
Upgrade: 
    cura-plugin-curadrive:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura-plugin-gcodereader:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura-plugin-postprocessing:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura-plugin-sliceinfo:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura-plugin-ultimakermachineactions:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura-plugin-um3networkprinting:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura-plugin-usbprinting:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura-plugin-x3dreader:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1)
    cura-plugins-all:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
    cura:amd64 (1:4.6~202004080138~rev4517~pkg346~ubuntu19.10.1, 1:4.6~202004090133~rev4523~pkg346~ubuntu19.10.1),
End-Date: 2020-04-08  23:30:20

Comments (5)

  1. Leandro Heck reporter

    I tried to add this as you said to do.

    set timout_ms 10000
    set_sys global_background_timeout $timout_ms

    Then later I could not use scripts anymore, so I commented it out to make sure it is not the issue. But nothing has changed.

  2. Marius Stanciu

    Timeout parameter is only used by the TcL commands. I think that when you set it like this, the app will see it as a string and not an integer. I’ve added a conversion to make sure that the number is seen as an integer and that should solve the issue.

    When I will make the push to the Beta repo you will be able to try it.

  3. Log in to comment