mmccoo / kicad_mmccoo

This is a repository to hold example and utility code for scripting within kicad (currently limited to pcbnew)
Apache License 2.0
106 stars 26 forks source link

AttributeError: 'module' object has no attribute 'BLACK' #2

Closed Gasman2014 closed 7 years ago

Gasman2014 commented 7 years ago

Hi I am keen to try out python in Kicad and have had some success with some other scripts and some of your tutorial scripts. This one falls over on me though. Not sure if this is an OS X thing - I have another script which is failing in a very similar way.

Py 0.9.8
Python 2.7.10 (default, Feb  7 2017, 00:08:15) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Startup script executed: /Users/johnpateman/Library/Preferences/kicad/PyShell_pcbnew_startup.py
execfile("/Users/johnpateman/Library/Preferences/kicad/gensvg.py")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/johnpateman/Library/Preferences/kicad/gensvg.py", line 31, in <module>
    pcbnew.BLACK:         'BLACK',
AttributeError: 'module' object has no attribute 'BLACK'

Nightly build Kicad 4.0.6/macOS

Any clues/tricks/suggestions ?

mmccoo commented 7 years ago

Thank you for the issue report. Real code has bugs. No bug reports means no users. This is one of the ways I know I should bother.

The problem is that kicad has changed the way colors are managed (for the better). Instead of color names, rgb values are the way to go.

I have updated gensvg on github as well as my blog entry about this file