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

IPY340 MWrite.pushbutton pickle module TypeError #1704

Closed
nodatasheet opened this issue Jan 17, 2023 · 2 comments · Fixed by #1765
Closed

IPY340 MWrite.pushbutton pickle module TypeError #1704

nodatasheet opened this issue Jan 17, 2023 · 2 comments · Fixed by #1765
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] IronPython Issues related to standalone IronPython installation [subsystem]

Comments

@nodatasheet
Copy link
Contributor

nodatasheet commented Jan 17, 2023

Describe the bug
With IronPython 3.4 engine pressing on MWrite.pushbutton, MRead.pushbutton or MAppend.pushbutton rises TypeError: must be unicode, not bytes

Error traceback
IronPython Traceback:
Traceback (most recent call last):
 File "C:\Users\Konstantin\AppData\Roaming\pyRevit\pyRevit\develop\extensions\pyRevitTools.extension\pyRevit.tab\Selection.panel\mema.stack\MWrite.pushbutton\script.py", line 13, in <module>
 File "pickle.py", line 1538, in _dump
 File "pickle.py", line 409, in dump
 File "pickle.py", line 216, in write
TypeError: must be unicode, not bytes
<...>

To Reproduce
Steps to reproduce the behavior:

  1. Select elements in Revit
  2. Click on MWrite push button
  3. See error

Expected behavior
Add current selection to memory

Screenshots
no

Desktop (please complete the following information):

  • OS: Windows 11

  • pyRevit Version 4.8.13:16d0938

  • pyRevit Environment:

    pyrevit env
    ==> Registered Clones (full git repos)
    develop | Branch: "develop" | Version: "4.8.13:16d0938" | Path: "C:\Users\Konstantin\AppData\Roaming\pyRevit\pyRevit\develop"
    master | Branch: "master" | Version: "4.8.12.22247+0031:b7704ea" | Path: "C:\Users\Konstantin\AppData\Roaming\pyRevit\pyRevit\master"
    ==> Registered Clones (deployed from archive/image)
    ==> Attachments
    develop | Product: "Autodesk Revit 2023" | Engine: IPY340PR (340) | Path: "C:\Users\Konstantin\AppData\Roaming\pyRevit\pyRevit\develop"
    develop | Product: "Autodesk Revit 2022" | Engine: IPY340PR (340) | Path: "C:\Users\Konstantin\AppData\Roaming\pyRevit\pyRevit\develop"
    ==> Installed Extensions
    pyKostik | Type: Unknown | Repo: "" | Installed: "...\pyKostik\pyKostik.extension"
    ==> Default Extension Search Path
    C:\Users\Konstantin\AppData\Roaming\pyRevit\Extensions
    ==> Extension Search Paths
    ...\pyKostik
    ==> Extension Sources - Default
    https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json
    ==> Extension Sources - Additional
    ==> Installed Revits
    Autodesk Revit 2023 | Version: 23.1.10.4 | Build: 20221122_1550(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2023\"
    Autodesk Revit 2022 | Version: 22.1.30.34 | Build: 20220520_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2022\"
    ==> Running Revit Instances
    Error: Object reference not set to an instance of an object.
    Run with "--debug" option to see debug messages

Additional context
I assume the reason is that in Python 3, binary modes 'wb' and 'rb' must be specified during the open operation.

Changing 'w', 'r' to 'wb', 'rb' in MWrite.pushbutton, MRead.pushbutton and MAppend.pushbutton solved the issue for me.

@eirannejad eirannejad added Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] IronPython Issues related to standalone IronPython installation [subsystem] labels Jan 17, 2023
@thumDer
Copy link
Contributor

thumDer commented Mar 18, 2023

How about making a PR for this one too? It would be appreciated ❤️
And thanks for checking these!

@nodatasheet nodatasheet mentioned this issue Mar 21, 2023
@jmcouffin jmcouffin linked a pull request May 2, 2023 that will close this issue
@jmcouffin
Copy link
Contributor

Fixed by #1765
Thanks @nodatasheet

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] IronPython Issues related to standalone IronPython installation [subsystem]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants