TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Hello this is the following snippet that is causing me the error i mention in the Subject: try: cur.execute( '''SELECT url, hits FROM counters ORDER BY hits DESC''' ) data = cur.fetchall() for row in data: (url, hi

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Peter Otten
Νίκος Γκρ33κ wrote: > Hello this is the following snippet that is causing me the error i mention > in the Subject: > print( " color=tomato size=5> %s " ) % (url, url) Hint (Python 3): >>> print("a=%s, b=%s") % (1, 2) a=%s, b=%s Traceback (most recent call last): File "", line 1, in TypeError

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Τη Κυριακή, 26 Μαΐου 2013 11:23:40 π.μ. UTC+3, ο χρήστης Peter Otten έγραψε: > Νίκος Γκρ33κ wrote: > > > > > Hello this is the following snippet that is causing me the error i mention > > > in the Subject: > > > > > print( " > href='http://superhost.gr/?show=log&page=%s'> %s > > " ) % (url,

Re: CrazyHTTPd - HTTP Daemon in Python

2013-05-26 Thread Fábio Santos
On 26 May 2013 05:18, "Mark Lawrence" wrote: > > On 26/05/2013 04:55, cdorm...@gmail.com wrote: >> >> This is a small little Project that I have started. Its a light little Web Server (HTTPd) coded in python. Requirements: Python 2.7 =< And Linux / BSD. I believe this could work in a CLI Emulator

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Peter Otten
Νίκος Γκρ33κ wrote: > Thank you very much Peter, so as it seems in Python 3.3.1 all > substitutuons must be nested in print(). Yes; in other words: In Python 3 print() is a function. -- http://mail.python.org/mailman/listinfo/python-list

Re: CrazyHTTPd - HTTP Daemon in Python

2013-05-26 Thread Marc Christiansen
Mark Lawrence wrote: > On 26/05/2013 04:55, cdorm...@gmail.com wrote: >> This is a small little Project that I have started. Its a light >> little Web Server (HTTPd) coded in python. Requirements: Python 2.7 >> =< And Linux / BSD. I believe this could work in a CLI Emulator in >> windows too. >> W

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Perhaps cna you help a bit with tha too: used to work in 2.6 but not with 3.3.1 #!/usr/bin/python3 # coding=utf-8 import cgitb; cgitb.enable() import cgi, os, sys from http import cookies # initialize cookie cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) cookie.load( cookie ) ni

Re: Piping processes works with 'shell = True' but not otherwise.

2013-05-26 Thread Luca Cerone
> > Can you please help me understanding what's the difference between the two > cases? > Hi guys has some of you ideas on what is causing my issue? -- http://mail.python.org/mailman/listinfo/python-list

Short-circuit Logic

2013-05-26 Thread Ahmed Abdulshafy
Hi, I'm having a hard time wrapping my head around short-circuit logic that's used by Python, coming from a C/C++ background; so I don't understand why the following condition is written this way!> if not allow_zero and abs(x) < sys.float_info.epsilon: print("zero is not all

Error when trying to sort and presnt a dictionary in python 3.3.1

2013-05-26 Thread Νίκος Γκρ33κ
python3 pelatologio.py gives me error in this line: Traceback (most recent call last): File "pelatologio.py", line 283, in ''' % (months[key], key) ) KeyError: 1 The code is: #populating months into a dropdown menu years = ( 2010, 2011, 2012, 2013 ) months = { 'Ιανουάριος':1, 'Φε

Re: Short-circuit Logic

2013-05-26 Thread Roy Smith
In article <5f101d70-e51f-4531-9153-c92ee2486...@googlegroups.com>, Ahmed Abdulshafy wrote: > Hi, > I'm having a hard time wrapping my head around short-circuit logic that's > used by Python, coming from a C/C++ background; so I don't understand why the > following condition is written this wa

Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
I'm not sure if this'll interest anybody, but I expect that I'm going to get some mutual recursion in my simulation, so I needed to see how python handled it. Unfortunately, it falls over once it detects a certain level of recursion. This is reasonable as, otherwise, the stack eventually over-fills

Output from to_bytes

2013-05-26 Thread Mok-Kong Shen
I don't understand why with the code: for k in range(8,12,1): print(k.to_bytes(2,byteorder='big')) one gets the following output: b'\x00\x08' b'\x00\t' b'\x00\n' b'\x00\x0b' I mean the 2nd and 3rd should be b'\x00\x09' and b'x00\x0a'. Anyway, how could I get the output in t

Re: Short-circuit Logic

2013-05-26 Thread Steven D'Aprano
On Sun, 26 May 2013 04:11:56 -0700, Ahmed Abdulshafy wrote: > Hi, > I'm having a hard time wrapping my head around short-circuit logic > that's used by Python, coming from a C/C++ background; so I don't > understand why the following condition is written this way! > > if not allow_zero and a

Re: Error when trying to sort and presnt a dictionary in python 3.3.1

2013-05-26 Thread Peter Otten
Νίκος Γκρ33κ wrote: > python3 pelatologio.py gives me error in this line: > > Traceback (most recent call last): > File "pelatologio.py", line 283, in > ''' % (months[key], key) ) > KeyError: 1 > > The code is: > > #populating months into a dropdown menu > years = ( 2010, 2011,

Re: Error when trying to sort and presnt a dictionary in python 3.3.1

2013-05-26 Thread Νίκος Γκρ33κ
Τη Κυριακή, 26 Μαΐου 2013 3:20:19 μ.μ. UTC+3, ο χρήστης Peter Otten έγραψε: > At some point you have to admit that coding isn't your cup of tea. > Or Ouzo ;( And i didn't evne drank anyhting, iam sober! Imagine what i would have written if i had some shots of Ouzo :-) I chnage my code to: mont

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Anyone seeign somethign wrong? -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Chris Angelico
On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ wrote: > Anyone seeign somethign wrong? Yes. You're posting requests, then bumping the thread two hours later as though you're entitled to a response quicker than that. Plus, the problems you're seeing ought to be solved by the 2to3 utility. Use it.

Re: Output from to_bytes

2013-05-26 Thread Chris Angelico
On Sun, May 26, 2013 at 10:02 PM, Mok-Kong Shen wrote: > I don't understand why with the code: > >for k in range(8,12,1): > print(k.to_bytes(2,byteorder='big')) > > one gets the following output: > >b'\x00\x08' >b'\x00\t' >b'\x00\n' >b'\x00\x0b' > > I mean the 2nd and 3rd

RE: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Carlos Nepomuceno
> Date: Sun, 26 May 2013 06:00:51 -0700 > Subject: Re: TypeError: unsupported operand type(s) for %: 'NoneType' and > 'tuple' > From: nikos.gr...@gmail.com > To: python-list@python.org > > Anyone seeign somethign wrong? > -- > http://mail.python.org/mailman

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread nagia . retsina
Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: > On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ wrote: > > > Anyone seeign somethign wrong? > > > > Yes. You're posting requests, then bumping the thread two hours later > > as though you're entitled to a response

Re: Ldap module and base64 oncoding

2013-05-26 Thread Michael Ströder
Joseph L. Casale wrote: > I have some data I am working with that is not being interpreted as a string > requiring > base64 encoding when sent to the ldif module for output. > > The base64 string parsed is ZGV0XDMzMTB3YmJccGc= and the raw string is > det\3310wbb\pg. > I'll admit my understanding

Re: Solving the problem of mutual recursion

2013-05-26 Thread Jussi Piitulainen
Peter Brooks writes: > I'm not sure if this'll interest anybody, but I expect that I'm > going to get some mutual recursion in my simulation, so I needed to ... > returned, then this solution won't help you. Often, though, you're > not interested in what's returned and would just like the routine

Re: Ldap module and base64 oncoding

