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

[Bug]: Cpython can not use print() function #2193

Open
5 tasks done
AnakinSamB opened this issue Apr 4, 2024 · 13 comments
Open
5 tasks done

[Bug]: Cpython can not use print() function #2193

AnakinSamB opened this issue Apr 4, 2024 · 13 comments
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class]

Comments

@AnakinSamB
Copy link

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

Code snippet to reproduce:
grafik
I have no problems using iron python but i would like to use some Cpython features.
Thanks in advance

⌨ Error/Debug Message

CPython Traceback:
AttributeError : 'ScriptIO' object has no attribute 'write'
 File "T:\CAD\Revit-Entwicklung\08_APPs\Entwicklung_Extensions\Revit-Entwicklung.extension\Entwicklung.tab\Sam.panel\Feedback.pushbutton\script.py", line 7, in <module>
print(sys.path)

pyRevitLabs.PythonNet
bei Python.Runtime.Runtime.CheckExceptionOccurred()
 bei Python.Runtime.PyScope.Exec(String code, IntPtr _globals, IntPtr _locals)
 bei Python.Runtime.PyScope.Exec(String code, PyDict locals)
 bei PyRevitLabs.PyRevit.Runtime.CPythonEngine.Execute(ScriptRuntime& runtime)

♻️ To Reproduce

No response

⏲️ Expected behavior

No response

🖥️ Hardware and Software Setup (please complete the following information)

==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive/image)
master | Deploy: "basepublic" | Branch: "master" | Version: "4.8.12.22247+0031" | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
==> Attachments
master | Product: "Autodesk Revit 2024" | Engine: IPY277 (277) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2022.1.2" | Engine: IPY277 (277) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2020.2.5" | Engine: IPY277 (277) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2019.2.2 Hotfix" | Engine: IPY277 (277) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2018 First Customer Ship" | Engine: IPY277 (277) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2017 First Customer Ship" | Engine: IPY277 (277) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
==> Installed Extensions
RdZ | Type: Unknown | Repo: "" | Installed: "Z:\Stammdaten\02 - Revit\07_APP\Projekte\RdZ\RdZ.extension"
Revit-Entwicklung | Type: Unknown | Repo: "" | Installed: "T:\CAD\Revit-Entwicklung\08_APPs\Entwicklung_Extensions\Revit-Entwicklung.extension"
ZWP_App | Type: Unknown | Repo: "" | Installed: "T:\CAD\Revit-Entwicklung\08_APPs\ZWP_APP\ZWP_App.extension"
==> Default Extension Search Path
C:\Users\s.benkendorf\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
T:\CAD\Revit-Entwicklung\08_APPs\Entwicklung_Extensions
Z:\Stammdaten\02 - Revit\07_APP\Projekte\RdZ
T:\CAD\Revit-Entwicklung\08_APPs\ZWP_APP
==> Extension Sources - Default
https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
Autodesk Revit 2024 | Version: 24.2.0.63 | Build: 20231029_1515(x64) | Language: 1033 | Path: "C:\Programme\Autodesk\Revit 2024\"
2022.1.2 | Version: 22.1.21.13 | Build: 20220123_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2022\"
2020.2.5 | Version: 20.2.50.77 | Build: 20210804_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2020\"
2019.2.2 Hotfix | Version: 19.2.20.24 | Build: 20190808_0900(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2019\"
2018 First Customer Ship | Version: 18.0.0.420 | Build: 20170223_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2018\"
2017 First Customer Ship | Version: 17.0.416.0 | Build: 20160225_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2017\"
==> Running Revit Instances
PID: 8216 | 2021.1.6 | Version: 21.1.60.25 | Build: 20220123_1515(x64) | Language: 0 | Path: ""
==> User Environment
Microsoft Windows 10 [Version 10.0.19045]
Latest Installed .Net Framework: 4.8
No .Net Target Packs are installed.
Installed .Net-Core Target Packs: v7.0.117 v7.0.314 v7.0.407
pyRevit CLI v4.8.12.22247+0031

Additional context

No response

@AnakinSamB AnakinSamB added the Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] label Apr 4, 2024
@sanzoghenzo
Copy link
Contributor

Hi @AnakinSamB , I see that you have a quite old version of pyrevit, can you please upgrade it and check if the issue persist?
I've fixed some (but not all) of the problems of cpython in version 4.8 15.
Hopefully we'll have a working cpython environment for pyRevit 5 release!

@AnakinSamB
Copy link
Author

Hi @sanzoghenzo, thanks for the quick reply, unfortunately that did not solve the problem :/. If there is no quick solution i can also wait for the latest version to be released and if that does not fix the error, i will report back here.

@sanzoghenzo
Copy link
Contributor

Is the error the same?
Also, do you confirm that the sample code you posted raises the same error? I ask because the error messages says that the error is at line 7, but the sample code has 4 lines... could it be that you're importing something else before printing?

