saving projet with only one excellon file

Issue #555 resolved
Cyrill S. Kouzmine created an issue

Open Flatcam (ver. 2021/2/7).

Import one excellon file (2-5 inch T)

Try to save project.

Get:

[DEBUG][Dummy-4] save_project() -> Saving Project
[ERROR][Dummy-4] Abnormal termination of process!
[ERROR][Dummy-4] <class 'TypeError'>
[ERROR][Dummy-4] AppLogging.error() takes 2 positional arguments but 3 were given
[ERROR][Dummy-4] <traceback object at 0x7f8ad2af1680>
Traceback (most recent call last):
  File "/opt/flatcam-qt6/app_Main.py", line 11832, in save_project
    project_as_json = json.dumps(d, default=to_dict, indent=2, sort_keys=True).encode('utf-8')
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/__init__.py", line 412, in dumps
    **kw).encode(obj)
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 298, in encode
    chunks = list(chunks)
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 704, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
    for chunk in chunks:
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 534, in _iterencode_list
    for chunk in chunks:
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
    for chunk in chunks:
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
    for chunk in chunks:
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
    for chunk in chunks:
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 725, in _iterencode
    for chunk in _iterencode(o, _current_indent_level):
  File "/home/kika/.local/lib/python3.10/site-packages/simplejson/encoder.py", line 722, in _iterencode
    raise ValueError("Circular reference detected")
ValueError: Circular reference detected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/flatcam-qt6/appWorker.py", line 61, in do_worker_task
    task['fcn'](*task['params'])
  File "/opt/flatcam-qt6/app_Main.py", line 11842, in save_project
    self.log.error("Failed to save file: %s", str(filename))
TypeError: AppLogging.error() takes 2 positional arguments but 3 were given

FlatPrj file not created.

