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]: ERROR [pyrevit.userconfig] Can not save user config. No data is available for encoding 0. #2583

Closed
5 tasks done
zsenarchitect opened this issue Feb 18, 2025 · 9 comments
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class]

Comments

@zsenarchitect
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

a custom extension folder I have pointed to Revit 2024 and before, all fine.
same extension folder pointed to Revit 2025, generate error message below.
After this message show, the extension will still load but cannot stick after Revit closure and re-open. It also causes the Revit 2024 custom folder extension to detach.
I opened the pyRevit_config.ini in text editor and it show total empty file.
address for customized extension folder : C:\Users\szhang\design-repo\EnneadTab-OS\Apps_revit (but again this same address has not caused any problem in any pre-2025 Revit version)

pyrevit version: 5.0.0.25015+1357-wip:2712:2025.4

⌨ Error/Debug Message

ERROR [pyrevit.userconfig] Can not save user config to: C:\Users\szhang\AppData\Roaming\pyRevit\pyRevit_config.ini | No data is available for encoding 0. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

♻️ To Reproduce

  1. at pyrevit setting, go to Custom Extension Directories
  2. add folder
  3. save setting and reload
  4. error msg show

error msg only show in 2025 version. Fine in all previous Revit version.

other attempt to isolate problem:

  • i made a dummy extension for test purpose, there is no real script, just pyrevit folder structures.(.extension, .tab, .pushbutton, etc). Pyrevit can save config file as expected. When i slowly copy original content to dummy extension, the error show. So I can narrow down to some part of the production script not being compatible. Could be mine, could be pyrevit, could be other ironpython lib (one suspect being "traceback", which I have noticed causing issue for rhino 7>8 script migration). The problem is since config become empty and pyrevit ini failed, i cannot see any fallback exception of the root cause.

⏲️ Expected behavior

save pyrevit_config.ini successfully,
if there are backward compatible issue with the new Revit 2025, output issue, but preserve the previous version of pyrevit_config.ini.

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

==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive/image)
==> Attachments
Unknown | Product: "Autodesk Revit 2025" | Manifest: "C:\ProgramData\Autodesk\Revit\Addins\2025\pyRevit.addin"
Unknown | Product: "2024.3" | Manifest: "C:\ProgramData\Autodesk\Revit\Addins\2024\pyRevit.addin"
Unknown | Product: "23.1.3" | Manifest: "C:\ProgramData\Autodesk\Revit\Addins\2023\pyRevit.addin"
==> Installed Extensions
==> Default Extension Search Path
C:\Users\szhang\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
==> Extension Sources - Default
https://github.com/pyrevitlabs/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
Autodesk Revit 2025 | Version: 25.0.2.419 | Build: 20240307_1300(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2025\"
2024.3 | Version: 24.3.0.13 | Build: 20240912_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2024\"
23.1.3 | Version: 23.1.30.97 | Build: 20230828_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2023\"
==> Running Revit Instances
PID: 22444 | 2025.4 | Version: 25.4.0.32 | Build: 20241202_1040(x64) | Language: 0 | Path: "C:\Program Files\Autodesk\Revit 2025"
PID: 13764 | 2024.3 | Version: 24.3.0.13 | Build: 20240912_1515(x64) | Language: 0 | Path: "C:\Program Files\Autodesk\Revit 2024"
==> User Environment
Microsoft Windows 10 [Version 10.0.26100]
Executing User: EA\szhang
Active User: EA\szhang
Admin Access: No
%APPDATA%: "C:\Users\szhang\AppData\Roaming"
Latest Installed .Net Framework: 8.0.12
No .Net Target Packs are installed.
No .Net-Core Target Packs are installed.
pyRevit CLI v5.0.0.25015+1357-wip.67623b5b3151e67525bf0514e7775d3c30754bc1

Additional context

Love the pyrevit community, appreciate the big push for pyrevit 5! You brought fire to humanity!

@zsenarchitect zsenarchitect added the Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] label Feb 18, 2025
@sanzoghenzo
Copy link
Contributor

You environment log doesn't list any clone registered... did you install the admin version?

@zsenarchitect
Copy link
Author

not sure how to answer that, the pyrevit is setup by IT.
what can i do to get answer for you?

@sanzoghenzo
Copy link
Contributor

sanzoghenzo commented Feb 19, 2025

pyrevit is setup by IT.

Ok, so it is an admin install, but I realized that the strange output I noticed is in line with the config file being empty, so let's not worry about that 😉

  • When i slowly copy original content to dummy extension, the error show. So I can narrow down to some part of the production script not being compatible.

