I have a Python script which generates a bunch of files with various Unicode filenames for testing purposes. It works fine on OS X and Linux environments. On Windows (and more importantly AppVeyor) it fails to create some files, complaining about an invalid filename. Here is a very minimal version:
with open("\x01", "w") as f: f.write("foo")
The error I get is:
Traceback (most recent call last): File "genTestRes.py", line 51, in <module> os.mkdir(os.path.join(TESTDIR, data)) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'test-res\\\x01'
I can reproduce the CI failure locally on a Windows machine with the minimal script above, on an NTFS disk, with Python 2.7. None of these helped:
# -*- coding: utf-8 -*-at the beginning
chcp 65001before the command
- using the Unicode prefix (
According to Wikipedia, NTFS should support at least
In Win32 namespace: any UTF-16 code unit (case-insensitive) except /:*"?<>| as well as NUL
What could be causing this?
U+0001 should be a perfectly fine, if unprintable, codepoint. Is Wikipedia simply wrong here?
In Windows, NTFS filenames cannot contain the ASCII control characters 0x01 - 0x1F. See Naming Files, Paths, and Namespaces. This rule applies to all of Microsoft's filesystems, though not necessarily to third-party filesystems. For example, the VirtualBox shared-folder filesystem allows control characters, colon, and pipe in filenames.
- Is there a way to get the subscriber count of two particular users of youtube from their beginning of career to the most recent possible?
- Pytorch argsort ordered, with duplicate elements in the tensor
- How I can I lazily read multiple JSON values from a file/stream in Python?
- Pytorch argsort ordered
- Print series of number every 50
- Selecting multiple columns in a pandas dataframe
- FancyImpute installation in Anaconda
- Simplifying a pair of if-else statements around a Flask SqlAlchemy query
- Finding a key recursively in a dictionary
- Convert UUID 32-character hex string into a “YouTube-style” short id and back