Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strnad@apczbrno46:~$ locale
- LANG=en_US.UTF-8
- LANGUAGE=en_US:en
- LC_CTYPE="en_US.UTF-8"
- LC_NUMERIC="en_US.UTF-8"
- LC_TIME="en_US.UTF-8"
- LC_COLLATE="en_US.UTF-8"
- LC_MONETARY="en_US.UTF-8"
- LC_MESSAGES="en_US.UTF-8"
- LC_PAPER="en_US.UTF-8"
- LC_NAME="en_US.UTF-8"
- LC_ADDRESS="en_US.UTF-8"
- LC_TELEPHONE="en_US.UTF-8"
- LC_MEASUREMENT="en_US.UTF-8"
- LC_IDENTIFICATION="en_US.UTF-8"
- LC_ALL=en_US.UTF-8
- #!/usr/bin/env python3
- # encoding: utf-8
- # Global modules
- import re
- import sys
- import csv
- import os
- import cgi
- import cgitb;cgitb.enable()
- print("Content-Type: text/html") # HTML is following
- print("")
- print ("<html><head></head><body>") # blank line, end of headers
- import locale
- locale.setlocale(locale.LC_ALL, '')
- print (("sys getfilesystemencoding: ") + (sys.getfilesystemencoding()))
- filename = ("Pracovní smlouva.docx")
- try:
- os.remove(filename)
- print ("at least tried to delete")
- except OSError:
- print("File not deleted")
- [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
- [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
- [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
- [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
- [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
- [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
- [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
- [Thu Jul 12 14:10:27.146889 2018] [cgi:error] [pid 1346] [client 10.0.8.37:63831] AH01215: : /var/www/html/test.py
- [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
- [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
- [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
- [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
- [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
- # sys.getfilesystemencoding = lambda: 'UTF-8'
- #import locale
- # locale.setlocale(locale.LC_ALL, 'en_US.utf-8')
- # os.environ["PYTHONIOENCODING"] = "utf-8"
- # locale.setlocale(locale.LC_ALL,'en_US.UTF-8')
- # sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
- # sys.stdout = io.open(sys.stdout.fileno(), 'w', encoding='utf8')
Add Comment
Please, Sign In to add comment