Problem with selecting Excellon files for opening in FlatCam v9

Issue #264 resolved
Wing Wong created an issue

Versions:

  • FlatCAM 9 - Development Version (pip notes it is version 0.8.5 from Anaconda repo)
  • Mac OS X 10.14.2
  • Python3.6 (Anaconda dist)
$ pip list | grep -i qt
PyQt5                              5.11.3     
PyQt5-sip                          4.19.13    
QtAwesome                          0.4.4      
qtconsole                          4.3.1      
QtPy                               1.4.1  
Issue:

When opening Excellon files, the open fails with the following errors:

objc[28092]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff90218210) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x119a68dc8). One of the two will be used. Which one is undefined.
[DEBUG][Dummy-2] Running task: {'fcn': <bound method App.open_excellon of <flatcam.FlatCAMApp.App object at 0x107669828>>, 'params': [('/Users/wingtangwong/default_test.xln', 'All Files (*)')]}
[DEBUG][Dummy-2] open_excellon()
[DEBUG][Dummy-2] FCVisibleProcessContainer.on_change()
[ERROR][Dummy-2] Abnormal termination of process!
[ERROR][Dummy-2] <class 'AttributeError'>
[ERROR][Dummy-2] 'tuple' object has no attribute 'split'
[ERROR][Dummy-2] <traceback object at 0x1193030c8>
[DEBUG][Dummy-3] Running task: {'fcn': <bound method App.open_excellon of <flatcam.FlatCAMApp.App object at 0x107669828>>, 'params': [('/Users/wingtangwong/default_test.xln', 'All Files (*)')]}
[DEBUG][Dummy-2] FCVisibleProcessContainer.on_done()
[DEBUG][Dummy-3] Task ignored.
[DEBUG][Dummy-2] FCVisibleProcessContainer.on_done()
Traceback (most recent call last):
  File "/Users/wingtangwong/anaconda3/lib/python3.6/site-packages/flatcam/FlatCAMWorker.py", line 62, in do_worker_task
    raise e
  File "/Users/wingtangwong/anaconda3/lib/python3.6/site-packages/flatcam/FlatCAMWorker.py", line 59, in do_worker_task
    task['fcn'](*task['params'])
  File "/Users/wingtangwong/anaconda3/lib/python3.6/site-packages/flatcam/FlatCAMApp.py", line 2136, in open_excellon
    name = outname or filename.split('/')[-1].split('\\')[-1]
AttributeError: 'tuple' object has no attribute 'split'
Abort trap: 6

On adding in prints/etc. I've narrowed it down to something wrong when processes the dialog handler to select a file. The resulting variable: filename is None and doesn't get assigned a value. The exception that is used in the check after grabbing a name from the dialog fails to assign a valid value, causing FlatCam to crash.

When I add in a line to manually assign a filename="xyz.xln" it works and is able to open the file.

Comments (15)

  1. Wing Wong reporter

    At first I thought it was the EXcellon file format, but it turns out to be a UI issue. Would be nice if this can get fixed.

  2. Wing Wong reporter

    Added QT version. I tried to use the version from git/bitbucket, but the HEAD/MASTER is tied to Qt4 which is a no-go.

  3. Wing Wong reporter

    Found the issue. For the Gerber files, you added a [0] to the end of the selections... whereas for the other file opens, you did not. This causes an error because the OS returns a list of items... which causes things to break:

    In file: FlatCAMApp.py

            try:
                filename = QtWidgets.QFileDialog.getOpenFileName(caption="Open Excellon",
                                                             directory=self.get_last_folder())
            except TypeError:
                filename = QtWidgets.QFileDialog.getOpenFileName(caption="Open Excellon")
    

    When I change it to:

            try:
                filename = QtWidgets.QFileDialog.getOpenFileName(caption="Open Excellon",
                                                             directory=self.get_last_folder())[0]
            except TypeError:
                filename = QtWidgets.QFileDialog.getOpenFileName(caption="Open Excellon")[0]
    

    It is able to open the file. Similar for the other dialogs for choosing files. Hitting cancel causes the program to crash out because of the tuple/split fault issue.

  4. Marius Stanciu

    Hi @'Wing Wong',

    This FlatCAM 9, was it a version that I worked on? Where you downloaded it from? I want to make sure that I am the right person to comment on it.

    I just saw your comments and you are right of course. Those issues were present in the FlatCAM versions I worked on after I made the last try in conversion from the PyQt4 to PyQt5 but I did weed them out eventually...

    Thank you for your feedback, could you please try the latest version of FlatCAM beta and see if that works for you? You need to download the Beta branch. Actually I have no way to test it on a Mac so it should also prove helpful for other OS X users.

    Marius

  5. Wing Wong reporter

    Hi @'Marius Stanciu',

    I believe it was, but am no longer sure. I'm downloading the FlatCam Beta 8.9 installer you uploaded a few hours ago and will give that a try under Wine, since it's in the form of an .EXE installer. Will report back with the results.

    Wing.

  6. Wing Wong reporter

    Screen Shot 2019-01-23 at 3.00.26 PM.png

    This is from trying to run FlatCam after installing from FlatCAM_beta_8.903_x64_installer.exe

    So running the Windows build of the code doesn't work under Wine for me. :(

    The latest ZIP bundle is 8.5 from this repo. Do you have the 8.903 beta not in a Windows bundle?

    Thx,

    Wing.

  7. Wing Wong reporter

    I'm doing a new clone, then checkout of the Beta branch and setting it up on Mac OS X. Will let you know the results.

  8. Wing Wong reporter

    Okay, looks like it works after I get some packages installed under pip3.

    Okay, looks like I must have been running an older/defunct version. Download of the 'Beta' branch and running FlatCam.py from there works great! Thanks!

  9. Wing Wong reporter

    Switching to the Beta branch worked.

    Runs fine on Mac OS X 10.14.2

    Python 3 VirtualEnv

    Pip Packages: $ pip list Package Version


    affine 2.2.2
    attrs 18.2.0
    Click 7.0
    click-plugins 1.0.4
    cligj 0.5.0
    dill 0.2.9
    ezdxf 0.8.9
    fonttools 3.36.0
    freetype-py 2.0.0.post6 lxml 4.3.0
    numpy 1.16.0
    ortools 6.7.4973
    pip 19.0.1
    protobuf 3.6.1
    PyOpenGL 3.1.0
    PyOpenGL-accelerate 3.1.0
    pyparsing 2.3.1
    PyQt5 5.11.3
    PyQt5-sip 4.19.13
    rasterio 1.0.13
    Rtree 0.8.3
    setuptools 40.6.3
    Shapely 1.6.4.post2 simplejson 3.16.0
    six 1.12.0
    snuggs 1.4.2
    svg.path 3.0
    vispy 0.5.3
    wheel 0.32.3

    HomeBrew Packages as related to the setup scripts:

    $ brew list | egrep -i "py|qt|type|json|libpng|numpy|scipy|geos|shapely|rtree|tk|spatialindex|gdal|lxml|ezdxf" |sort atk atkmm freetype geos gtk+ gtkglext gtkmm json-c libpng micropython numpy pyqt pyqt@4 python python-markdown python3 python@2 qt qt-webkit@2.3 qt@4 snappy spatialindex wxpython

  10. Log in to comment