← Back to team overview

kicad-developers team mailing list archive

Re: Opening pcbnew from kicad: ImportError: No module named pcbnew

 

Hello, Strontium!

On 2016-01-09 06:52, Strontium wrote:
> I am building with this:
> $ cmake ../kicad-source-mirror -DKICAD_SKIP_BOOST=ON 
> -DCMAKE_INSTALL_PREFIX=/opt/kicad-build 
> -DDEFAULT_INSTALL_PATH=/opt/kicad-build -DKICAD_SCRIPTING=ON 
> -DKICAD_SCRIPTING_MODULES=ON -DKICAD_SCRIPTING_WXPYTHON=ON
> $ make all
> $ make install
> 
> That installs pcbnew.py in :
> /opt/kicad-build/lib/python2.7/dist-packages/pcbnew.py
> 
> which is NOT a system directory.

I am currently back to:
cmake 	-DCMAKE_INSTALL_PREFIX=~/SW \
	-DDEFAULT_INSTALL_PATH=~/SW \
	-DKICAD_SKIP_BOOST=ON \
	-DKICAD_SCRIPTING=ON \
	-DKICAD_SCRIPTING_MODULES=ON \
	-DKICAD_SCRIPTING_WXPYTHON=ON \
	../../

And pcbnew.py is installed in my case to ~/SW/lib/python2.7/site-packages
which is ok. IMHO a better destination could be:
~/SW/lib/python2.7/site-packages/kicad

But the system's python doesn't look for packages in that directory, of course,
and it complains with:

$ ./pcbnew
Traceback (most recent call last):
  File "<string>", line 3, in <module>
ImportError: No module named pcbnew

It gets more interesting when I add the path to pcbnew.py:

$ PYTHONPATH=~/SW/lib/python2.7/site-packages ./pcbnew
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/home/admin/SW/lib/python2.7/site-packages/pcbnew.py", line 5055, in <module>
    class BOARD(BOARD_ITEM):
  File "/home/admin/SW/lib/python2.7/site-packages/pcbnew.py", line 5710, in BOARD
    def GetViaByPosition(self, aPosition, aLayer=UNDEFINED_LAYER):
NameError: name 'UNDEFINED_LAYER' is not defined

I am not into the python internals, but it seems something smells down that road.
We can just declare installing kicad with python support as non-root currently
as "unsupported". I am fine with that for now.

Regards,

Clemens

> 
> Steven
> 
> On 09/01/16 00:25, Clemens Koller wrote:
>> Hello, Nick!
>>
>> On 2016-01-08 17:03, Nick Østergaard wrote:
>>> Distro packagers are supposed to enable scripting, and when they
>>> generate a package it is installed in the proper location for python.
>>> AFIK
>>>
>>> Anyway, I did write to keenerd that the scripting is supposed to be
>>> enabled. But it does not seem he is the last packager at the moment.
>> There were some commits from him for kicad-4.0.1.
>> So he should be in charge. ;-)
>>
>> On Arch, I believe the packages are build using makepkg using
>> fakeroot, so he/we won't run into the issues.
>>
>> Clemens
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References