Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53060 > unrolled thread

[error] [client 178.59.111.223] (2)No such file or directory: exec of

Started byFerrous Cranus <nikos@superhost.gr>
First post2013-08-27 15:52 +0300
Last post2013-08-29 11:04 +1000
Articles 20 on this page of 42 — 12 participants

Back to article view | Back to comp.lang.python


Contents

  [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos@superhost.gr> - 2013-08-27 15:52 +0300
    Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos@superhost.gr> - 2013-08-27 16:05 +0300
      Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos@superhost.gr> - 2013-08-27 16:35 +0300
        Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-27 19:20 -0400
      Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of ishish <ishish@domhain.de> - 2013-08-27 14:59 +0100
        Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos@superhost.gr> - 2013-08-27 18:04 +0300
          Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of ishish <ishish@domhain.de> - 2013-08-27 16:22 +0100
            Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 02:48 -0700
              Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of ishish <ishish@domhain.de> - 2013-08-28 11:11 +0100
                Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 03:43 -0700
                  Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 03:46 -0700
                    Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 04:14 -0700
                      Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Dave Angel <davea@davea.name> - 2013-08-28 11:32 +0000
                        Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 04:35 -0700
                        Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 04:38 -0700
                          Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Dave Angel <davea@davea.name> - 2013-08-28 18:40 +0000
                        Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 04:55 -0700
                          Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-28 15:38 +0200
                            Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 07:58 -0700
                              RE: [error] [client 178.59.111.223] (2)No such file or directory: exec of "Prasad, Ramit" <ramit.prasad@jpmorgan.com.dmarc.invalid> - 2013-08-28 18:44 +0000
                                Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-28 22:49 +0000
                                  Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Joel Goldstick <joel.goldstick@gmail.com> - 2013-08-28 18:56 -0400
                                    Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-28 23:36 +0000
                              Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Chris Angelico <rosuav@gmail.com> - 2013-08-29 08:55 +1000
                      Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of ishish <ishish@domhain.de> - 2013-08-28 12:51 +0100
                        Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 05:03 -0700
                          Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of ishish <ishish@domhain.de> - 2013-08-28 13:16 +0100
                  Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-28 12:21 +0000
                    Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 05:36 -0700
          Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-27 17:07 +0000
            Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 01:46 -0700
              Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 02:24 -0700
              Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-28 12:11 +0000
                Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 05:17 -0700
                  Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-28 12:38 +0000
                    Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 05:48 -0700
                      Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 06:11 -0700
                        Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-28 22:56 +0000
                          Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-08-28 21:20 -0700
                            Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Steven D'Aprano <steve@pearwood.info> - 2013-08-29 06:30 +0000
                      Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Cameron Simpson <cs@zip.com.au> - 2013-08-29 11:01 +1000
                Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of Cameron Simpson <cs@zip.com.au> - 2013-08-29 11:04 +1000

Page 1 of 3  [1] 2 3  Next page →


#53060 — [error] [client 178.59.111.223] (2)No such file or directory: exec of

FromFerrous Cranus <nikos@superhost.gr>
Date2013-08-27 15:52 +0300
Subject[error] [client 178.59.111.223] (2)No such file or directory: exec of
Message-ID<kvi7ei$2n2$2@news.grnet.gr>
I think that something iam missing in the new VPS implementation 
concerning my python web page.

After: tail -F /usr/local/apache/logs/error_log &

================
[Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] (2)No such 
file or directory: exec of '/home/nikos/public_html/cgi-bin/metrites.py' 
failed
[Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] Premature end 
of script headers: metrites.py
================

I do not understand what this type of error is trying to say.

[toc] | [next] | [standalone]


#53064

FromFerrous Cranus <nikos@superhost.gr>
Date2013-08-27 16:05 +0300
Message-ID<kvi86o$aig$1@news.grnet.gr>
In reply to#53060
Στις 27/8/2013 3:52 μμ, ο/η Ferrous Cranus έγραψε:
> I think that something iam missing in the new VPS implementation
> concerning my python web page.
>
> After: tail -F /usr/local/apache/logs/error_log &
>
> ================
> [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] (2)No such
> file or directory: exec of '/home/nikos/public_html/cgi-bin/metrites.py'
> failed
> [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] Premature end
> of script headers: metrites.py
> ================
>
> I do not understand what this type of error is trying to say.
>
>

Okey it was the python path (shebang that was causing this)

Now i have correct it from

/usr/local/bin/python3 => /usr/bin/python
System has beens etup this way to point directly to python 3.3.2 in the 
new VPS.
Admin setit up that way hwile in the old one was different.

  But i cannot overocme thjis:

[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in 
sys.excepthook:
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError: 
underlying buffer has been detached
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original 
exception was:
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback 
(most recent call last):
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File 
"/home/nikos/public_html/cgi-bin/metrites.py", line 169, in <module>
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] 
cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File 
"/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py", 
line 108, in execute
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]     query = 
query % escaped_args
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError: 
unsupported operand type(s) for %: 'bytes' and 'str'

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#53067

