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

plyer.filechooser.save_file doesn't work on macOS X Catalina #578

Closed
Python3-8 opened this issue Aug 12, 2020 · 2 comments
Closed

plyer.filechooser.save_file doesn't work on macOS X Catalina #578

Python3-8 opened this issue Aug 12, 2020 · 2 comments

Comments

@Python3-8
Copy link

plyer.filechooser.save_file not working

Here's my code:

>>> from plyer import filechooser
>>> filechooser.save_file()

filechooser.choose_dir() and filechooser.open_file() work fine, but filechooser.save_file() throws an error.

Here's the error:

2020-08-12 18:27:32.088 Python[64278:918233] *** Assertion failure in +[NSServiceViewController currentAppIsViewService], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/ViewBridge/ViewBridge-464.1/NSViewService.m:140
2020-08-12 18:27:32.135 Python[64278:918233] *** Assertion failure in +[NSServiceViewController currentAppIsViewService], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/ViewBridge/ViewBridge-464.1/NSViewService.m:140
2020-08-12 18:27:32.737 Python[64278:918666] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/plyer/facades/filechooser.py", line 57, in save_file
    return self._file_selection_dialog(mode="save", *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/plyer/platforms/macosx/filechooser.py", line 119, in _file_selection_dialog
    return MacFileChooser(**kwargs).run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/plyer/platforms/macosx/filechooser.py", line 63, in run
    panel.setCanCreateDirectories_(True)
AttributeError: 'NoneType' object has no attribute 'setCanCreateDirectories_'

Then a while later there's this dialog saying 'Python quit unexpectedly.'

Can someone please tell me what's wrong?

@Python3-8 Python3-8 changed the title plyer.filechooser.save_file not working plyer.filechooser.save_file doesn't work on macOS X Catalina Aug 14, 2020
@ElliotGarbus
Copy link

I am experiencing a similar issue. My app works correctly on MacOS Mojave.

Here is the error when attempting to save on Catalina:

2020-10-11 17:56:12.400 python[3204:53237] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[NSOpenPanel setCanChooseDirectories:]: unrecognized (NSOpenPanel) selector sent to instance 0x7fc241f951d0.  This sandboxed application's NSSavePanel class object only responds to NSSavePanel APIs!  Please use the interface as described in NSSavePanel.h.'
*** First throw call stack:
(
        0   CoreFoundation                      0x00007fff3750bb57 __exceptionPreprocess + 250
        1   libobjc.A.dylib                     0x00007fff701be5bf objc_exception_throw + 48
        2   CoreFoundation                      0x00007fff3750b9b5 +[NSException raise:format:] + 189
        3   AppKit                              0x00007fff350f9e16 -[NSSavePanel setCanChooseDirectories:] + 164
        4   libffi.dylib                        0x00007fff6f108905 ffi_call_unix64 + 85
        5   ???                                 0x00007fc23faf0800 0x0 + 140472268818432
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

Here is the call to save:

            filechooser.save_file(path=self.path,
                                  title='Save the Patch',
                                  on_selection=self._save_selection)

@Python3-8
Copy link
Author

I have Mojave on another partition of my HDD. Maybe I could get it to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants