pyrevitlabs / pyRevit

Rapid Application Development (RAD) Environment for Autodesk Revit®
http://wiki.pyrevitlabs.io
GNU General Public License v3.0
1.27k stars 331 forks source link

CLI Launches the wrong version of Revit [Bug]: #2267

Open scubaman120 opened 3 months ago

scubaman120 commented 3 months ago

✈ Pre-Flight checks

🐞 Describe the bug

Hi, I am using the following CLI command to launch a script to be run on Revit 2023 but it opens 2024 instead. If I manually launch 2023 and run the script everything works fine.

CLI input: pyrevit run “Tool Path.py” “File Path.rvt” --revit=2023 --purge

PyRevit: pyRevit_4.8.16.24121_signed

Revit 2023: 23.1.30.97 20230828_1515(x64) 2023.1.3

Revit 2024: 24.2.10.64 20240408_1515(x64) 2024.2.1

I have also posted to the forum here. https://discourse.pyrevitlabs.io/t/cli-booting-2024-when-it-should-be-2023/3084

⌨ Error/Debug Message

I have uninstalled and reinstalled pyRevit. I have uninstalled Revit 2024 and the command worked as expected. When I reinstalled 2024 the problem came back.

♻️ To Reproduce

No response

⏲️ Expected behavior

I expected Revit 2023 to be opened when specifying --revit=2023

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

master | Deploy: "basepublic" | Branch: "master" | Version: "4.8.16.24121+2117" | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master"
==> Attachments
master | Product: "24.2.1" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master"
master | Product: "23.1.3" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master"
master | Product: "2022.1.5" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master"
master | Product: "2021.1.9" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master"
master | Product: "2018.3.3 Security Fix" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master"

Additional context

No response

scubaman120 commented 3 months ago

I also just tried the second from the latest installer and I am getting the same result. pyRevit 4.8.15.24089 Installer

Revit is also installed on a secondary drive (not my c: drive) I am not sure if this could be messing with anything.

sanzoghenzo commented 3 months ago

Hi @scubaman120 , I'm sorry you experienced this problem.

The pyrevit env output doesn't seem complete, can you post all of it? If it is all that it outputs, then there could be some misconfiguration/installation issues.

Also, can you please post the output of the pyrevit run command, and try to run it with the --debug option?

scubaman120 commented 3 months ago

I must not have copied all of it, sorry about that.

pyrevit run "tool.py" "filePath.rvt" --revit=2023 --debug This opened Revit 2023 when I ran it in debug moded. It was quite a long print so I saved it to a txt file and attached it. for this command I picked a random file and clicked and it opened revit 2023 and worked. pyRevit debug_worked.txt

I was surprised so I kept testing and pick my container file that I use when running large batch process and it did not work. specific error: Error: Can not detect the Revit version of model at "c:\xxxx\BatchRvt\Revit2023.rvt". Model might be newer than specified version 2023. (System.Exception)

I have confirmed that this file is 2023. full depug report in below txt. pyRevit debug_failed.txt

I tried to upload the container file that it could not detect the version year but .rvt are not allowed. I will post it to the pyrevit forum page linked in my op in case anyone would like to take a look.

pyrevit env below:

==> 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\SHansen\AppData\Roaming\pyRevit-Master" ==> Attachments master | Product: "Autodesk Revit 2024" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master" master | Product: "23.1.3" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master" master | Product: "2022.1.5" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master" master | Product: "2021.1.9" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master" master | Product: "2018.3.3 Security Fix" | Engine: DEFAULT (2711) | Path: "C:\Users\SHansen\AppData\Roaming\pyRevit-Master" ==> Installed Extensions modelHealth | Type: Unknown | Repo: "" | Installed: "D:\Willow\WIL_Automation Team - General\04_Automation\Revit\PyRevit\Extensions\modelHealth.lib" wilDefinitions | Type: Unknown | Repo: "" | Installed: "D:\Willow\WIL_Automation Team - General\04_Automation\Revit\PyRevit\Extensions\wilDefinitions.lib" Willow_Tools | Type: Unknown | Repo: "" | Installed: "D:\Willow\WIL_Automation Team - General\04_Automation\Revit\PyRevit\Extensions\Willow_Tools.extension" ==> Default Extension Search Path C:\Users\SHansen\AppData\Roaming\pyRevit\Extensions ==> Extension Search Paths D:\Willow\WIL_Automation Team - General\04_Automation\Revit\PyRevit\Extensions ==> Extension Sources - Default https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json ==> Extension Sources - Additional ==> Installed Revits Autodesk Revit 2024 | Version: 24.2.10.64 | Build: 20240408_1515(x64) | Language: 1033 | Path: "D:\Programs\Autodesk\Revit 2024\" 23.1.3 | Version: 23.1.30.97 | Build: 20230828_1515(x64) | Language: 1033 | Path: "D:\Programs\Autodesk\Revit 2023\" 2022.1.5 | Version: 22.1.50.17 | Build: 20230915_1530(x64) | Language: 1033 | Path: "D:\Programs\Autodesk\Revit 2022\" 2021.1.9 | Version: 21.1.90.15 | Build: 20230907_1515(x64) | Language: 1033 | Path: "D:\Programs\Autodesk\Revit 2021\" 2018.3.3 Security Fix | Version: 18.3.3.18 | Build: 20190510_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2018\" ==> Running Revit Instances ==> User Environment Microsoft Windows 10 [Version 10.0.19045] Executing User: RIDLEYCO\SHansen Active User: RIDLEYCO\SHansen Admin Access: No %APPDATA%: "C:\Users\SHansen\AppData\Roaming" Latest Installed .Net Framework: 4.8 No .Net Target Packs are installed. No .Ne-Core Target Packs are installed. pyRevit CLI v4.8.15.24089+0912.f079f5fd51756b988a06d005d4f4cd2961f36e63

scubaman120 commented 3 months ago

The pyRevit forum does not allow for .rvt files either. I changed the file extension to .txt so it will upload. If you want to take a look at it just change the extension back to .rvt. Revit2023.txt

scubaman120 commented 3 months ago

I created a new container file and it seems to be working. The old file opens fine in revit but maybe something got corrupt.

scubaman120 commented 2 months ago

My container file lasted a few days but is now opening again in 2024. How does pyRevit determine the version year? I have a tool that reads the file as text and it still thinks the file is in 2023.

sanzoghenzo commented 3 hours ago

HI @scubaman120, I finally got the time to investigate this.

The version of a revit model is taken form the "Build" information embedded in the file.

These are the helpful lines in the debug log for the failing file:

Debug: Parsing info from BasicFileInfo: "Build: 20220503_1030(x64)"
Debug: Getting host product info for: Build: 20220503_1030(x64)
Debug: Getting data source "C:\Users\SHansen\AppData\Roaming\pyRevit\Cache\pyrevit-hosts.json"

That particular build version is missing from the pyrevit-hosts.json file, this is why it is not detected.

You should be able to make it work by adding that build to the file (and make a PR for everyone to profit, while you're at it :wink: )

The interesting thing is that there is also the "Format" info:

Debug: Parsing info from BasicFileInfo: "Format: 2023"

But it is ignored. @eirannejad is this because the "Format" info is/was not always there, or it is not reliable?