FromFerrous Cranus <nikos@superhost.gr>
Date2013-08-27 16:35 +0300
Message-ID<kvi9v6$drv$1@news.grnet.gr>
In reply to#53064
Στις 27/8/2013 4:05 μμ, ο/η Ferrous Cranus έγραψε:
> Στις 27/8/2013 3:52 μμ, ο/η Ferrous Cranus έγραψε:
>> I think that something iam missing in the new VPS implementation
>> concerning my python web page.
>>
>> After: tail -F /usr/local/apache/logs/error_log &
>>
>> ================
>> [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] (2)No such
>> file or directory: exec of '/home/nikos/public_html/cgi-bin/metrites.py'
>> failed
>> [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] Premature end
>> of script headers: metrites.py
>> ================
>>
>> I do not understand what this type of error is trying to say.
>>
>>
>
> Okey it was the python path (shebang that was causing this)
>
> Now i have correct it from
>
> /usr/local/bin/python3 => /usr/bin/python
> System has beens etup this way to point directly to python 3.3.2 in the
> new VPS.
> Admin setit up that way hwile in the old one was different.
>
>   But i cannot overocme thjis:
>
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in
> sys.excepthook:
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError:
> underlying buffer has been detached
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original
> exception was:
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback
> (most recent call last):
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
> "/home/nikos/public_html/cgi-bin/metrites.py", line 169, in <module>
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
> "/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py",
> line 108, in execute
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]     query =
> query % escaped_args
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError:
> unsupported operand type(s) for %: 'bytes' and 'str'
>
someone please?

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#53102

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2013-08-27 19:20 -0400
Message-ID<mailman.287.1377645627.19984.python-list@python.org>
In reply to#53067
On Tue, 27 Aug 2013 16:35:34 +0300, Ferrous Cranus <nikos@superhost.gr>
declaimed the following:

>>
>someone please?
>
	You waited only 30 minutes before bumping the thread?...

	Consider that your time zone is 8 hours ahead of mine, your post came
in an hour after I went to work. The earliest I'd be likely to see your
post is an hour after getting home, or about 10 hours after your post.

	As for the prior post complaint...

	Was the older system running Python 2.x? Is the new one running Python
3.x? If so, read the documentation defining what has changed between 2.x
and 3.x.

	Hint: strings in 3.x are UNICODE, while strings in 2.x are plain BYTES.

	The database adapter may expect different data types.

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#53068

Fromishish <ishish@domhain.de>
Date2013-08-27 14:59 +0100
Message-ID<mailman.272.1377613496.19984.python-list@python.org>
In reply to#53064
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in
> sys.excepthook:
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> ValueError: underlying buffer has been detached
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original
> exception was:
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback
> (most recent call last):
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
> "/home/nikos/public_html/cgi-bin/metrites.py", line 169, in <module>
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
> 
> "/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py",
> line 108, in execute
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]     query
> = query % escaped_args
> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> TypeError: unsupported operand type(s) for %: 'bytes' and 'str'

