CQ Editor cannot find files in module search path
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- desktop, developer-experience
Research direction
Reproduce the import difference between a poetry shell and cq-editor using the project layout and example.py shown in the issue. Inspect how cq-editor selects its Python interpreter and builds sys.path; done means libraries on the active virtual environment's module search path import without the script-level sys.path.append workaround.
Written by the indexing model from the issue text.
Description
Consider a project setup like this:
/
|- pyproject.toml
|- poetry.lock
|- mylib
|- __init__.py
|- mystery.py
|- example
|- example.py
where
# mystery.py
def mystery():
return Cq.Workplane().box(10, 5, 5)
in a poetry shell environment, this succeeds:
(mylib-3.12) [example/] $ python3 -c "import mylib.mystery"
but if example.py contains any reference to import mylib.mystery, loading it up in cq-editor will fail, unless the script starts with this:
# example.py
import os, sys, os.path
root = os.path.dirname(os.getcwd())
print(root)
sys.path.append(root)
import mylib.mystery
The spooky thing is after this part of the script is loaded into cq-editor, commenting it out would not reintroduce the import error. Is there a way for cq-editor to recognize the current venv so it can load libraries referenced by cad scripts?
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 210
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CadQuery/CQ-editor
-
Difficulty 2/5 Half a day Newbie friendliness 78/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Crash on renderOpen
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in CadQuery/CQ-editor
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
awslabs/visual-asset-management-system#414 ·
Maintainers usually reply within 1 day
-
bug v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/python-sdk#3670 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aicell-lab/bioengine#232 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
modelscope/evalscope#1836 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100