Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'skip:[ 20': 0.04; 'syntax': 0.04; 'messages.': 0.05; 'root': 0.05; 'subject:Python': 0.06; 'debugging': 0.07; 'python3': 0.07; 'restarting': 0.07; 'exec': 0.09; 'hooks': 0.09; 'missing)': 0.09; 'restart': 0.09; 'to:addr:comp.lang.python': 0.09; 'wrapper': 0.09; 'runs': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'apache': 0.15; 'damage.': 0.16; 'name).': 0.16; 'simpson': 0.16; 'skip:[ 30': 0.16; 'stderr': 0.16; 'subject:Unicode': 0.16; 'subject:issue': 0.16; 'syntaxerror:': 0.16; 'too?': 0.16; 'wrote:': 0.18; 'command': 0.22; 'cc:addr:gmail.com': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'header:User-Agent:1': 0.23; 'error': 0.23; 'script.': 0.24; 'cheers,': 0.24; 'file.': 0.24; '(or': 0.24; 'environment': 0.24; 'sort': 0.25; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'appear': 0.29; 'change,': 0.30; 'along': 0.30; '(which': 0.31; 'cgi': 0.31; 'gather': 0.31; 'file': 0.32; 'there.': 0.32; 'probably': 0.32; 'stuff': 0.32; 'supposed': 0.32; 'run': 0.32; 'another': 0.32; 'open': 0.33; 'running': 0.33; 'cc:no real name:2**1': 0.33; 'subject:with': 0.35; 'no,': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'should': 0.36; 'too': 0.37; 'server': 0.38; 'feed': 0.38; 'writes': 0.38; 'anything': 0.39; 'days': 0.60; 'even': 0.60; 'money.': 0.60; 'skip:2 20': 0.60; 'most': 0.60; 'from:no real name:2**0': 0.61; 'browser': 0.61; 'further': 0.61; 'you.': 0.62; 'here:': 0.62; 'email addr:gmail.com': 0.63; 'such': 0.63; 'visit': 0.64; 'provide': 0.64; 'invalid': 0.68; 'line,': 0.68; 'prompt': 0.68; 'said:': 0.68; '8bit%:92': 0.71; '8bit%:100': 0.72; 'touch': 0.74; 'browser.': 0.78; 'account.': 0.80; 'env': 0.84; 'skip:/ 30': 0.84; 'yourself..': 0.84; '6.4': 0.91; 'lord': 0.91; 'anymore,': 0.95; '2013': 0.98 X-Received: by 10.49.61.234 with SMTP id t10mr1331509qer.16.1365938569649; Sun, 14 Apr 2013 04:22:49 -0700 (PDT) Newsgroups: comp.lang.python Date: Sun, 14 Apr 2013 04:22:49 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.68.88.82; posting-account=hGu1uQoAAACZy7LiR653nG0NwqDrTyoS References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 94.68.88.82 MIME-Version: 1.0 Subject: Re: Unicode issue with Python v3.3 From: nagia.retsina@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: nagia.retsina@gmail.com, python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 198 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365938578 news.xs4all.nl 2709 [2001:888:2000:d::a6]:34040 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43570 =CE=A4=CE=B7 =CE=9A=CF=85=CF=81=CE=B9=CE=B1=CE=BA=CE=AE, 14 =CE=91=CF=80=CF= =81=CE=B9=CE=BB=CE=AF=CE=BF=CF=85 2013 12:28:32 =CE=BC.=CE=BC. UTC+3, =CE= =BF =CF=87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Cameron Simpson =CE=AD=CE=B3= =CF=81=CE=B1=CF=88=CE=B5: > On 13Apr2013 23:00, nagia.retsina@gmail.com wro= te: >=20 > | root@nikos [/home/nikos/public_html/foo-py]# pwd >=20 > | /home/nikos/public_html/foo-py >=20 > | root@nikos [/home/nikos/public_html/foo-py]# cat foo.py=20 >=20 > | #!/bin/sh >=20 > | exec 2>>/home/nikos/cgi.err.out >=20 > | echo "$0 $*" >&2 >=20 > | id >&2 >=20 > | env | sort >&2 >=20 > | set -x >=20 > | exec /full/path/to/foo-py ${1+"$@"} >=20 > |=20 >=20 > | root@nikos [/home/nikos/public_html/foo-py]# python3 foo.py=20 >=20 > | File "foo.py", line 2 >=20 > | exec 2>>/home/nikos/cgi.err.out >=20 > | ^ >=20 > | SyntaxError: invalid syntax >=20 >=20 >=20 > That is because foo.py isn't a python script anymore, it is a shell scrip= t. >=20 > Its purpose is to divert stderr to a file and to recite various >=20 > things about the environment to that file in addition to any error >=20 > messages. >=20 >=20 >=20 > Just run it directly: >=20 >=20 >=20 > ./foo.py >=20 >=20 >=20 > The #! line should cause it to be run by the shell. >=20 >=20 >=20 > I also recommend you try to do all this as your normal user account. >=20 > Root is for administration, such as stopping/starting apache and >=20 > so on. Not test running scripts from the command line; consider: >=20 > if the script has bugs, as root it can do an awful lot of damage. >=20 >=20 >=20 > | root@nikos [/home/nikos/public_html/foo-py]#=20 >=20 > | As far as thr tail -f of the error_log: >=20 > | root@nikos [/home/nikos/public_html]# touch /var/log/httpd/error_log >=20 >=20 >=20 > That won't do you much good; apache has not opened it, and so it >=20 > will not be writing to it. It was writing to a file of that name, >=20 > but you removed that file. Apache probably still has its hooks in the old >=20 > file (which now has no name). >=20 >=20 >=20 > Restarting apache should open (or create if missing) this file for you. >=20 >=20 >=20 > | root@nikos [/home/nikos/public_html]# tail -f /var/log/httpd/error_log >=20 > | and its empty even when at the exact same time i run 'python3 >=20 > | metrites.py' from another interactive prompt when it supposed to >=20 > | give live feed of the error messages. >=20 >=20 >=20 > No, _apache_ writes to that file. So only when you visit the web >=20 > page will stuff appear there. >=20 >=20 >=20 > If you just run things from the command line, error messages will appear = on your terminal. Or, after this line of the wrapper script: >=20 >=20 >=20 > exec 2>>/home/nikos/cgi.err.out >=20 >=20 >=20 > the error messages will appear in cgi.err.out. >=20 >=20 >=20 > | Cameron would it be too much to ask to provide you with root >=20 > | access to my VPS server so you can have a look there too? >=20 > | i can pay you if you like if you wait a few days to gather some money. >=20 >=20 >=20 > I really do not recommend that: >=20 >=20 >=20 > - it is nuts to blithely allow a stranger root access to your system >=20 > - you won't learn anything about CGI scripts >=20 >=20 >=20 > What you need for further debugging of your python issues is access >=20 > to the error messages from the CGI script. That is the purpose of >=20 > the wrapper script. >=20 >=20 >=20 > Get the wrapper running on the command line and then test it via the brow= ser. >=20 >=20 >=20 > Cheers, >=20 > --=20 >=20 > Cameron Simpson >=20 >=20 >=20 > Lord grant me the serenity to accept the things I can not change, >=20 > the courage to change the things that I can, >=20 > and the wisdom to hide the bodies of those people I had to kill >=20 > because they pissed me off. >=20 > - Jeffrey Papen Well i trust you because you are the only one along with Lele that are help= img me here: i tried what you said: root@nikos [/home/nikos/public_html/cgi-bin]# service httpd restart root@nikos [/home/nikos/public_html/cgi-bin]# python3 metrites.py=20 root@nikos [/home/nikos/public_html]# cd foo-py/ root@nikos [/home/nikos/public_html/foo-py]# ls ./ ../ foo.py* root@nikos [/home/nikos/public_html/foo-py]# ./foo.py=20 root@nikos [/home/nikos/public_html/foo-py]# cd .. root@nikos [/home/nikos/public_html]# cat cgi.err.out=20 root@nikos [/home/nikos/public_html/cgi-bin]# cat /var/log/httpd/error_log= =20 root@nikos [/home/nikos/public_html/cgi-bin]#=20 and i have run the script form browser but i still see nothing. I insist that you will make the most of this if you access the VPS yourself= . it runs CentOS 6.4 Please accept, i trust you.