I quote from a Python 3 Guide 
[http://python.about.com/od/python30/ss/30_strings_3.htm]:

The two data types, str and bytes, are mutually exclusive. One cannot 
legally combine them into one call. With the distinction between text 
and data, therefore, comes the need to convert between them.

[toc] | [prev] | [next] | [standalone]


#53072

FromFerrous Cranus <nikos@superhost.gr>
Date2013-08-27 18:04 +0300
Message-ID<kvif5n$drv$2@news.grnet.gr>
In reply to#53068
Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε:
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in
>> sys.excepthook:
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>> ValueError: underlying buffer has been detached
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original
>> exception was:
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback
>> (most recent call last):
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
>> "/home/nikos/public_html/cgi-bin/metrites.py", line 169, in <module>
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>> cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
>>
>> "/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py",
>> line 108, in execute
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]     query
>> = query % escaped_args
>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>> TypeError: unsupported operand type(s) for %: 'bytes' and 'str'
>
> I quote from a Python 3 Guide
> [http://python.about.com/od/python30/ss/30_strings_3.htm]:
>
> The two data types, str and bytes, are mutually exclusive. One cannot
> legally combine them into one call. With the distinction between text
> and data, therefore, comes the need to convert between them.
>
>

So, in this line:

cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )

the variable 'page' needs conversion to what?

all that is stores is the location of a file

path = '/home/nikos/public_html/'

page = form.getvalue('page')

if not page and os.path.exists( file ):
	# it is an html template
	page = file.replace( path, '' )

So chnage it to what?
-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#53074

