CadQuery / CadQuery/CQ-editor

CQ Editor cannot find files in module search path

Open
#439 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

Consider a project setup like this:
```
/
|- pyproject.toml
|- poetry.lock
|- mylib
|- __init__.py
|- mystery.py
|- example
|- example.py
```
where
```python
# 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:
```python
# 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.