I only now noticed this part. Did you figure out which is the script that caused the issue? Can you share it? This will greatly increase the chance to spot the cause and solve the problem.
Does it by any chance use the userconfig module?
EDIT: sorry, it was in the title 😅 we definitely need to see your code to understand what's going wrong

@sanzoghenzo sanzoghenzo added the needs-more-info Issue required to follow the bug report template. Triggered by the stale issue workflow label Feb 19, 2025
@zsenarchitect
Copy link
Author

Does it by any chance use the userconfig module?

This is a good clue, I used to have a func in the xxx_startup.py for initiation

from pyrevit.userconfig import user_config
user_config.check_updates = True
user_config.save_changes()

no issue before rvt 2025 for years.
If I disable this part for rvt 2025, it will process further and give me new error info, see below. Revit 2025 will crash shortly after.

Image

interestingly, there is no [xxx.smartbutton] type button in the DuckMaker.extension. But based on the first line of error message, it encounter issue when checking that state.

Will this be helpful information?

@github-actions github-actions bot removed the needs-more-info Issue required to follow the bug report template. Triggered by the stale issue workflow label Feb 20, 2025
@sanzoghenzo
Copy link
Contributor

From these new errors, I suspect there's something missing in the installation, not sure if it's an oversight on our part diring the packaging, or a problem in the installation procedure used by your IT.

I kindly ask you (to ask your IT) to update to the version 5.0.1 to see if this was just a problem in the files signature (I don't believe it is, but it doesn't hurt to try 😉) uninstall the previous version and remove all the pyrevit paths (see the troubleshooting guide above) before installing the new release to make sure there's no interference from leftovers.

@zsenarchitect
Copy link
Author

zsenarchitect commented Feb 20, 2025

Exception Type: <type 'exceptions.SystemError'> 
Exception Message: No data is available for encoding 0. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\lib\EnneadTab\ERROR_HANDLE.py, Line: 40 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\_revit\EnneaDuck.extension\Ennead_startup.py, Line: 305 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\lib\EnneadTab\DOCUMENTATION.py, Line: 495 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\lib\EnneadTab\DOCUMENTATION.py, Line: 264 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\lib\EnneadTab\DOCUMENTATION.py, Line: 177 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\lib\EnneadTab\DOCUMENTATION.py, Line: 226 
File: traceback.py, Line: 242 
File: traceback.py, Line: 141 
File: traceback.py, Line: 76 
File: traceback.py, Line: 101 
File: linecache.py, Line: 14 
File: linecache.py, Line: 41 
File: linecache.py, Line: 131

more digging. I am able to recreate this issue, which might be related to the "encoding 0 topic". I mentioned earlier in the original post that the "traceback" module often does not work as expected in Rhino 8 and Revit 2025, compared to any previous version.

still using 5.0.0.25015+1357-wip:2712:2025.4

@zsenarchitect
Copy link
Author

Exception Type: <type 'exceptions.SystemError'> 
Exception Message: No data is available for encoding 0. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\lib\EnneadTab\ERROR_HANDLE.py, Line: 40 
File: C:\Users\szhang\design-repo\EnneadTab-OS\Apps\_revit\EnneaDuck.extension\Ennead.tab\Resource.panel\reload.splitbutton\reload_enneadtab.pushbutton\reload_enneadtab_script.py, Line: 19 
File: C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\loader\sessionmgr.py, Line: 324 
File: C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\loader\sessionmgr.py, Line: 282 
File: C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\loader\sessionmgr.py, Line: 132 
File: C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\telemetry\__init__.py, Line: 313 
File: C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\userconfig.py, Line: 748 
File: logging\__init__.py, Line: 1200 
File: C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\coreutils\logger.py, Line: 123 
File: logging\__init__.py, Line: 1293 
File: logging\__init__.py, Line: 1303 
File: C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\coreutils\logger.py, Line: 132 
File: logging\__init__.py, Line: 766 
File: logging\__init__.py, Line: 963 
File: logging\__init__.py, Line: 950

finding more ways to break pyrevit, this time it is the logger

@sanzoghenzo sanzoghenzo added the needs-more-info Issue required to follow the bug report template. Triggered by the stale issue workflow label Feb 25, 2025
@sanzoghenzo
Copy link
Contributor

I reiterate my request, your installation seems broken...

I kindly ask you (to ask your IT) to update to the version 5.0.1 to see if this was just a problem in the files signature (I don't believe it is, but it doesn't hurt to try 😉) uninstall the previous version and remove all the pyrevit paths (see the troubleshooting guide above) before installing the new release to make sure there's no interference from leftovers.

@zsenarchitect
Copy link
Author

5.0.1 works! No more issues!

@github-actions github-actions bot removed the needs-more-info Issue required to follow the bug report template. Triggered by the stale issue workflow label Mar 13, 2025
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

2 participants