2013-05-26 Thread Michael Ströder
Joseph L. Casale wrote: >> Can you give an example of the code you have? > > I actually just overrode the regex used by the method in the LDIFWriter class > to be far more broad > about what it interprets as a safe string. Are you sure that you fully understood RFC 2849 before doing this? Which

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 1:00 AM, wrote: > Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: >> On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ wrote: >> >> > Anyone seeign somethign wrong? >> >> >> >> Yes. You're posting requests, then bumping the thread two hours lat

Re: Solving the problem of mutual recursion

2013-05-26 Thread Roy Smith
In article , Jussi Piitulainen wrote: > A light-weighter way is to have each task end by assigning the next > task and returning, instead of calling the next task directly. When a > task returns, a driver loop will call the assigned task, which again > does a bounded amount of work, assigns the

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Τη Κυριακή, 26 Μαΐου 2013 6:24:55 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: > On Mon, May 27, 2013 at 1:00 AM, wrote: > > > Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico > > έγραψε: > > >> On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ > >> wrote: > > >> > > >>

Re: Error when trying to sort and presnt a dictionary in python 3.3.1

2013-05-26 Thread Νίκος Γκρ33κ
Τη Κυριακή, 26 Μαΐου 2013 3:58:12 μ.μ. UTC+3, ο χρήστης Νίκος Γκρ33κ έγραψε: > Τη Κυριακή, 26 Μαΐου 2013 3:20:19 μ.μ. UTC+3, ο χρήστης Peter Otten έγραψε: > > > > > At some point you have to admit that coding isn't your cup of tea. > > > Or Ouzo ;( > > > > And i didn't evne drank anyhting, i

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Νίκος Γκρ33κ
Here is the live error log coming form apacher when i request the webpage form browser: ==> /usr/local/apache/logs/error_log <== [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] fopen: Permissi

Re: Help with implementing callback functions using ctypes

2013-05-26 Thread Shriramana Sharma
On Friday, May 24, 2013 8:56:28 AM UTC+5:30, Dan Stromberg wrote: > Cython is good. So is the new cffi, which might be thought of as a > safer (API-level) version of ctypes (which is ABI-level). Hi -- can you clarify what is this new CFFI and where I can get it? In the Python 3 library reference

RE: Ldap module and base64 oncoding

