带 FTP 的虚拟文件系统
我一直在从这里阅读Python中的文件系统文档: http://packages.python.org/fs/filesystems.html
花时间之后通读它并进行一些谷歌搜索,我没有完全找到我正在寻找的答案。我想知道是否可以使用 Python 实现这一点,并避免 Windows 上的任何 UAC 问题,如果您可以在 Windows 资源管理器内“挂载”或显示来自 FTP 服务器的免费文件,以供任何其他应用程序读取。
这可能吗?实现这一目标的最佳方法是什么?提前致谢!
I've been reading through the FileSystem documentation in Python from here:
http://packages.python.org/fs/filesystems.html
After taking the time to read through it and a bit of Google-ing I didn't quite find the answer I was looking for. I was wondering if it was possible with Python, and avoiding any UAC issues on Windows, if you could 'mount' or display a file free from an FTP server inside Windows Explorer for any other applications to -read- from.
Is something this possible? What's the best approach to achieve it? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Windows 资源管理器内置了对 FTP 的支持,说明此处有屏幕截图。
您甚至可以从标准的“文件”对话框中使用它。够了吗?
[更新]
@AndréCaron:我认为支持带有 SSL 的 WebDAV,但不支持 SFTP 或 FTPS。有诸如 Swish (开源)或 Expandrive(付费软件)。
Windows explorer has built-in support for FTP, instructions with screenshots here.
You can even use it from the standard "file" dialog box. Is it enough?
[update]
@AndréCaron: I think WebDAV with SSL is supported, but no native support for SFTP or FTPS. There are extensions like Swish (opensource) or Expandrive (payware).
这是一个不平凡的问题,据我所知,不存在通过一些神奇的 python 代码行提供操作系统级功能的事情。
模拟您的意图的一个可能的解决方案是创建一个本地 webdav 代理,它映射到 ftp 服务器。我知道有一个功能可以将 webdav 网络设备连接到本地驱动器盘符,但是因为我上次接触 Windows 系统是...... - 我什至不记得 - 我无法告诉你如果你也可以通过这种方式直接附加 ftp 资源。
我想从短期来看,寻找Python级别的解决方案可能不会有成效,即使在中/长期,如果你不进行大量修改也是不可能的。
This is a non-trivial matter and afaik there exist not such a thing as provide os-level functionality through some lines of magical python code.
A possible solution to emulate your intention could be to create a local webdav proxy, which maps to the ftp-server. I know there exists a feature to attach a webdav-network device to a local drive-letter, but because the last time i touched a windows system was ... - i can't even remember - i can't tell you if you might also attach a ftp-resource this way directly.
I guess looking for a solution on a python level might not be productive in a short-term perspective and even on mid/long-term's not possible without heavy tinkering on your side.
虽然本身不是“文件系统”,但您可以提供 Windows 资源管理器命名空间扩展 这将允许 Windows 资源管理器浏览任何虚拟文件系统。例如,这用于实现 ZIP 档案的浏览。请注意,这不提供真正的文件系统驱动器,因此它不允许您使用常规文件 I/O 函数打开此命名空间扩展的内容。
命名空间扩展是用 COM 编写的,可以用 Python 实现 COM 接口。
AFAIK,您唯一需要的权限是安装命名空间扩展(COM DLL,加上命名空间注册)。其他一切都在登录用户的上下文中运行,不需要特殊权限。
While not a "filesystem" per-se, you can provide a Windows Explorer Namespace Extension which will allow the Windows explorer to browse any virtual file-system. This is used to implement browsing of ZIP archives, for example. Note that this does not provide a real file system drive, so it will not allow you to open the contents of this namespace extension using regular file I/O functions.
The namespace extensions are written in COM, and it is possible to implement COM interfaces in Python.
AFAIK, the only permissions you need are for installing of the namespace extension (the COM DLL, plus the namespace registration). Everything else runs in the logged-in user's context and requires no special permissions.