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

Investigate wx.FileSystemHandler issue #926

Closed
RobinD42 opened this Issue Jul 16, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@RobinD42
Copy link
Member

RobinD42 commented Jul 16, 2018

Operating system: Mac & Linux
wxPython version: 4.0.1
Stock or custom build: stock
Python version: 3.6
Stock or custom build: any

Description of the problem:

https://groups.google.com/d/msg/wxpython-dev/55_nm9Y-b7w/-tASD44PBAAJ

from io import BytesIO
import wx

class MyFileSystemHandler(wx.FileSystemHandler):

    def CanOpen(self, location):
        return True

    def OpenFile(self, fs, location):
        print('OpenFile:', location)
        fsfile = wx.FSFile(BytesIO(b'hello'), location,
                          'text/plain', '', wx.DateTime.Now())
        stream = fsfile.GetStream()
        assert stream.IsOk()
        return fsfile

app = wx.App(False)
wx.FileSystem.AddHandler(MyFileSystemHandler())

hello_file = wx.FileSystem().OpenFile('myprot:hello', wx.FS_READ)
print(hello_file.GetStream().read())
@RobinD42

This comment has been minimized.

Copy link
Member

RobinD42 commented Oct 4, 2018

Fixed by #1027

@RobinD42 RobinD42 closed this Oct 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment