Guest User

Untitled

a guest
Jul 12th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. strnad@apczbrno46:~$ locale
  2. LANG=en_US.UTF-8
  3. LANGUAGE=en_US:en
  4. LC_CTYPE="en_US.UTF-8"
  5. LC_NUMERIC="en_US.UTF-8"
  6. LC_TIME="en_US.UTF-8"
  7. LC_COLLATE="en_US.UTF-8"
  8. LC_MONETARY="en_US.UTF-8"
  9. LC_MESSAGES="en_US.UTF-8"
  10. LC_PAPER="en_US.UTF-8"
  11. LC_NAME="en_US.UTF-8"
  12. LC_ADDRESS="en_US.UTF-8"
  13. LC_TELEPHONE="en_US.UTF-8"
  14. LC_MEASUREMENT="en_US.UTF-8"
  15. LC_IDENTIFICATION="en_US.UTF-8"
  16. LC_ALL=en_US.UTF-8
  17.  
  18. #!/usr/bin/env python3
  19. # encoding: utf-8
  20. # Global modules
  21. import re
  22. import sys
  23. import csv
  24. import os
  25. import cgi
  26. import cgitb;cgitb.enable()
  27.  
  28.  
  29. print("Content-Type: text/html") # HTML is following
  30. print("")
  31. print ("<html><head></head><body>") # blank line, end of headers
  32.  
  33. import locale
  34. locale.setlocale(locale.LC_ALL, '')
  35. print (("sys getfilesystemencoding: ") + (sys.getfilesystemencoding()))
  36.  
  37. filename = ("Pracovní smlouva.docx")
  38.  
  39. try:
  40. os.remove(filename)
  41. print ("at least tried to delete")
  42. except OSError:
  43. print("File not deleted")
  44.  
  45. [Thu Jul 12 14:10:27.145862 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: Error in sys.excepthook:: /var/www/html/test.py
  46. [Thu Jul 12 14:10:27.146065 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: Traceback (most recent call last):: /var/www/html/test.py
  47. [Thu Jul 12 14:10:27.146226 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: File "/usr/lib/python3.5/cgitb.py", line 268, in __call__: /var/www/html/test.py
  48. [Thu Jul 12 14:10:27.146333 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: self.handle((etype, evalue, etb)): /var/www/html/test.py
  49. [Thu Jul 12 14:10:27.146488 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: File "/usr/lib/python3.5/cgitb.py", line 288, in handle: /var/www/html/test.py
  50. [Thu Jul 12 14:10:27.146578 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: self.file.write(doc + '\n'): /var/www/html/test.py
  51. [Thu Jul 12 14:10:27.146855 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: UnicodeEncodeError: 'ascii' codec can't encode character '\xed' in position 1724: ordinal not in range(128): /var/www/html/test.py
  52. [Thu Jul 12 14:10:27.146889 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: : /var/www/html/test.py
  53. [Thu Jul 12 14:10:27.146960 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: Original exception was:: /var/www/html/test.py
  54. [Thu Jul 12 14:10:27.147057 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: Traceback (most recent call last):: /var/www/html/test.py
  55. [Thu Jul 12 14:10:27.147199 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: File "/var/www/html/test.py", line 28, in <module>: /var/www/html/test.py
  56. [Thu Jul 12 14:10:27.147269 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: os.remove(filename): /var/www/html/test.py
  57. [Thu Jul 12 14:10:27.147540 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: UnicodeEncodeError: 'ascii' codec can't encode character '\xed' in position 7: ordinal not in range(128): /var/www/html/test.py
  58.  
  59. # sys.getfilesystemencoding = lambda: 'UTF-8'
  60. #import locale
  61. # locale.setlocale(locale.LC_ALL, 'en_US.utf-8')
  62. # os.environ["PYTHONIOENCODING"] = "utf-8"
  63. # locale.setlocale(locale.LC_ALL,'en_US.UTF-8')
  64. # sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
  65. # sys.stdout = io.open(sys.stdout.fileno(), 'w', encoding='utf8')
Add Comment
Please, Sign In to add comment