2013-05-26 Thread Joseph L. Casale
> I'm not sure what exactly you're asking for. > Especially "is not being interpreted as a string requiring base64 encoding" is > written without giving the right context. > > So I'm just guessing that this might be the usual misunderstandings with use > of base64 in LDIF. Read more about when LDI

Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Νίκος Γκρ33κ
This is the code that although correct becaus it works with englisg(standARD ASCII letters) it wont with Greek: if( log ): name = log # print specific client header info cur.execute('''SELECT hits, money FROM clients WHERE name = %s''', (name,) ) data = cur.fetcho

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Mark Lawrence
On 26/05/2013 16:24, Chris Angelico wrote: On Mon, May 27, 2013 at 1:00 AM, wrote: Τη Κυριακή, 26 Μαΐου 2013 4:10:02 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: On Sun, May 26, 2013 at 11:00 PM, Νίκος Γκρ33κ wrote: Anyone seeign somethign wrong? Yes. You're posting requests, then bump

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Mark Lawrence
On 26/05/2013 17:10, Νίκος Γκρ33κ wrote: Here is the live error log coming form apacher when i request the webpage form browser: ==> /usr/local/apache/logs/error_log <== [Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Sun May 26 19:07:41 2013] [

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On May 26, 5:09 pm, Jussi Piitulainen wrote: > > A light-weighter way is to have each task end by assigning the next > task and returning, instead of calling the next task directly. When a > task returns, a driver loop will call the assigned task, which again > does a bounded amount of work, assig

Re: Future standard GUI library

2013-05-26 Thread Wolfgang Keller
> > Both the concept and actually implemented examples of so-called "web > > applications" prove that they are just plain garbage and hopelessly > > unusable for anything remotely resembling actual screenwork. > > > > HTML forms may be at best useful for "web shops", but for actual > > screenwork,

Cutting a deck of cards

2013-05-26 Thread RVic
Suppose I have a deck of cards, and I shuffle them import random cards = [] decks = 6 cards = list(range(13 * 4 * decks)) random.shuffle(cards) So now I have an array of cards. I would like to cut these cards at some random point (between 1 and 13 * 4 * decks - 1, moving the lower half of that t

Re: Cutting a deck of cards

2013-05-26 Thread MRAB
On 26/05/2013 18:52, RVic wrote: Suppose I have a deck of cards, and I shuffle them import random cards = [] decks = 6 cards = list(range(13 * 4 * decks)) random.shuffle(cards) So now I have an array of cards. I would like to cut these cards at some random point (between 1 and 13 * 4 * decks -

Re: Cutting a deck of cards

2013-05-26 Thread Kamlesh Mutha
I guess, you will have to use list slicing mechanism to achieve the desired result. Hope this helps, Cheers, Kamlesh On Sun, May 26, 2013 at 11:22 PM, RVic wrote: > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 * d

RE: Solving the problem of mutual recursion

2013-05-26 Thread Carlos Nepomuceno
> Date: Sun, 26 May 2013 10:21:05 -0700 > Subject: Re: Solving the problem of mutual recursion > From: peter.h.m.bro...@gmail.com > To: python-list@python.org > > On May 26, 5:09 pm, Jussi Piitulainen > wrote: >> >> A light-weighter way is to have each task

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On 26 May, 20:09, Carlos Nepomuceno wrote: > > > > > > > > > > > > Date: Sun, 26 May 2013 10:21:05 -0700 > > Subject: Re: Solving the problem of mutual recursion > > From: peter.h.m.bro...@gmail.com > > To: python-l...@python.org > > > On May 26, 5:09 pm, J

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> Date: Sun, 26 May 2013 10:52:14 -0700 > Subject: Cutting a deck of cards > From: rvinc...@gmail.com > To: python-list@python.org > > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 *

Re: Future standard GUI library

2013-05-26 Thread Roy Smith
In article <20130526194310.9cdb1be80b42c7fdf0ba5...@gmx.net>, Wolfgang Keller wrote: > HTTP will never be a suitable transport layer for a RPC protocol. What, in particular, is wrong with HTTP for doing RPC? RPC is pretty straight-forward. Take this method, run it over there, with these arg

Re: Cutting a deck of cards

2013-05-26 Thread RVic
Ah, brilliant -- yes, this is so much more elegant in Python: #now cut the cards x = random.randrange(2,range(13 * 4 * decks)) cards = cards[x:]+cards[:x] -- http://mail.python.org/mailman/listinfo/python-list

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Νίκος Γκρ33κ
Any idea how to correct this encoding issue? -- http://mail.python.org/mailman/listinfo/python-list

RE: Solving the problem of mutual recursion

2013-05-26 Thread Carlos Nepomuceno
> Date: Sun, 26 May 2013 11:13:12 -0700 > Subject: Re: Solving the problem of mutual recursion > From: peter.h.m.bro...@gmail.com > To: python-list@python.org [...] >> How can you get 140% of CPU? IS that a typo?? >> > No, on a multi-core machine it's normal

Re: Cutting a deck of cards

2013-05-26 Thread Roy Smith
In article <4d02f46f-8264-41bf-a254-d1c204696...@googlegroups.com>, RVic wrote: > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 * decks)) > random.shuffle(cards) > > So now I have an array of cards. I would like to cut

RE: Future standard GUI library

2013-05-26 Thread Carlos Nepomuceno
> From: felip...@gmx.net > Subject: Re: Future standard GUI library > Date: Sun, 26 May 2013 19:43:10 +0200 > To: python-list@python.org [...] > one, HTTP will never be a suitable transport layer for a RPC protocol. > > Sincerely, > > Wolfgang Please give

RE: Help with implementing callback functions using ctypes

2013-05-26 Thread Carlos Nepomuceno
https://cffi.readthedocs.org/en/release-0.6/ > Date: Sun, 26 May 2013 09:12:10 -0700 > Subject: Re: Help with implementing callback functions using ctypes > From: samj...@gmail.com > To: python-list@python.org > > On Friday, May 24, 2013 8:56:28 AM UTC+5:30

Re: Future standard GUI library

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 3:43 AM, Wolfgang Keller wrote: >> For the Yosemite Project, I wanted the networking aspect, so the web >> browser UI was a good one. > > From the description this looks like a simble database CRUD > application. Somethign like that is definitely easier to implement and > t

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On 26 May, 20:22, Carlos Nepomuceno wrote: > > > > Date: Sun, 26 May 2013 11:13:12 -0700 > > Subject: Re: Solving the problem of mutual recursion > > From: peter.h.m.bro...@gmail.com > > To: python-l...@python.org > [...] > >> How can you get 140% of CPU? I

Re: Help with implementing callback functions using ctypes

2013-05-26 Thread Dan Stromberg
On Sun, May 26, 2013 at 9:12 AM, Shriramana Sharma wrote: > On Friday, May 24, 2013 8:56:28 AM UTC+5:30, Dan Stromberg wrote: > > Cython is good. So is the new cffi, which might be thought of as a > > safer (API-level) version of ctypes (which is ABI-level). > > Hi -- can you clarify what is this

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 12:13 PM, Peter Brooks wrote: > No, on a multi-core machine it's normal. The machine shows python > running multiple threads - and the number of threads change as the > program runs. Perhaps the OS/X implementation of python does allow > concurrency when others don't. It ce

Re: Future standard GUI library

2013-05-26 Thread Michael Torrie
On 05/26/2013 11:43 AM, Wolfgang Keller wrote: > And just like HTML never was a valid GUI framework and never will be > one, HTTP will never be a suitable transport layer for a RPC protocol. On good thing web development has brought us is the knowledge that modularization and layers are a brillian

Re: Cutting a deck of cards

2013-05-26 Thread Marc Christiansen
Carlos Nepomuceno wrote: > >> Date: Sun, 26 May 2013 10:52:14 -0700 >> Subject: Cutting a deck of cards >> From: rvinc...@gmail.com >> To: python-list@python.org >> >> Suppose I have a deck of cards, and I shuffle them >> >> import random >> cards = [] >> d

Re: Future standard GUI library

2013-05-26 Thread Roy Smith
In article , Michael Torrie wrote: > On good thing web development has brought us is the knowledge that > modularization and layers are a brilliant idea. Modularization and layers were a brilliant idea long before the web came around. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ldap module and base64 oncoding

2013-05-26 Thread Michael Ströder
Joseph L. Casale wrote: >> I'm not sure what exactly you're asking for. >> Especially "is not being interpreted as a string requiring base64 encoding" >> is >> written without giving the right context. >> >> So I'm just guessing that this might be the usual misunderstandings with use >> of base64

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> From: usenetm...@solar-empire.de [...] > Not in Python3.x decks = 6 list(range(13 * 4 * decks)) == range(13 * 4 * decks) > False > > Adiaŭ > Marc What does "list(range(13 * 4 * decks))" returns in Python 3?

I want to know how to implement concurrent threads in Python

2013-05-26 Thread Daniel Gagliardi
I want to know how to implement concurrent threads in Python -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-circuit Logic

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: if not allow_zero and abs(x) < sys.float_info.epsilon: print("zero is not allowed") The reason for the order is to do the easy calculation first and the harder one only if the first passes. -- http://mail.python.org/mail

Re: Cutting a deck of cards

2013-05-26 Thread Marc Christiansen
Carlos Nepomuceno wrote: > >> From: usenetm...@solar-empire.de > [...] >> Not in Python3.x > decks = 6 > list(range(13 * 4 * decks)) == range(13 * 4 * decks) >> False > > What does "list(range(13 * 4 * decks))" returns in Python 3?

Re: Short-circuit Logic

2013-05-26 Thread Roy Smith
In article , Terry Jan Reedy wrote: > On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: > > > if not allow_zero and abs(x) < sys.float_info.epsilon: > > print("zero is not allowed") > > The reason for the order is to do the easy calculation first and the > harder one only i

Re: serialize a class to XML and back

2013-05-26 Thread Chris Rebert
On May 23, 2013 3:42 AM, "Schneider" wrote: > > Hi list, > > how can I serialize a python class to XML? Plus a way to get the class back from the XML? There's pyxser: http://pythonhosted.org/pyxser/ > My aim is to store instances of this class in a database. Honestly, I would avoid XML if you c

Re: Output from to_bytes

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 8:02 AM, Mok-Kong Shen wrote: for k in range(8,12,1): print(k.to_bytes(2,byteorder='big')) http://bugs.python.org/issue9951 http://bugs.python.org/issue3532 import binascii as ba for k in range(8,12,1): print(ba.hexlify(k.to_bytes(2,byteorder='big'))) >>> b'0008' b'0

Re: serialize a class to XML and back

2013-05-26 Thread Roy Smith
In article , Chris Rebert wrote: > On May 23, 2013 3:42 AM, "Schneider" wrote: > > > > Hi list, > > > > how can I serialize a python class to XML? Plus a way to get the class > back from the XML? > > There's pyxser: http://pythonhosted.org/pyxser/ > > > My aim is to store instances of this cl

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 12:36 PM, Νίκος Γκρ33κ wrote: This is the code that although correct becaus it works with englisg(standARD ASCII letters) it wont with Greek: if( log ): name = log # print specific client header info cur.execute('''SELECT hits, money FROM clients WHERE name

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Νίκος Γκρ33κ
I'am receiving this now after some tries: A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. /home/nikos/public_html/cgi-bin/metrites.py in () 139 else: 140 sp = subprocess.Popen(['ma

Re: Future standard GUI library

2013-05-26 Thread Ian Foote
On 26/05/13 20:41, Michael Torrie wrote: On 05/26/2013 11:43 AM, Wolfgang Keller wrote: Maybe it would have been faster to develop, but ultimately less useful and require more development time in the long run. suppose I now want the app natively on my phone (because that's all the rage). It

Re: Cutting a deck of cards

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 3:54 PM, Carlos Nepomuceno wrote: From: usenetm...@solar-empire.de [...] Not in Python3.x decks = 6 list(range(13 * 4 * decks)) == range(13 * 4 * decks) False Adiaŭ Marc What does "list(range(13 * 4 * decks))" returns in Python 3?

Re: Piping processes works with 'shell = True' but not otherwise.

2013-05-26 Thread Chris Rebert
On May 24, 2013 7:06 AM, "Luca Cerone" wrote: > > Hi everybody, > I am new to the group (and relatively new to Python) > so I am sorry if this issues has been discussed (although searching for topics in the group I couldn't find a solution to my problem). > > I am using Python 2.7.3 to analyse the

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Andrew Berg
On 2013.05.26 14:10, Daniel Gagliardi wrote: > I want to know how to implement concurrent threads in Python With the threading module in the standard library. http://docs.python.org/3.3/library/threading.html There are plenty of tutorials on this out there; we'll be happy to help if you're stuck

Re: Future standard GUI library

2013-05-26 Thread Michael Torrie
On 05/26/2013 01:45 PM, Roy Smith wrote: > In article , > Michael Torrie wrote: > >> On good thing web development has brought us is the knowledge that >> modularization and layers are a brilliant idea. > > Modularization and layers were a brilliant idea long before the web came > around. Tru

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Andrew Berg
On 2013.05.26 16:21, Daniel Gagliardi wrote: > shutup bitch! i do know python cannot concurrent threads. want a workaround You're a charming fellow. I'm sure everyone will flock to help you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-circuit Logic

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 4:22 PM, Roy Smith wrote: In article , Terry Jan Reedy wrote: On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: if not allow_zero and abs(x) < sys.float_info.epsilon: print("zero is not allowed") The reason for the order is to do the easy calculation fir

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Νίκος Γκρ33κ
No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', passwd = 'somepass', init_command='SET NAMES UTF8' ) -- http://mail.python.org/mailman/listinfo/python-list

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 7:26 AM, Νίκος Γκρ33κ wrote: > No thi is not a mysql issue becaus ei have this line above for storing and > retrieval form database. > > con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', > passwd = 'somepass', init_command='SET NAMES UTF8' ) Resear

Re: Future standard GUI library

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 5:41 AM, Michael Torrie wrote: > Chuckle. Simple CRUD, eh. Almost all apps involve database CRUD > interactions. And often in highly complex ways using business logic. Right. Sturgeon's Law of Applications. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Solving the problem of mutual recursion

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 5:35 AM, Ian Kelly wrote: > I'm pretty sure that CPython uses the GIL regardless of platform. And > yes you can have multiple OS-level threads, but because of the GIL > only one will actually be running at a time. Other possibilities > include: 6) It's spinning in a func

Re: Cutting a deck of cards

2013-05-26 Thread Mark Lawrence
On 26/05/2013 19:16, Carlos Nepomuceno wrote: Date: Sun, 26 May 2013 10:52:14 -0700 Subject: Cutting a deck of cards From: rvinc...@gmail.com To: python-list@python.org Suppose I have a deck of cards, and I shuffle them import random cards = [] decks =

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Mark Lawrence
On 26/05/2013 22:27, Andrew Berg wrote: On 2013.05.26 16:21, Daniel Gagliardi wrote: shutup bitch! i do know python cannot concurrent threads. want a workaround You're a charming fellow. I'm sure everyone will flock to help you. So "How to win friends and influence people" had two authors.

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Mark Lawrence
On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', passwd = 'somepass', init_command='SET NAMES UTF8' ) No wonder the Greek econ

RE: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Carlos Nepomuceno
> To: python-list@python.org > From: breamore...@yahoo.co.uk [...] > No wonder the Greek economy is so screwed up. > > -- > If you're using GoogleCrap™ please read this > http://wiki.python.org/moin/GoogleGroupsPython. > > Mark Lawrence LOL LOL LOL LOL LOL

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Mark Lawrence
On 26/05/2013 20:10, Daniel Gagliardi wrote: I want to know how to implement concurrent threads in Python google, bing, duckduckgo, yahoo... -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/list

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> To: python-list@python.org > From: breamore...@yahoo.co.uk [...] > Wrong if you're using Python 3 :( > > -- > If you're using GoogleCrap™ please read this > http://wiki.python.org/moin/GoogleGroupsPython. > > Mark Lawrence Thanks guys! I've been delaying

Re: Cutting a deck of cards

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 8:30 AM, Carlos Nepomuceno wrote: > Thanks guys! I've been delaying my dive into Python 3 (because I don't need > it for now) but I'd like to run some code just to learn how different it is > from Python 2 and even other Python flavors. > > So, I'd like to know if it's po

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Chris Angelico
On Mon, May 27, 2013 at 8:21 AM, Mark Lawrence wrote: > On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: >> >> No thi is not a mysql issue becaus ei have this line above for storing and >> retrieval form database. >> >> con = pymysql.connect( db = 'metrites', host = 'localhost', user = 'me', >> passwd = '

Re: serialize a class to XML and back

2013-05-26 Thread Irmen de Jong
On 26-5-2013 22:48, Roy Smith wrote: > The advantage of pickle over json is that pickle can serialize many > types of objects that json can't. The other side of the coin is that > pickle is python-specific, so if you think you'll ever need to read your > data from other languages, pickle is ri

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Mark Lawrence
On 26/05/2013 23:32, Chris Angelico wrote: On Mon, May 27, 2013 at 8:21 AM, Mark Lawrence wrote: On 26/05/2013 22:26, Νίκος Γκρ33κ wrote: No thi is not a mysql issue becaus ei have this line above for storing and retrieval form database. con = pymysql.connect( db = 'metrites', host = 'localh

RE: Cutting a deck of cards

2013-05-26 Thread Carlos Nepomuceno
> Date: Mon, 27 May 2013 08:42:56 +1000 > Subject: Re: Cutting a deck of cards > From: ros...@gmail.com [...] > Easy. Just grab the standard installer and hit it. You'll get two > separate directories (or more; I have \Python26, \Python27, \Python32, > \Pyth

Re: Cutting a deck of cards

2013-05-26 Thread Mark Lawrence
On 26/05/2013 23:42, Chris Angelico wrote: On Mon, May 27, 2013 at 8:30 AM, Carlos Nepomuceno wrote: Thanks guys! I've been delaying my dive into Python 3 (because I don't need it for now) but I'd like to run some code just to learn how different it is from Python 2 and even other Python flav

Python error codes and messages location

2013-05-26 Thread Carlos Nepomuceno
Where can I find all error codes and messages that Python throws (actual codes and messages from exceptions raised by stdlib)? I've already found the module 'errno' and got a dictionary (errno.errorcode) and some system error messages (os.strerror(errno.ENAMETOOLONG)) but there's more I couldn'

Re: Piping processes works with 'shell = True' but not otherwise.

2013-05-26 Thread Luca Cerone
> Could you provide the *actual* commands you're using, rather than the generic > "program1" and "program2" placeholders? It's *very* common for people to get > the tokenization of a command line wrong (see the Note box in > http://docs.python.org/2/library/subprocess.html#subprocess.Popen for s

RE: Piping processes works with 'shell = True' but not otherwise.

2013-05-26 Thread Carlos Nepomuceno
pipes usually consumes disk storage at '/tmp'. Are you sure you have enough room on that filesystem? Make sure no other processes are competing against for that space. Just my 50c because I don't know what's causing Errno 0. I don't even know what are the possible causes of such error. Good luck

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Cameron Simpson
On 26May2013 13:48, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | I'am receiving this now after some tries: | | A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. | | /home/nikos/public_html/cgi-bin/metrites.p

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Cameron Simpson
On 27May2013 10:22, I wrote: | | => 903 self.stdin.write(input) [...] | | self = , self.stdin = <_io.BufferedWriter name=5>, self.stdin.write = , input = 'kdsjfksdjkfjksdjfs\r\n\t' | | TypeError: 'str' does not support the buffer interface | | args = ("'str' does n

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Cameron Simpson
On 26May2013 17:45, Mark Lawrence wrote: | On 26/05/2013 17:10, Νίκος Γκρ33κ wrote: | >Here is the live error log coming form apacher when i request the webpage form browser: | > | >==> /usr/local/apache/logs/error_log <== | >[Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] suexec failure:

Re: serialize a class to XML and back

2013-05-26 Thread Roy Smith
In article <51a28f42$0$15870$e4fe5...@news.xs4all.nl>, Irmen de Jong wrote: > On 26-5-2013 22:48, Roy Smith wrote: > > > The advantage of pickle over json is that pickle can serialize many > > types of objects that json can't. The other side of the coin is that > > pickle is python-specific,

Re: Short-circuit Logic

2013-05-26 Thread Steven D'Aprano
On Sun, 26 May 2013 16:22:26 -0400, Roy Smith wrote: > In article , > Terry Jan Reedy wrote: > >> On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: >> >> > if not allow_zero and abs(x) < sys.float_info.epsilon: >> > print("zero is not allowed") >> >> The reason for the orde

Re: Python error codes and messages location

2013-05-26 Thread Steven D'Aprano
On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: > Where can I find all error codes and messages that Python throws (actual > codes and messages from exceptions raised by stdlib)? There is no list. It is subject to change from version to version, including point releases. Many funct

RE: Python error codes and messages location

2013-05-26 Thread Carlos Nepomuceno
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: Python error codes and messages location > Date: Mon, 27 May 2013 00:53:41 + > To: python-list@python.org > > On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: > >> Where can I find a

  1   2   >