Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the function generate_pcb() can't generate PCB file #191

Open
wofy-92 opened this issue Aug 15, 2023 · 5 comments
Open

the function generate_pcb() can't generate PCB file #191

wofy-92 opened this issue Aug 15, 2023 · 5 comments
Labels

Comments

@wofy-92
Copy link

wofy-92 commented Aug 15, 2023

Describe the bug
Hi devbisme, When I running the function generate_pcb(), I get a WARNING:
WARNING: kinet2pcb module is missing. Can't generate a KiCad PCB without it.
but I have installed kinet2pcb

** The test code in the JupyterLab**

from skidl import *

esp32 = Part('RF_Module','ESP32-WROOM-32', footprint='RF_Module:ESP32-WROOM-32')
generate_pcb()

** output message**
WARNING: kinet2pcb module is missing. Can't generate a KiCad PCB without it. @ [D:\Python310\Lib\site-packages\IPython\core\interactiveshell.py:3433=>C:\Users\Administrator\AppData\Local\Temp\ipykernel_29400\1868553726.py:4] INFO: 1 warnings found while creating PCB. INFO: 0 errors found while creating PCB.

Screenshots

image

image

Desktop (please complete the following information):

  • Windows11
  • Python3.10.0
  • SKiDL1.2.1
  • kinet2pcb1.1.0
@wofy-92 wofy-92 added the bug label Aug 15, 2023
@tapegoji
Copy link

did you fix this?

@roboPanda69
Copy link

Hi @devbisme if this problem is not taken, could I solve this ?

@devbisme
Copy link
Owner

I'm not seeing this error when running the tests on linux. You can try it on Windows and see if the error occurs there. If so, then go ahead and attempt a fix. Please use the version1 branch to make your fix. I added a test for generate_pcb() to test_generate.py, so make sure to fetch your branch to get that change.

If you don't see any errors, then I can close this issue.

@wofy-92 wofy-92 closed this as completed Jul 26, 2024
@roboPanda69
Copy link

Hi Dave, the problem was majorly for Windows user. We have to include the pcbnew module in our Python library search path in the code of kinet2pcb.py.

I am writing instructions on how one could change the same for beginners using the code for the first time -

  1. Open kinet2pcb.py file (inside kinet2pcb folder), in line 15 we have sys.path.append('/usr/lib/python3/dist-packages') , here we have to change this path so that it could locate pcbnew.py file.
  2. For KiCAD 8.0 the default path is "C:/Program Files/KiCad/8.0/bin/Lib/site-packages", so in the code we have to change line 15 of kicad.py to sys.path.append("C:\\Program Files\\KiCad\\8.0\\bin\\Lib\\site-packages")
  3. After this some might face an error for ImportError: DLL load failed while importing _pcbnew: The specified module could not be found.
  4. To solve the above problem we have to Copy _pcbnew.pyd from the sites-packages folder to the KiCad/bin folder. [ For reference - https://forum.kicad.info/t/cannot-import-pcbnew-when-running-kicad-bin-python-exe-on-the-command-line/14519/15?u=prashun_pandey ]
  5. We have to add sys.path.append("C:\\Program Files\\KiCad\\8.0\\bin\\") at line 14. And then our program would work perfectly.

Here is how code looked before -

from past.builtins import basestring
import argparse
import logging
import os
import os.path
import re
import shutil
import sys

import kinparse

sys.path.append('/usr/lib/python3/dist-packages')
import pcbnew
import hierplace

For Windows user they have to change as -

from past.builtins import basestring
import argparse
import logging
import os
import os.path
import re
import shutil
import sys
import platform

import kinparse

sys.path.append("C:\\Program Files\\KiCad\\8.0\\bin\\")
sys.path.append("C:\\Program Files\\KiCad\\8.0\\bin\\Lib\\site-packages")

import pcbnew
import hierplace

@devbisme
Copy link
Owner

devbisme commented Aug 3, 2024

Thanks for looking at this, @roboPanda69. It appears that the changes need to be made to the kinet2pcb utility, so I'll do that over there. Then I'll come back and close this issue.

@devbisme devbisme reopened this Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants