Footprint Wizard 2D barcode issue

Bug #1850223 reported by ocb-hd-ccb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Seth Hillbrand

Bug Description

I am trying to generate a 2D barcode (QRCode) with the footprint wizard and I get the following issues:

```

Traceback (most recent call last):

  File "/private/var/folders/00/5c9vglkx6vs6dg0mb9rdyhj00000gn/T/AppTranslocation/CA47B727-5FEE-4A2C-95E3-F612587DCC35/d/kicad.app/Contents/Frameworks/python/site-packages/pcbnew.py", line 3449, in GetFootprint
    self.BuildFootprint()

  File "/private/var/folders/00/5c9vglkx6vs6dg0mb9rdyhj00000gn/T/AppTranslocation/CA47B727-5FEE-4A2C-95E3-F612587DCC35/d/kicad.app/Contents/SharedSupport/scripting/plugins/FootprintWizardBase.py", line 110, in BuildFootprint
    self.CheckParameters() # User error checks

  File "/private/var/folders/00/5c9vglkx6vs6dg0mb9rdyhj00000gn/T/AppTranslocation/CA47B727-5FEE-4A2C-95E3-F612587DCC35/d/kicad.app/Contents/SharedSupport/scripting/plugins/qrcode_footprint_wizard.py", line 65, in CheckParameters
    self.qr.make()

  File "/private/var/folders/00/5c9vglkx6vs6dg0mb9rdyhj00000gn/T/AppTranslocation/CA47B727-5FEE-4A2C-95E3-F612587DCC35/d/kicad.app/Contents/SharedSupport/scripting/plugins/kicad_qrcode.py", line 82, in make
    self._make(False, self._getBestMaskPattern() )

  File "/private/var/folders/00/5c9vglkx6vs6dg0mb9rdyhj00000gn/T/AppTranslocation/CA47B727-5FEE-4A2C-95E3-F612587DCC35/d/kicad.app/Contents/SharedSupport/scripting/plugins/kicad_qrcode.py", line 88, in _getBestMaskPattern
    self._make(True, i)

  File "/private/var/folders/00/5c9vglkx6vs6dg0mb9rdyhj00000gn/T/AppTranslocation/CA47B727-5FEE-4A2C-95E3-F612587DCC35/d/kicad.app/Contents/SharedSupport/scripting/plugins/kicad_qrcode.py", line 116, in _make
    self.qrDataList)

  File "/private/var/folders/00/5c9vglkx6vs6dg0mb9rdyhj00000gn/T/AppTranslocation/CA47B727-5FEE-4A2C-95E3-F612587DCC35/d/kicad.app/Contents/SharedSupport/scripting/plugins/kicad_qrcode.py", line 235, in _createData
    (buffer.getLengthInBits(), totalDataCount * 8) )

Exception: code length overflow. (804 > 512)

```

Version Info:

```

Application: ModEdit
Version: (5.99.0-158-g78859b29e), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.64.1 SecureTransport (LibreSSL/2.8.3) zlib/1.2.11 nghttp2/1.39.2
Platform: Mac OS X (Darwin 19.0.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
    KICAD_STDLIB_DEBUG=OFF
    KICAD_STDLIB_LIGHT_DEBUG=OFF
    KICAD_SANITIZE=OFF
```

Tags: pcbnew python
Changed in kicad:
status: New → Confirmed
Revision history for this message
Nick Østergaard (nickoe) wrote :

I get the same on the 5.1 branch I think, although the error is presented a bit differently. See attached screenshot.

Application: ModEdit
Version: (5.1.5-rc1-1-g88a03f1a1), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.66.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh2/1.8.2 nghttp2/1.39.2
Platform: Linux 5.3.7-arch1-1-ARCH x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.71.0
    OpenCASCADE Technology: 7.4.0
    Curl: 7.66.0
    Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=OFF
    KICAD_USE_OCC=ON
    KICAD_SPICE=ON

tags: added: pcbnew python
Changed in kicad:
milestone: none → 5.1.5
Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

I just installed 5.1.3 and it seems to work fine there (I was on a windows box)...

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

https://imgur.com/a/7k9O7Z3

Here is something similar but different. I was able to get the qr-code gen to work on windows 5.1.3 but I would occasionally have a blank QR code exported from the wizard.

The above screen shots are from the https://kicad-info.s3.dualstack.us-west-2.amazonaws.com/original/2X/6/64a89af3831bec14132633e1c857281063552a53.py script. The wizard works fine but again the 'export' to the footprint editor doesn't have results.

I prefer the segno because of the micro-qr compatibility.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Setting to 5.1.6 as only critical bugs are allowed at this time for 5.1.5

Changed in kicad:
status: Confirmed → Triaged
importance: Undecided → High
milestone: 5.1.5 → 5.1.6
Revision history for this message
Nick Østergaard (nickoe) wrote :

Mmm, isn't this critical when we get an exception?

Revision history for this message
Seth Hillbrand (sethh) wrote :

Hmm... My thinking was that this only prevented generating the QR code footprint with a specific plugin. If we can fix in Python, there's probably an argument to add this in to 5.1.5

Revision history for this message
Seth Hillbrand (sethh) wrote :

Turns out that this was Python3 specific (and two different bugs).

Both bugs were addressed in the python module.

@Wayne, how do you feel about sliding this into 5.1.5? The risk is low (python only) but this feature is only an add-on, so not critical function.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 9bccbaf497bff3a038ac23e728219c3f3ff34f9c
https://git.launchpad.net/kicad/patch/?id=9bccbaf497bff3a038ac23e728219c3f3ff34f9c

Changed in kicad:
status: Triaged → Fix Committed
assignee: nobody → Seth Hillbrand (sethh)
Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

I just checked this in:
and it worked fine. I am attempting to add an external script for testing but I cannot find a way to add a custom directory location to the python search path...

```
Application: KiCad
Version: (5.99.0-279-gaf837ed76), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.64.1 SecureTransport (LibreSSL/2.8.3) zlib/1.2.11 nghttp2/1.39.2
Platform: Mac OS X (Darwin 19.0.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    Build date: Oct 29 2019 15:23:31
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
    KICAD_STDLIB_DEBUG=OFF
    KICAD_STDLIB_LIGHT_DEBUG=OFF
    KICAD_SANITIZE=OFF
```

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

Crap, this did not fix the segno footprint plugin...

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Seth, this one is fine to merge into the 5.1 branch. I don't see it causing issues other than the python script itself.

Revision history for this message
Seth Hillbrand (sethh) wrote :

@ocb-hd-ccb: You will need to report that to the author of the plugin.

Seth Hillbrand (sethh)
Changed in kicad:
milestone: 5.1.6 → 5.1.5
Revision history for this message
Nick Østergaard (nickoe) wrote :

@Seth, thank you for looking into this as well :)

Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.