Comments (24)

  1. Marius Stanciu

    Hello,
    Probable there are some other errors that triggered the one in the log subclass that I made. But essentially, the FlatCAM beta version available on this repo is not ready for Python 3.10. Use Python 3.9.
    Otherwise, if you want to try my working copy which use Python 3.10 and PyQt6, use the Beta_8.995 branch on my personal Bitbucket repo, here: https://bitbucket.org/marius_stanciu/flatcam_beta/get/Beta_8.995.zip
    But check the Issues section first (on my repo) to see what is not working currently.

  2. Marius Stanciu

    Hi,

    True, I was stuck in the date mentioned 7 Feb 2021. And it made no sense for me, why someone was using such an old commit so I just jumped to conclusion.

    As for the AUR package, I have no idea what your are talking about. Perhaps you can tell me what is all about?

  3. Marius Stanciu

    I know that I am not working as I am supposed to but all my fixes go in the same branch (currently Beta_8.995) and once I have a version I'm happy with (most of the bugs solved) I then merge it in the Beta branch. But the Beta branch is still based on PyQt5 and since you say you are using the PyQt6 version it looks like you are using the Unstable version. But what commit are you using? The date in the About page is not relevant since it is just a date in future (now in the past) that I added at some point in time in the hope that at that moment I will make an release. Which obviously it did not happen since the content was not pushed to the Beta branch which is the Main branch for me.

    So, what matter is: are you using the latest commit from my Bitbucket repository? If not, what commit are you using?

  4. Marius Stanciu

    And using the latest commit I get what is expected (except that I did not configured the format but that does not matter for the saving):

  5. Cyrill S. Kouzmine reporter

    Yes, I saving with complession, level 3.
    Btw, if I delete excellon from project I can normally save it. Then add it again – can’t save again (same trace, same files&lines). And so on.

    Will try new sources tomorrow.

  6. Cyrill S. Kouzmine reporter

    Now i’m trying r4080.af688cb3-1from Beta. Where should I post issues about this branch?

    Now I have this:

    [DEBUG][MainThread] Finished Canvas initialization in 0.2633070945739746 seconds.
    [DEBUG][MainThread] Finished creating Workers crew.
    [DEBUG][MainThread] TCL Shell has been initialized.
    [DEBUG][MainThread] App.__init__() install_tools() --> 'NoneType' object has no attribute 'view'
    [DEBUG][MainThread] app_Main.__init__() --> Geo Editor Error: 'NoneType' object has no attribute 'new_shape_collection'
    [DEBUG][MainThread] app_Main.__init__() --> Excellon Editor Error: 'NoneType' object has no attribute 'new_shape_collection'
    [DEBUG][MainThread] app_Main.__init__() --> Gerber Editor Error: 'NoneType' object has no attribute 'new_shape_collection'
    [DEBUG][MainThread] Initialization of the GCode Editor is finished ...
    [DEBUG][MainThread] Finished adding FlatCAM Editor's.
    [DEBUG][MainThread] + Adding Exclusion Areas
    [DEBUG][MainThread] Recent items list has been populated.
    Traceback (most recent call last):
      File "/opt/flatcam-qt6/FlatCAM.py", line 93, in <module>
        fc = App(qapp=app)
      File "/opt/flatcam-qt6/app_Main.py", line 1479, in __init__
        self.ui.menuview_toggle_grid_lines.triggered.connect(self.plotcanvas.on_toggle_grid_lines) # kika
    AttributeError: 'NoneType' object has no attribute 'on_toggle_grid_lines'
    

  7. Marius Stanciu

    Hi,
    It is obviously that you do something wrong since those errors never occur for me. Without knowing the steps you are doing there is little no none help that I can give.
    The latest commit on my repo is 4089438. The code r4080.af688cb3-1 tells me nothing.

  8. Cyrill S. Kouzmine reporter

    Yes, thanks. I am apologize for the fact that I confused and did not understand all repos branches, qt and python versions.

  9. Cyrill S. Kouzmine reporter
    • changed status to open

    It is about marius_stanciu /Beta_8.995 commit 40894383 At my setup saving project with this file still not working.

    [DEBUG][MainThread]    excellon
    [DEBUG][MainThread]    /home/kika/docs/eagle-local/projects-local/1533gen-flatcam/1533gen.drd
    [DEBUG][Dummy-4] 0.124172 seconds adding object and plotting.
    [DEBUG][MainThread] build_ui--> FlatCAMObj.build_ui()
    [DEBUG][Dummy-5] save_project() -> Saving Project
    [ERROR][Dummy-5] Abnormal termination of process!
    [ERROR][Dummy-5] <class 'TypeError'>
    [ERROR][Dummy-5] error() takes 2 positional arguments but 3 were given
    [ERROR][Dummy-5] <traceback object at 0x7f1f5529a480>
    Traceback (most recent call last):
      File "/home/kika/build/flatcam-qt6/flatcam_beta/app_Main.py", line 11918, in save_project
        project_as_json = json.dumps(d, default=to_dict, indent=2, sort_keys=True).encode('utf-8')
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/__init__.py", line 398, in dumps
        return cls(
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 298, in encode
        chunks = list(chunks)
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 704, in _iterencode
        for chunk in _iterencode_dict(o, _current_indent_level):
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
        for chunk in chunks:
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 534, in _iterencode_list
        for chunk in chunks:
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
        for chunk in chunks:
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
        for chunk in chunks:
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 658, in _iterencode_dict
        for chunk in chunks:
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 725, in _iterencode
        for chunk in _iterencode(o, _current_indent_level):
      File "/home/kika/.local/lib/python3.9/site-packages/simplejson/encoder.py", line 722, in _iterencode
        raise ValueError("Circular reference detected")
    ValueError: Circular reference detected
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/kika/build/flatcam-qt6/flatcam_beta/appWorker.py", line 61, in do_worker_task
        task['fcn'](*task['params'])
      File "/home/kika/build/flatcam-qt6/flatcam_beta/app_Main.py", line 11928, in save_project
        self.log.error("Failed to save file: %s", str(filename))
    TypeError: error() takes 2 positional arguments but 3 were given
    

    $ git checkout
    Your branch is up to date with 'origin/Beta_8.995'.
    $ git rev-parse --short HEAD
    40894383
    

    At the screenshoot there is previously saved project it does not matter.

  10. Marius Stanciu

    Hi,

    The last error is not such a big deal it is just a syntax error in a log.error. The real error that trigger this error is the ‘circular reference detected’ and that one is a nasty one.
    I have made a few changes (you could try to update to the latest commit) but bottom line is that this issue is related to your setup. I can’t see this error in Windows and many other people are using Linux and MacOS and none had reported this error.
    What I would do in your case is to create a virtual environment, try to install all the packages in the requirements.txt and/or setup_ubuntu.sh files and run FlatCAM beta from there. I don’t know much about Linux, at least not enough to go deeper on why this is working for almost everybody and why not in your case.

    So, try the latest commit maybe this will do something for the better, I have added a second layer of copy() for the objects.

  11. Marius Stanciu

    And just to see if there is an issue with Linux, I just run a virtual machine with an Ubuntu 20.04 got from https://www.linuxvmimages.com/images/ubuntu-2004/.

    I cloned my repo, switched to the Beta_8.995 branch.
    I installed the virtualenv Pyhon package, created a virtual environment, installed all the packages from the requirements.txt file.
    After running FlatCAM Evo Unstable beta, I loaded your Excellon file and then saved the project. All worked as expected, no errors.
    After that I loaded the saved project and all loaded Ok.

  12. Marius Stanciu

    Ok, just wasted some more time.
    I found an VmWare image of Arch Linux on https://www.linuxvmimages.com/images/archlinux-2021.
    I downloaded it and run it just to see that it was a simple command line… Updated the installation, installed xorg, installed Gnome, created a Python virtual environment. Some packages had to be installed with pacman, some with pip. In the end it something was messy when using FlatCAM with the 3D engine (some errors regarding the glut although I installed the glut package with pacman and there was no rendering on the canvas for the shapes that had filling). I run FlatCAM Evo beta with the 2D engine and that worked.

    In any case, loading your Excellon file in both graphic modes, I was able to save just fine.
    There were no errors when saving the project which leads me to believe that you have some issues with your Linux.

  13. Marius Stanciu

    Hi,
    Unfortunately I’m running low on space on the notebook HDD so after I finished that blundering install (trying this and that) and saw that the issue is not there, I deleted everything.
    All I remember from that half-a-sleep install was that at first I did not used the the virtual environment and I started to install everything on the main system Python (I think it was Python 3.10.2) with the pip package (I had to install that one too, that Linux Arch was really a barebone install). One thing came to mind is the simplejson package that I installed in both the main Python and after that in the virtual environment.
    All the packages had to be installed, at least in the virtual environment, Some extra needed was the sudo pacman -S spatialindex, sudo pacman -S python-rtreeand others.
    Try to find if you can install the packages first with pacman (like sudo pacman -S python-pyqt6) and have them installed also with pip in the virtual environment (with say pip install pyqt6).
    I know, it was a mess, but my goal was to see if there is a saving issue not to create a guide to install FlatCAM Evo (beta) in Arch Linux because I have absolutely no experience with Arch Linux except my blundering install from last night.

  14. Marius Stanciu

    BTW, you can download yourself one of those virtual machines, perhaps the VirtualBox one and see what you can do inside without damaging your main OS.
    https://www.linuxvmimages.com/images/archlinux-2021

    LLE: and if you find that installing GDAL and Rasterio is too bothersome (it’s not a simple pip install etc) you could not install them, the app will still work, although the Image Import plugin will no longer be available.

  15. Cyrill S. Kouzmine reporter

    Thanks.

    At the fresh setup all is working fine (python3.10).

    Installed through YAY from AUR with PKGBULD file updated this month (‘flatcam-qt6’ package which takes src from 'https://bitbucket.org/marius_stanciu/flatcam_beta/commits/branch/Beta_8.995').

    In this case most of all dependencies have installed system-wide by package manager including ‘rasterio’ and ‘gdal’. Also some additional deps have installed for user with ‘pip -r requirements.txt’.

  16. Log in to comment