This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jkloth
Recipients ezio.melotti, jkloth, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2018-09-10.01:57:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536544680.03.0.56676864532.issue34618@psf.upfronthosting.co.za>
In-reply-to
Content
When running Python via subprocess with captured output an encoding error occurs attempting to output a Unicode filename.  The same does not happen when just using spawnl().

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, sys, subprocess
>>> sys.stdout.encoding, sys.stdout.errors
('utf-8', 'surrogateescape')
>>> args = ['-u', '-c', "print('taqdir\\\u0634\u0645\u0627\u0631.py')"]
>>> os.spawnl(os.P_WAIT, sys.executable, '"%s"' % sys.executable, *args)
taqdir\شمار.py
0
>>> subprocess.run([sys.executable, *args], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
CompletedProcess(args=['C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\python.exe', '-u', '-c', "print('taqdir\\شمار.py')"], returncode=1, stdout=b'Traceback (most recent call last):\r\n  File "<string>", line 1, in <module>\r\n  File "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\lib\\encodings\\cp1252.py", line 19, in encode\r\n    return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r\nUnicodeEncodeError: \'charmap\' codec can\'t encode characters in position 7-10: character maps to <undefined>\r\n')
History
Date User Action Args
2018-09-10 01:58:00jklothsetrecipients: + jkloth, paul.moore, vstinner, tim.golden, ezio.melotti, zach.ware, steve.dower
2018-09-10 01:58:00jklothsetmessageid: <1536544680.03.0.56676864532.issue34618@psf.upfronthosting.co.za>
2018-09-10 01:57:59jklothlinkissue34618 messages
2018-09-10 01:57:58jklothcreate