realthunder / fcad_pcb

FreeCAD scripts for PCB CAD/CAM
MIT License
126 stars 25 forks source link

no module named fcad_pcb #50

Closed robotfishe closed 2 years ago

robotfishe commented 2 years ago

This might be a really simple problem, but I've been unable to fix it on two Windows PCs and one Ubuntu one. I follow the instructions to clone the repositories and check out the submodules into my macros directory, so I have an fcad_pcb directory inside my macro directory with kicad.py, kicad_parser, etc inside that.

When I try entering "from fcad_pcb import kicad" in the python console in FreeCAD, I get the following error:

Traceback (most recent call last): File "", line 1, in File "C:\Program Files\FreeCAD\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport__feature__.py", line 142, in _import return original_import(name, *args, **kwargs) ModuleNotFoundError: No module named 'fcad_pcb'

Any ideas?

realthunder commented 2 years ago

Maybe you didn't get the correct Macro directory?

Screenshot from 2021-11-13 06-58-00

robotfishe commented 2 years ago

Nope, it's definitely not that:

fcad1 fcad2 fcad3

realthunder commented 2 years ago

Ah, I see it. You miss spell the module name. Should be fcad_pcb. fcad is short for FreeCAD.

robotfishe commented 2 years ago

Oops, made a typo that time, but I get the same error when it's spelled correctly.

fcad3

realthunder commented 2 years ago

That's strange. Have you ever tried other macros? Do they work? Can you find your macro directory in sys.path?

import sys
sys.path
robotfishe commented 2 years ago

Running sys.path was helpful in a weird way! The macros directory under AppData was there, but I also noticed that there was another Macros path listed, C:\Program Files\FreeCAD\Macros. I copied fcad_pcb into there, restarted FreeCAD, and suddenly I'm able to import.

Still no idea why it was failing to pick up from the correct place, though.

realthunder commented 2 years ago

Maybe some permission issue.