File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -310,15 +310,18 @@ def setUp(self):
310310 else :
311311 self .pythonexe = sys .executable
312312
313+ try :
314+ # The python executable path is written as the first line of the
315+ # CGI Python script. The encoding cookie cannot be used, and so the
316+ # path should be encodable to the default script encoding (utf-8)
317+ self .pythonexe .encode ('utf-8' )
318+ except UnicodeEncodeError :
319+ self .tearDown ()
320+ raise self .skipTest (
321+ "Python executable path is not encodable to utf-8" )
322+
313323 self .file1_path = os .path .join (self .cgi_dir , 'file1.py' )
314324 with open (self .file1_path , 'w' ) as file1 :
315- try :
316- self .pythonexe .encode (file1 .encoding )
317- except UnicodeEncodeError :
318- self .tearDown ()
319- raise self .skipTest (
320- "Python executable path is not encodable to %s"
321- % file1 .encoding )
322325 file1 .write (cgi_file1 % self .pythonexe )
323326 os .chmod (self .file1_path , 0o777 )
324327
You can’t perform that action at this time.
0 commit comments