Fromishish <ishish@domhain.de>
Date2013-08-27 16:22 +0100
Message-ID<mailman.275.1377616954.19984.python-list@python.org>
In reply to#53072
Am 27.08.2013 16:04, schrieb Ferrous Cranus:
> Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε:
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error 
>>> in
>>> sys.excepthook:
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>>> ValueError: underlying buffer has been detached
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] 
>>> Original
>>> exception was:
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] 
>>> Traceback
>>> (most recent call last):
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
>>> "/home/nikos/public_html/cgi-bin/metrites.py", line 169, in 
>>> <module>
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>>> cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
>>>
>>> 
>>> "/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py",
>>> line 108, in execute
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]     
>>> query
>>> = query % escaped_args
>>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
>>> TypeError: unsupported operand type(s) for %: 'bytes' and 'str'
>>
>> I quote from a Python 3 Guide
>> [http://python.about.com/od/python30/ss/30_strings_3.htm]:
>>
>> The two data types, str and bytes, are mutually exclusive. One 
>> cannot
>> legally combine them into one call. With the distinction between 
>> text
>> and data, therefore, comes the need to convert between them.
>>
>>
>
> So, in this line:
>
> cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
>
> the variable 'page' needs conversion to what?
>
> all that is stores is the location of a file
>
> path = '/home/nikos/public_html/'
>
> page = form.getvalue('page')
>
> if not page and os.path.exists( file ):
> # it is an html template
> page = file.replace( path, '' )
>
> So chnage it to what?
> --
> What is now proved was at first only imagined!


The error occurs in file 
"/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py", 
line 108, in execute
query = query % escaped_args

You can check the actual values and data types using:

print repr(query)
print type(query)

print repr(escaped_args)
print type(escaped_args)

Always useful is a proper exception handling using try:/except:

[toc] | [prev] | [next] | [standalone]


#53120

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 02:48 -0700
Message-ID<39be9227-c800-49a5-850d-f387c30d1e9d@googlegroups.com>
In reply to#53074
Τη Τρίτη, 27 Αυγούστου 2013 6:22:32 μ.μ. UTC+3, ο χρήστης ishish έγραψε:
> Am 27.08.2013 16:04, schrieb Ferrous Cranus:
> 
> > Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε:
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error 
> 
> >>> in
> 
> >>> sys.excepthook:
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> 
> >>> ValueError: underlying buffer has been detached
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] 
> 
> >>> Original
> 
> >>> exception was:
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] 
> 
> >>> Traceback
> 
> >>> (most recent call last):
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
> 
> >>> "/home/nikos/public_html/cgi-bin/metrites.py", line 169, in 
> 
> >>> <module>
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> 
> >>> cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
> 
> >>>
> 
> >>> 
> 
> >>> "/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py",
> 
> >>> line 108, in execute
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]     
> 
> >>> query
> 
> >>> = query % escaped_args
> 
> >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
> 
> >>> TypeError: unsupported operand type(s) for %: 'bytes' and 'str'
> 
> >>
> 
> >> I quote from a Python 3 Guide
> 
> >> [http://python.about.com/od/python30/ss/30_strings_3.htm]:
> 
> >>
> 
> >> The two data types, str and bytes, are mutually exclusive. One 
> 
> >> cannot
> 
> >> legally combine them into one call. With the distinction between 
> 
> >> text
> 
> >> and data, therefore, comes the need to convert between them.
> 
> >>
> 
> >>
> 
> >
> 
> > So, in this line:
> 
> >
> 
> > cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
> 
> >
> 
> > the variable 'page' needs conversion to what?
> 
> >
> 
> > all that is stores is the location of a file
> 
> >
> 
> > path = '/home/nikos/public_html/'
> 
> >
> 
> > page = form.getvalue('page')
> 
> >
> 
> > if not page and os.path.exists( file ):
> 
> > # it is an html template
> 
> > page = file.replace( path, '' )
> 
> >
> 
> > So chnage it to what?
> 
> > --
> 
> > What is now proved was at first only imagined!
> 
> 
> 
> 
> 
> The error occurs in file 
> 
> "/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py", 
> 
> line 108, in execute
> 
> query = query % escaped_args
> 
> 
> 
> You can check the actual values and data types using:
> 
> 
> 
> print repr(query)
> 
> print type(query)
> 
> 
> 
> print repr(escaped_args)
> 
> print type(escaped_args)
> 
> 
> 
> Always useful is a proper exception handling using try:/except:


hOW YOU MEAN PLEASE I TRY TO IMPLMENT WHAT YOU PROPOSE BUT I CANT.

	try:
		#find the needed counter for the page URL
		if os.path.exists( path + page ) or os.path.exists( cgi_path + page ):
			cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
			data = cur.fetchone()		#URL is unique, so should only be one
			
		
print repr('''SELECT ID FROM counters WHERE url = %s''') 
print type('''SELECT ID FROM counters WHERE url = %s''') 

print repr(escaped_args) 
print type(escaped_args) 

I MEAN IF FAILS BEFORE IT TRIES TO GO INTO MY PRINT STAEMNT.
HOW AM I GONNA CPATURE THE QUERY?

[toc] | [prev] | [next] | [standalone]


#53121

Fromishish <ishish@domhain.de>
Date2013-08-28 11:11 +0100
Message-ID<mailman.297.1377684668.19984.python-list@python.org>
In reply to#53120
Am 28.08.2013 10:48, schrieb Ferrous Cranus:
>> >> I quote from a Python 3 Guide
>>
>> >> [http://python.about.com/od/python30/ss/30_strings_3.htm]:
>>
>> >>
>>
>> >> The two data types, str and bytes, are mutually exclusive. One
>>
>> >> cannot
>>
>> >> legally combine them into one call. With the distinction between
>>
>> >> text
>>
>> >> and data, therefore, comes the need to convert between them.
>>
>> >>
>>
>> >>
>>
>> >
>>
>> > So, in this line:
>>
>> >
>>
>> > cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
>>
>> >
>>
>> > the variable 'page' needs conversion to what?
>>
>> >
>>
>> > all that is stores is the location of a file
>>
>> >
>>
>> > path = '/home/nikos/public_html/'
>>
>> >
>>
>> > page = form.getvalue('page')
>>
>> >
>>
>> > if not page and os.path.exists( file ):
>>
>> > # it is an html template
>>
>> > page = file.replace( path, '' )
>>
>> >
>>
>> > So chnage it to what?
>>
>> > --
>>
>> > What is now proved was at first only imagined!
>>
>>
>>
>>
>>
>> The error occurs in file
>>
>> 
>> "/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py",
>>
>> line 108, in execute
>>
>> query = query % escaped_args
>>
>>
>>
>> You can check the actual values and data types using:
>>
>>
>>
>> print repr(query)
>>
>> print type(query)
>>
>>
>>
>> print repr(escaped_args)
>>
>> print type(escaped_args)
>>
>>
>>
>> Always useful is a proper exception handling using try:/except:
>
>
> hOW YOU MEAN PLEASE I TRY TO IMPLMENT WHAT YOU PROPOSE BUT I CANT.
>
> 	try:
> 		#find the needed counter for the page URL
> 		if os.path.exists( path + page ) or os.path.exists( cgi_path + page 
> ):
> 			cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
> 			data = cur.fetchone()		#URL is unique, so should only be one
>
>
> print repr('''SELECT ID FROM counters WHERE url = %s''')
> print type('''SELECT ID FROM counters WHERE url = %s''')
>
> print repr(escaped_args)
> print type(escaped_args)
>
> I MEAN IF FAILS BEFORE IT TRIES TO GO INTO MY PRINT STAEMNT.
> HOW AM I GONNA CPATURE THE QUERY?


http://i.stack.imgur.com/jiFfM.jpg

http://wiki.python.org/moin/HandlingExceptions

[toc] | [prev] | [next] | [standalone]


#53123

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 03:43 -0700
Message-ID<e57e7380-183e-44d2-a003-577e840f0cfb@googlegroups.com>
In reply to#53121
Τη Τετάρτη, 28 Αυγούστου 2013 1:11:05 μ.μ. UTC+3, ο χρήστης ishish έγραψε:

> http://wiki.python.org/moin/HandlingExceptions

is this how you mean?

		try:
			#find the needed counter for the page URL
			if os.path.exists( path + page ) or os.path.exists( cgi_path + page ):
				cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
				data = cur.fetchone()		#URL is unique, so should only be one
		except:
			print repr(query) 
			print type(query) 

			print repr(escaped_args) 
			print type(escaped_args)


but i cannot see the error_log because of constant scrolling of error output.

[toc] | [prev] | [next] | [standalone]


#53126

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 03:46 -0700
Message-ID<ceb1d6d5-894c-465a-bc55-2948f1036f4b@googlegroups.com>
In reply to#53123
Τη Τετάρτη, 28 Αυγούστου 2013 1:43:08 μ.μ. UTC+3, ο χρήστης Ferrous Cranus έγραψε:
> Τη Τετάρτη, 28 Αυγούστου 2013 1:11:05 μ.μ. UTC+3, ο χρήστης ishish έγραψε:
> 
> 
> 
> > http://wiki.python.org/moin/HandlingExceptions
> 
> 
> 
> is this how you mean?
> 
> 
> 
> 		try:
> 
> 			#find the needed counter for the page URL
> 
> 			if os.path.exists( path + page ) or os.path.exists( cgi_path + page ):
> 
> 				cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
> 
> 				data = cur.fetchone()		#URL is unique, so should only be one
> 
> 		except:
> 
> 			print repr(query) 
> 
> 			print type(query) 
> 
> 
> 
> 			print repr(escaped_args) 
> 
> 			print type(escaped_args)
> 
> 
> 
> 
> 
> but i cannot see the error_log because of constant scrolling of error output.

i try: tail -F /usr/local/apache/logs/error_log | grep nikos &'

and see the follwing. if i dont grep at all i cannot stop the eroor output:

ikos@superhost.gr [~]# [Wed Aug 28 10:44:22 2013] [error] [client 108.162.231.120]   File "/home/nikos/public_html/cgi-bin/metrites.py", line 173, in <module>
[Wed Aug 28 10:44:22 2013] [error] [client 108.162.231.120]   File "/home/nikos/public_html/cgi-bin/metrites.py", line 176, in <module>
[Wed Aug 28 10:44:22 2013] [error] [client 108.162.231.120] File does not exist: /home/nikos/public_html/500.shtml

[toc] | [prev] | [next] | [standalone]


#53128

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 04:14 -0700
Message-ID<73c7b08d-5349-49ba-b945-6d87795088bf@googlegroups.com>
In reply to#53126
Okey, continue trying and trying i came up with this:


try:
if os.path.exists( path + page ) or os.path.exists( cgi_path + page ):
	cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
	data = cur.fetchone()
except:
	with open("err.out", "a") as f:
		f.write( repr(query), type(query) )
		f.write( repr(escaped_args), type(escaped_args) )


But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c

How will i manage to troubleshoot?
Please confirm the above is correct and is what you were propsoing i shoudl test.

[toc] | [prev] | [next] | [standalone]


#53131

FromDave Angel <davea@davea.name>
Date2013-08-28 11:32 +0000
Message-ID<mailman.303.1377689588.19984.python-list@python.org>
In reply to#53128
On 28/8/2013 07:14, Ferrous Cranus wrote:

>
>
> But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c

I take it this 'error log" is shared with other users, and you can't
constrain them to cease and desist for a while?

>
> How will i manage to troubleshoot?
> Please confirm the above is correct and is what you were propsoing i shoudl test.

You really have no directory in which you have write permissions?  If
so, perhaps  you'd better solve that first.


-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#53132

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 04:35 -0700
Message-ID<92cad8d9-3d81-418a-89a1-cba0b35423e7@googlegroups.com>
In reply to#53131
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε:
> On 28/8/2013 07:14, Ferrous Cranus wrote:
> 
> 
> 
> >
> 
> >
> 
> > But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c
> 
> 
> 
> I take it this 'error log" is shared with other users, and you can't
> 
> constrain them to cease and desist for a while?
> 
> 
> 
> >
> 
> > How will i manage to troubleshoot?
> 
> > Please confirm the above is correct and is what you were propsoing i shoudl test.
> 
> 
> 
> You really have no directory in which you have write permissions?  If
> 
> so, perhaps  you'd better solve that first.
> 
> 
> 
> 
> 
> -- 
> 
> DaveA



[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Error in sys.excepthook:
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] ValueError: underlying buffer has been detached
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Original exception was:
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Traceback (most recent call last):
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]   File "/home/nikos/public_html/cgi-bin/metrites.                                                                                py", line 173, in <module>
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]     cur.execute('''SELECT ID FROM counters WHERE                                                                                 url = %s''', page )
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]   File "/usr/local/bin/python/lib/python3.3/site-                                                                                packages/pymysql/cursors.py", line 108, in execute
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]     query = query % escaped_args
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] TypeError: unsupported operand type(s) for %: 'by                                                                                tes' and 'str'
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] During handling of the above exception, another e                                                                                xception occurred:
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Traceback (most recent call last):
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]   File "/home/nikos/public_html/cgi-bin/metrites.                                                                                py", line 176, in <module>
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120]     with open("err.out", "a") as f:
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] PermissionError: [Errno 13] \\u0386\\u03c1\\u03bd                                                                                \\u03b7\\u03c3\\u03b7 \\u03c0\\u03c1\\u03cc\\u03c3\\u03b2\\u03b1\\u03c3\\u03b7\\u03c2: 'err.out'
[Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] File does not exist: /home/nikos/public_html/500.                                                                                shtml

[toc] | [prev] | [next] | [standalone]


#53133

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 04:38 -0700
Message-ID<e5dfafeb-a86a-49b6-a1e6-d87e3fb26c64@googlegroups.com>
In reply to#53131
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε:
> On 28/8/2013 07:14, Ferrous Cranus wrote:
> 
> 
> 
> >
> 
> >
> 
> > But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c
> 
> 
> 
> I take it this 'error log" is shared with other users, and you can't
> 
> constrain them to cease and desist for a while?
> 
> 
> 
> >
> 
> > How will i manage to troubleshoot?
> 
> > Please confirm the above is correct and is what you were propsoing i shoudl test.
> 
> 
> 
> You really have no directory in which you have write permissions?  If
> 
> so, perhaps  you'd better solve that first.


hello Dave,

no this is the general error log apache produces for all the server.

Is there a way to grep error logging info, pertainign only to my specific nikos account or my superhost.gr domain?

[toc] | [prev] | [next] | [standalone]


#53177

FromDave Angel <davea@davea.name>
Date2013-08-28 18:40 +0000
Message-ID<mailman.322.1377715262.19984.python-list@python.org>
In reply to#53133
On 28/8/2013 07:38, Ferrous Cranus wrote:


>
> no this is the general error log apache produces for all the server.
>
> Is there a way to grep error logging info, pertainign only to my specific nikos account or my superhost.gr domain?

I now nothing about Apache logs, but how about grepping the client url ?

[client 108.162.231.120]

I still don't understand why you don't find or create a directory that
"nobody" has write access to, so you can be more flexible about what
information you log.

Or strip the problem down to a simple "page" that displays what print
emits in a simple form.

-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#53136

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 04:55 -0700
Message-ID<85e059ef-9717-4101-910a-379a5ebd0522@googlegroups.com>
In reply to#53131
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε:
> On 28/8/2013 07:14, Ferrous Cranus wrote:
> 
> 
> 
> >
> 
> >
> 
> > But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c
> 
> 
> 
> I take it this 'error log" is shared with other users, and you can't
> 
> constrain them to cease and desist for a while?
> 
> 
> 
> >
> 
> > How will i manage to troubleshoot?
> 
> > Please confirm the above is correct and is what you were propsoing i shoudl test.
> 
> 
> 
> You really have no directory in which you have write permissions?  If
> 
> so, perhaps  you'd better solve that first.


of cours ei ahve write permissions. Here:

nikos@superhost.gr [~]# ls -ld www/
drwxr-x--- 4 nikos nobody 4096 Jul 13 10:33 www//
nikos@superhost.gr [~]# ls -ld www/cgi-bin/
drwxr-xr-x 2 nikos nikos 4096 Aug 28 10:41 www/cgi-bin//


whick make it a mysterya s to why
with open("../err.out", "a") as f: 

fails to write the file.

[toc] | [prev] | [next] | [standalone]


#53161

FromUlrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Date2013-08-28 15:38 +0200
Message-ID<q2b1fa-8j2.ln1@satorlaser.homedns.org>
In reply to#53136
Am 28.08.2013 13:55, schrieb Ferrous Cranus:
> Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε:
>> You really have no directory in which you have write permissions?  If
>> so, perhaps  you'd better solve that first.
>
>
> of cours ei ahve write permissions. Here:
>
> nikos@superhost.gr [~]# ls -ld www/
> drwxr-x--- 4 nikos nobody 4096 Jul 13 10:33 www//
> nikos@superhost.gr [~]# ls -ld www/cgi-bin/
> drwxr-xr-x 2 nikos nikos 4096 Aug 28 10:41 www/cgi-bin//
>
>
> whick make it a mysterya s to why
> with open("../err.out", "a") as f:
 > fails to write the file.

...maybe it's because the server is not running as user nikos?

Uli

[toc] | [prev] | [next] | [standalone]


#53162

FromFerrous Cranus <nikos.gr33k@gmail.com>
Date2013-08-28 07:58 -0700
Message-ID<68f49226-7f00-489b-bfc0-267bd00aa356@googlegroups.com>
In reply to#53161
Τη Τετάρτη, 28 Αυγούστου 2013 4:38:02 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε:
> Am 28.08.2013 13:55, schrieb Ferrous Cranus:
> 
> > Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε:
> 
> >> You really have no directory in which you have write permissions?  If
> 
> >> so, perhaps  you'd better solve that first.
> 
> >
> 
> >
> 
> > of cours ei ahve write permissions. Here:
> 
> >
> 
> > nikos@superhost.gr [~]# ls -ld www/
> 
> > drwxr-x--- 4 nikos nobody 4096 Jul 13 10:33 www//
> 
> > nikos@superhost.gr [~]# ls -ld www/cgi-bin/
> 
> > drwxr-xr-x 2 nikos nikos 4096 Aug 28 10:41 www/cgi-bin//
> 
> >
> 
> >
> 
> > whick make it a mysterya s to why
> 
> > with open("../err.out", "a") as f:
> 
>  > fails to write the file.
> 
> 
> 
> ...maybe it's because the server is not running as user nikos?
> 
> 
> 
> Uli

Yes Uli, the script metrits.py is being invoked by Apache Web Server which in turn runs under user Nobody.
So, that mean that? user 'nobody' has no write permission to /home/nikos folder?

[toc] | [prev] | [next] | [standalone]


#53178

From"Prasad, Ramit" <ramit.prasad@jpmorgan.com.dmarc.invalid>
Date2013-08-28 18:44 +0000
Message-ID<mailman.323.1377715481.19984.python-list@python.org>
In reply to#53162
Ferrous Cranus wrote:
> Yes Uli, the script metrits.py is being invoked by Apache Web Server which in turn runs under user
> Nobody.
> So, that mean that? user 'nobody' has no write permission to /home/nikos folder?

Yes. You should make it group writable with "nobody" as the group. Use chmod and chown
to change permissions and owners (i.e. groups). As a last resort (for testing purposes
only!) you can set the directory "world writable", but then *anyone* with access to that
host can write/delete/destroy the contents of that directory. This is obviously
very insecure and not a good idea. But if you are only trying to get a quick error message
then it might work for you. 

Normally I would have thought you would have a public_html or www directory in your
home folder that would be readable/writable to the web server (and where you should 
write).


~Ramit



This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.  

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.lang.python


csiph-web