files.py failing when run via browser while properly executed via terminal

  • Thread starter Íéêüëáïò Êïýñáò
  • Start date
Í

Íéêüëáïò Êïýñáò

(e-mail address removed) [~/www/cgi-bin]#
(e-mail address removed) [~/www/cgi-bin]# python
Python 3.3.2 (default, Jun 3 2013, 16:18:05)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.Okey after compiling from source python 3.3.2 and 'easy_install pymysql' now i'm receiving this error whiuch prohibit my files.py script to run.

=====================================
(e-mail address removed) [~/www/cgi-bin]# python files.py
Error in sys.excepthook:
ValueError: underlying buffer has been detached

Original exception was:
Traceback (most recent call last):
File "/usr/local/lib/python3.3/os.py", line 673, in __getitem__
value = self._data[self.encodekey(key)]
KeyError: b'REMOTE_ADDR'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "files.py", line 17, in <module>
host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
File "/usr/local/lib/python3.3/os.py", line 676, in __getitem__
raise KeyError(key)
KeyError: 'REMOTE_ADDR'
(e-mail address removed) [~/www/cgi-bin]#
=====================================

host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]

Is not the proeblem here becaus ei ahve the exact same statemnt inside metriets.py and pelatologio.py and they dont provide me an error.

If i run the script from chrome as http://superhost.gr/cgi-bin/files.py
i get na internal server error.

But since it complained i switched the above host to host = "nikos"

then run python files.py and it compiled properly with no error
but via browser i receive internal server error agian.

So since the script interprets okey i decided to tail the error log to see the live error messages when i call it via browser:

(e-mail address removed) [~/www/cgi-bin]# tail -F /usr/local/apache/logs/error_log &


[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Error in sys.excepthook:
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] ValueError: underlying buffer has been detached
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59]
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Original exception was:
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Traceback (most recent call last):
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] File "files.py", line 67, in <module>
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) )
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] query = query.encode(charset)
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcce' in position 61: surrogates not allowed
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] Premature end of script headers: files.py
[Tue Jun 04 13:02:37 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml

I tried anything i can think of, hti sis beyond me, so please shed some light.
Thank you.
 
Í

Íéêüëáïò Êïýñáò

i tried somehtign else too.

uploaded 1.mp3 and 1.exe from windows 8 via FileZilla to linux webhost

and then renamed them both to Greek letters so that the renaming take place from within the CentOS and after that i tried:

http://superhost.gr/cgi-bin/files.py

Guess what? Still same error :(

[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Error in sys.excepthook:
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] ValueError: underlying buffer has been detached
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59]
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Original exception was:
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Traceback (most recent call last):
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] File "files.py", line 67, in <module>
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] cur.execute('''SELECT url FROM files WHERE url = %s''', (fullpath,) )
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] File "/usr/local/lib/python3.3/site-packages/PyMySQL3-0.5-py3.3.egg/pymysql/cursors.py", line 108, in execute
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] query = query.encode(charset)
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] UnicodeEncodeError: 'utf-8' codec can't encode character '\\udcd3' in position 61: surrogates not allowed
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] Premature end of script headers: files.py
[Tue Jun 04 14:21:05 2013] [error] [client 46.12.95.59] File does not exist: /home/nikos/public_html/500.shtml


What the hell is it with these Greek filenames, why everyhting breaks?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top