Closed CyrilWaechter closed 1 year ago
I ran:
import pathlib
print(pathlib)
and got:
<module 'pathlib' from '<path_to_pyrevit>\\pyRevit\\site-packages\\pathlib.py'>
This explains why it does not use correct library as the engine ran separately:
<path_to_pyrevit>\pyRevit\bin\engines\CPY385 (master -> origin)
λ python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
>>> import pathlib
>>> pathlib
<module 'pathlib' from '<path_to_pyrevit>\\pyRevit\\bin\\engines\\CPY385\\python38.zip\\pathlib.pyc'>
>>>
so if you remove the pyRevit\site-packages\pathlib.py
then it works? I need to separate these site-packages
libraries for IronPython and Cpython
so if you remove the
pyRevit\site-packages\pathlib.py
then it works? I need to separate thesesite-packages
libraries for IronPython and Cpython
As extension’s lib folder stands before pyrevit sites-packages in sys.path
I put pathlib.pyc
from pyRevit\\bin\\engines\\CPY385\\python38.zip\\pathlib.pyc
in extension’s lib folder but yes it works as it would probably with your suggestion. A solution could be to change sys.path
order. I tried to found where all path are appended in pyRevit source code but did not figured all of it out.
import sys; import pprint; pprint.pprint(sys.path)
Describe the bug There is an issue with CPython engine inside Revit only. It looks like it uses an old version of pathlib where
exist_ok
did not exist. This feature was apparently introduced in python 3.5.To Reproduce Steps to reproduce the behavior:
Path("test").mkdir(parents=True, exist_ok=True)
Expected behavior This should work like when you run it in the python engine directly:
Screenshots
Desktop (please complete the following information):