@AnakinSamB
Copy link
Author

I tried something else before posting the bug but it did not resolve the issue, thats why the error message says line 7... sorry for the confusion -> the sample code creates the same error
grafik

@sanzoghenzo
Copy link
Contributor

Do you have any lib folder in that extension, or other loaded extensions?

Can you please try to unload all your extension, enable the pyRevitDevTools (from the Extensions manager) and then run the "Engine Tests" -> "Test CPython Command" or "Test CPython Search paths"?

@AnakinSamB
Copy link
Author

Good Afternoon,

the error code when i start Text Cpython Command:

grafik
grafik

when i start Text Cpython Search paths:
grafik

@AnakinSamB
Copy link
Author

i forgot to mention that i could not find any lib folder either in the current custom extension or any other custom extension

@sanzoghenzo
Copy link
Contributor

I honestly don't know what's going on...

Not sure if it's related, but one thing I see from the pyrevit env output you posted is that under the "running Revit instances" you have the following:

PID: 8216 | 2021.1.6 | Version: 21.1.60.25 | Build: 20220123_1515(x64) | Language: 0 | Path: ""

But that version is not listed in the "Installed Revits".
Does it say the same thing also with the new pyrevit version?

@jmcouffin have you seen something like this before?

@AnakinSamB
Copy link
Author

grafik
grafik

yes it does, i could try to change it, but i would need help

@jmcouffin
Copy link
Contributor

grafik grafik

yes it does, i could try to change it, but i would need help

please copy paste the whole pyrevit env report, not just bits and pieces

@jmcouffin have you seen something like this before?

yes, but my install of python 3.8 is a bit of a mess, so this is not entirely relevant.

  • I manage to get the proper engine
  • I manage to print stuffs
  • I cannot use numpy, but I am pretty sure this is I have it not properly installed or that the version is too recent, therefore incompatible with 3.8

@sanzoghenzo
Copy link
Contributor

@jmcouffin have you seen something like this before?

yes, but my install of python 3.8 is a bit of a mess, so this is not entirely relevant.

I was referring to the fact that the running revit instance states version "2021.1.6", which is not in the "Installed Revits"...

It may be totally unrelated to the issue, though...

@jmcouffin
Copy link
Contributor

I was referring to the fact that the running revit instance states version "2021.1.6", which is not in the "Installed Revits"...

to my knowledge it is unrelated.

@AnakinSamB
Copy link
Author

==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive/image)
master | Deploy: "basepublic" | Branch: "master" | Version: "4.8.15.24089+0912" | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
==> Attachments
master | Product: "24.2" | Engine: DEFAULT (2711) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2022.1.2" | Engine: DEFAULT (2711) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2020.2.5" | Engine: DEFAULT (2711) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2019.2.2 Hotfix" | Engine: DEFAULT (2711) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2018 First Customer Ship" | Engine: DEFAULT (2711) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
master | Product: "2017 First Customer Ship" | Engine: DEFAULT (2711) | Path: "C:\Users\s.benkendorf\AppData\Roaming\pyRevit-Master"
==> Installed Extensions
Revit-Entwicklung | Type: Unknown | Repo: "" | Installed: "T:\CAD\Revit-Entwicklung\08_APPs\Entwicklung_Extensions\Revit-Entwicklung.extension"
==> Default Extension Search Path
C:\Users\s.benkendorf\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
T:\CAD\Revit-Entwicklung\08_APPs\Entwicklung_Extensions
==> Extension Sources - Default
https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
24.2 | Version: 24.2.0.63 | Build: 20231029_1515(x64) | Language: 1033 | Path: "C:\Programme\Autodesk\Revit 2024"
2022.1.2 | Version: 22.1.21.13 | Build: 20220123_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2022"
2020.2.5 | Version: 20.2.50.77 | Build: 20210804_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2020"
2019.2.2 Hotfix | Version: 19.2.20.24 | Build: 20190808_0900(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2019"
2018 First Customer Ship | Version: 18.0.0.420 | Build: 20170223_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2018"
2017 First Customer Ship | Version: 17.0.416.0 | Build: 20160225_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2017"
==> Running Revit Instances
PID: 14384 | 2021.1.6 | Version: 21.1.60.25 | Build: 20220123_1515(x64) | Language: 0 | Path: ""
==> User Environment
Microsoft Windows 10 [Version 10.0.19045]
Executing User: ZWP-NETZ\s.benkendorf
Active User: ZWP-NETZ\s.benkendorf
Admin Access: No
%APPDATA%: "C:\Users\s.benkendorf\AppData\Roaming"
Latest Installed .Net Framework: 4.8
No .Net Target Packs are installed.
Installed .Net-Core Target Packs: v7.0.118 v7.0.315 v7.0.408
pyRevit CLI v4.8.15.24089+0912.f079f5fd51756b988a06d005d4f4cd2961f36e63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class]
Projects
None yet
Development

No branches or pull requests

3 participants