这些文件存储在NFS驱动器上,因此我们可以在Windows 7中看到它,但无法打开它们.
有没有人有一个解决方法,如何使用Python在Windows 7中读取包含冒号的JSON文件?我们有一个可能的解决方法(我们想避免)是通过SSH连接到Linux机箱,回显内容并将其发回.
显然,如果其他人有另一种方法会很棒. Windows XP能够打开它们并且读得很好 – 这只是Win 7的一个问题.
-edit-更新:我们发现我们可以通过网络访问我们的NFS / AFS服务器.所以我们最终使用urllib2 urlopen来处理包含无效字符的所有JSON文件.到目前为止似乎运作良好.
Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system,however,is different. For example,a UNIX file name can use a colon (:),but a Windows file name cannot use a colon (:). …
To enable file name character mapping,create a character translation file and add a registry entry.
For example,the following maps the UNIX colon (:) to a Windows dash (-):
0x3a : 0x2d ; replace client : with – on server
When you have created the file name character translation file,you must specify its name location in the system registry. To register the path and name of the file:
- Use Registry Editor to locate the following registry key:
- HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
- Edit the CharacterTranslation (REG_SZ) value.
- Enter the fully qualified path name of the file name character translation file. For example,C:\Sfu\CTrans.txt.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。