Re: expression form of one-to-many dict?

2004-12-18 Thread Nick Craig-Wood
in range(1000)])' 'map = {} for key, value in sequence: if map.has_key(key): map[key].append(value) else: map[key] = [ value ]' 1000 loops, best of 3: 1.11e+03 usec per loop Not that timing is everything of course ;-) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy "here documents" ??

2004-12-19 Thread Nick Craig-Wood
ying around instead which is much more flexible than perl. You can even pass self.__dict__ if you are in a class method so you can access attributes. >>> class A: pass ... >>> a=A() >>> a.amount=10 >>> a.what="rutabaga" >>> a

Re: Easy "here documents" ??

2004-12-20 Thread Nick Craig-Wood
Jim Hill <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > >I prefer this > > > > ... I'll have %(amount)s %(what)s > > ... for $%(cost)s please""" % locals() > > Looks pretty slick. This might just be what I need. >

Re: regular expression: perl ==> python

2004-12-22 Thread Nick Craig-Wood
;float $1\n"; } else { print "unknown thing $line\n"; } Is there an easy way round this? AFAIK you can't assign a variable in a compound statement, so you can't use elif at all here and hence the problem? I suppose you could use a monstrosity like this, which relies on

Re: regular expression: perl ==> python

2004-12-23 Thread Nick Craig-Wood
. xml = re.compile(r""" <([/?!]?\w+) # 1. tags |&(\#?\w+); # 2. entities |([^<>&'\"=\s]+) # 3. text strings (no special characters) |(\s+) # 4. whitespace |(.) # 5. special characters ""&quo

Re: regular expression: perl ==> python

2004-12-23 Thread Nick Craig-Wood
mentation. This is probably what Windows people look at by default but Unix hackers like me expect everything (or at least a hint) to be in the man/pydoc pages. Just noticed in pydoc2.4 a new section MODULE DOCS http://www.python.org/doc/current/lib/module-sre.html Which is at least a hint that you are looking in the wrong place! ...however that page doesn't exist ;-) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue.Queue-like class without the busy-wait

2005-04-01 Thread Nick Craig-Wood
. Processes can share this integer over mmap, via shared segments or because they share memory space, in which case the application is commonly called multithreaded. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue.Queue-like class without the busy-wait

2005-04-03 Thread Nick Craig-Wood
Paul Rubin wrote: > Nick Craig-Wood <[EMAIL PROTECTED]> writes: > > I believe futex is the thing you want for a modern linux. Not > > very portable though. > > That's really cool, but I don't see how it can be a pure userspace > operation if the futex

Re: Queue.Queue-like class without the busy-wait

2005-04-04 Thread Nick Craig-Wood
mode=thread&noheader=1&q=queue+timeout+python#doc_011f680b2dac320c Interesting thread. How about leaving the current threading alone, but adding a pthreads module for those OSes which can use or emulate posix threads? Which is windows and most unixes? -- Nick Craig-Wood <[EMAIL PROTECTED]&g

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Nick Craig-Wood
172b1b50474351364749a33996a81ba8847347a8411b850b79a03018291672aa0945656a159aa6aa0a845531a592005b8a34366b882257107b190969a846474836a9800750778920ba797297a2791101b0685a86bb704b9baa17b055293679843b35215b0a8b1182b611953b080aa5431b219907a8448a81b1a9493245676b88013b470335240859594158621014216! 619553246570601967448b470174b9244892444817453865a4003b5aa7176451aab906 [EMAIL PROTECTED]' -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-18 Thread Nick Craig-Wood
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I'm using GMPY (see code). > > [snip] > > > > If you are using gmpy you might as well do it like this. > >

Re: Nokia to speak at Python-UK next week

2005-04-18 Thread Nick Craig-Wood
ly on topic, but does anyone know if there is a series 80 python? Or if the series 60 python runs on a series 80 phone (eg communicator 9300/9500)? -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Nokia to speak at Python-UK next week

2005-04-19 Thread Nick Craig-Wood
Ville Vainio <[EMAIL PROTECTED]> wrote: > >>>>> "Nick" == Nick Craig-Wood <[EMAIL PROTECTED]> writes: > > Nick> Not entirely on topic, but does anyone know if there is a > Nick> series 80 python? Or if the series 60 python runs on a

Re: Memory leak in python

2005-04-19 Thread Nick Craig-Wood
t; anything. Are there any objects in gc.garbage? Are you writing objects with __del__ methods? If so then that is your problem probably. Have you written any extension modules in C? -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Faster os.walk()

2005-04-20 Thread Nick Craig-Wood
of improvement given that decent OSes have a very good cache for stat results, and that parsing file names is very quick too, compared to python. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting into Python, comming from Perl.

2005-04-25 Thread Nick Craig-Wood
if it is I'd recommend "Dive into Python" by Mark Pilgrim as a good first step. Its available for free in electronic form too. After that you could read Programming Python. Good luck! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python licence again

2005-04-25 Thread Nick Craig-Wood
has <[EMAIL PROTECTED]> wrote: > licence, practice = noun > license, practise = verb Tick ;-) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying tcompile an use the Python 3.4a

2013-11-14 Thread Nick the Gr33k
Will someone please tell me how to install 'pip' My website is not working because modules are missing and the only way i can install them is by installing python's module manager 'pip' but 'yum install python-pip' fails. How would i install the damn thing? These action should be done via pa

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

2013-08-28 Thread Nick the Gr33k
Στις 29/8/2013 7:29 πμ, ο/η Ferrous Cranus έγραψε: Τη Πέμπτη, 29 Αυγούστου 2013 3:59:49 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: To be explicit: chgrp nobody the-file chmod g+w the-file Hello Cameron, ni...@superhost.gr [~/www]# touch err.out ni...@superhost.gr [~/www]# ls -l

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-25 Thread Nick the Gr33k
Στις 25/10/2013 11:46 πμ, ο/η Νίκος Αλεξόπουλος έγραψε: Trace your logs. You've been told this before; are you sure the request is even getting to your server? what do you mean by that Chris? please be more specific. -- What is now proved was at first only imagined! & WebHost

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-25 Thread Nick the Gr33k
Στις 25/10/2013 1:51 μμ, ο/η Chris Angelico έγραψε: On Fri, Oct 25, 2013 at 9:30 PM, Nick the Gr33k wrote: Στις 25/10/2013 11:46 πμ, ο/η Νίκος Αλεξόπουλος έγραψε: Trace your logs. You've been told this before; are you sure the request is even getting to your server? what do you me

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-25 Thread Nick the Gr33k
Στις 25/10/2013 3:11 μμ, ο/η Chris Angelico έγραψε: On Fri, Oct 25, 2013 at 10:46 PM, Nick the Gr33k wrote: Can you reproduce this simple problem on your side to see if it behaves the same way as in me? Like I said at the beginning, no it doesn't. Go forth and wield the Google. C

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-25 Thread Nick the Gr33k
Στις 25/10/2013 3:35 μμ, ο/η Chris Angelico έγραψε: On Fri, Oct 25, 2013 at 11:20 PM, Nick the Gr33k wrote: Στις 25/10/2013 3:11 μμ, ο/η Chris Angelico έγραψε: On Fri, Oct 25, 2013 at 10:46 PM, Nick the Gr33k wrote: Can you reproduce this simple problem on your side to see if it behaves

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-25 Thread Nick the Gr33k
Στις 25/10/2013 5:21 μμ, ο/η Mark Lawrence έγραψε: On 25/10/2013 13:54, Nick the Gr33k wrote: Στις 25/10/2013 3:35 μμ, ο/η Chris Angelico έγραψε: On Fri, Oct 25, 2013 at 11:20 PM, Nick the Gr33k wrote: Στις 25/10/2013 3:11 μμ, ο/η Chris Angelico έγραψε: On Fri, Oct 25, 2013 at 10:46 PM

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-25 Thread Nick the Gr33k
Στις 25/10/2013 6:17 μμ, ο/η Denis McMahon έγραψε: If the client is not sending the expected cookie to the server, then the most likely problem is that the client does not associate that particular cookie with the server url. If this is the case, then the problem is that when you initially sent t

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-25 Thread Nick the Gr33k
Στις 25/10/2013 6:36 μμ, ο/η Joel Goldstick έγραψε: On Fri, Oct 25, 2013 at 11:34 AM, Chris Angelico wrote: On Sat, Oct 26, 2013 at 2:29 AM, Nick the Gr33k wrote: Assiciate the cookie with the url? You mean add a domain directive to the cookie like: Do you understand: 1) what cookies are

Cookie issue(cant fix it with anyhting)

2013-10-26 Thread Nick the Gr33k
Hello i having the following code to try and retrieve the visitor's saved cookie form the browser. [CODE] # initialize cookie and retrieve cookie from clients browser try: cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE'] ) cookieID = cookie['name'].value except: cookieID = 'v

Cookie fucking problem

2013-10-26 Thread Nick the Gr33k
Hello i having the following code to try and retrieve the visitor's saved cookie form the browser. [CODE] # initialize cookie and retrieve cookie from clients browser try: cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE'] ) cookieID = cookie['name'].value except: cookieID = 'v

Printing a drop down menu for a specific field.

2013-10-26 Thread Nick the Gr33k
[QUOTE=turvey]Say your data is like the following: data = [('alice', 1), ('alice', 2), ('bob', 5), ('bob', 10), ('carrie', 3)] Where the first entry is your user and the second entry is a timestamp. Your data is structured basically like this, except I stripped the irrelevant details. [CODE]

Re: Cookie fucking problem

2013-10-26 Thread Nick the Gr33k
Στις 26/10/2013 5:34 μμ, ο/η Mark Lawrence έγραψε: On 26/10/2013 14:27, Nick the Gr33k wrote: Buy a sex manual. No need, i can practice with your mother. -- What is now proved was at first only imagined! & WebHost <http://superhost.gr> -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie fucking problem

2013-10-26 Thread Nick the Gr33k
Στις 26/10/2013 6:21 μμ, ο/η Mark Lawrence έγραψε: On 26/10/2013 15:55, Nick the Gr33k wrote: Στις 26/10/2013 5:34 μμ, ο/η Mark Lawrence έγραψε: On 26/10/2013 14:27, Nick the Gr33k wrote: Buy a sex manual. No need, i can practice with your mother. An interesting combination of stupid

Re: Printing a drop down menu for a specific field.

2013-10-26 Thread Nick the Gr33k
Στις 26/10/2013 5:10 μμ, ο/η Nick the Gr33k έγραψε: [QUOTE=turvey]Say your data is like the following: data = [('alice', 1), ('alice', 2), ('bob', 5), ('bob', 10), ('carrie', 3)] Where the first entry is your user and the second entry is a time

Re: Printing a drop down menu for a specific field.

2013-10-26 Thread Nick the Gr33k
Στις 26/10/2013 9:33 μμ, ο/η ru...@yahoo.com έγραψε: On 10/20/2013 05:30 PM, Νίκος Αλεξόπουλος wrote: try: cur.execute( '''SELECT host, city, useros, browser, ref, hits, lastvisit FROM visitors WHERE counterID = (SELECT ID FROM counters WHERE url = %s) ORDER BY lastvisit DESC''', page )

Re: Printing a drop down menu for a specific field.

2013-10-26 Thread Nick the Gr33k
Στις 27/10/2013 2:31 πμ, ο/η Nick the Gr33k έγραψε: Στις 26/10/2013 9:33 μμ, ο/η ru...@yahoo.com έγραψε: On 10/20/2013 05:30 PM, Νίκος Αλεξόπουλος wrote: try: cur.execute( '''SELECT host, city, useros, browser, ref, hits, lastvisit FROM visitors WHERE counterID = (SELECT I

Re: Printing a drop down menu for a specific field.

2013-10-26 Thread Nick the Gr33k
Στις 27/10/2013 2:52 πμ, ο/η Nick the Gr33k έγραψε: Ah foun it had to change in you code this line: key = host, city, useros, browser, ref to this line: key = host, city, useros, browser so 'ref' wouldnt be calculated in the unique combination key. I'

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-26 Thread Nick the Gr33k
Στις 27/10/2013 4:24 πμ, ο/η Piet van Oostrum έγραψε: Piet van Oostrum writes: Νίκος Αλεξόπουλος writes: There is no set of cookie returned back when visitor comes from a referer. Isn't this strange? No matter if you visit a webpage as a direct hit or via a referer the cookie on the visito

Re: Printing a drop down menu for a specific field.

2013-10-27 Thread Nick the Gr33k
Στις 27/10/2013 6:00 πμ, ο/η ru...@yahoo.com έγραψε: On 10/26/2013 06:11 PM, Nick the Gr33k wrote: Στις 27/10/2013 2:52 πμ, ο/η Nick the Gr33k έγραψε: Ah foun it had to change in you code this line: key = host, city, useros, browser, ref to this line: key = host

Re: Cookie issue(cant fix it with anyhting)

2013-10-27 Thread Nick the Gr33k
Στις 27/10/2013 9:25 μμ, ο/η Benjamin Schollnick έγραψε: Nikos, Hello i having the following code to try and retrieve the visitor's saved cookie form the browser. [CODE] # initialize cookie and retrieve cookie from clients browser try: cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE

Re: Cookie issue(cant fix it with anyhting)

2013-10-27 Thread Nick the Gr33k
Στις 27/10/2013 8:01 μμ, ο/η Denis McMahon έγραψε: On Sat, 26 Oct 2013 15:29:52 +0300, Nick the Gr33k wrote: Hello i having the following code to try and retrieve the visitor's saved cookie form the browser. [CODE] # initialize cookie and retrieve cookie from clients browser try: c

Retrieving possible list for use in a subsequent INSERT

2013-10-31 Thread Nick the Gr33k
# if first time for webpage; create new record( primary key is automatic, hit is defaulted ), if page exists then update record cur.execute('''INSERT INTO counters (url) VALUES (%s) ON DUPLICATE KEY UPDATE hits = hits + 1''', page ) # get the primary key val

Re: Retrieving possible list for use in a subsequent INSERT

2013-10-31 Thread Nick the Gr33k
The error seen form error log is: [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] Traceback (most recent call last): [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] File "/home/nikos/public_html/cgi-bin/metrites.py"

Re: Retrieving possible list for use in a subsequent INSERT

2013-10-31 Thread Nick the Gr33k
Στις 31/10/2013 11:32 πμ, ο/η Nick the Gr33k έγραψε: The error seen form error log is: [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] Traceback (most recent call last): [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93

Re: Retrieving possible list for use in a subsequent INSERT

2013-10-31 Thread Nick the Gr33k
Στις 31/10/2013 1:19 μμ, ο/η Nick the Gr33k έγραψε: Στις 31/10/2013 11:32 πμ, ο/η Nick the Gr33k έγραψε: The error seen form error log is: [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] Traceback (most recent call last): [Thu

Re: Retrieving possible list for use in a subsequent INSERT

2013-10-31 Thread Nick the Gr33k
Στις 31/10/2013 9:22 μμ, ο/η ru...@yahoo.com έγραψε: You set the value of 'downloads' to a list: downloads = [] if data: for torrent in data: downloads.append( torrent ) and when you use 'downloads', use have: INSERT INTO visitors (..

Re: Retrieving possible list for use in a subsequent INSERT

2013-10-31 Thread Nick the Gr33k
Στις 31/10/2013 9:22 μμ, ο/η ru...@yahoo.com έγραψε: You set the value of 'downloads' to a list: downloads = [] if data: for torrent in data: downloads.append( torrent ) and when you use 'downloads', use have: INSERT INTO visitors (..

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-01 Thread Nick the Gr33k
Στις 1/11/2013 12:24 πμ, ο/η Nick the Gr33k έγραψε: Στις 31/10/2013 9:22 μμ, ο/η ru...@yahoo.com έγραψε: You set the value of 'downloads' to a list: downloads = [] if data: for torrent in data: downloads.append( torrent ) and when you use 'downl

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-01 Thread Nick the Gr33k
Στις 31/10/2013 9:22 μμ, ο/η ru...@yahoo.com έγραψε: On 10/31/2013 03:24 AM, Nick the Gr33k wrote: [...] # find out if visitor has downloaded torrents in the past cur.execute('''SELECT torrent FROM files WHERE host = %s''', host ) data = cur

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-01 Thread Nick the Gr33k
Στις 1/11/2013 5:04 μμ, ο/η Nick the Gr33k έγραψε: Στις 1/11/2013 12:24 πμ, ο/η Nick the Gr33k έγραψε: Στις 31/10/2013 9:22 μμ, ο/η ru...@yahoo.com έγραψε: You set the value of 'downloads' to a list: downloads = [] if data: for torrent in data: downlo

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-01 Thread Nick the Gr33k
Στις 1/11/2013 5:56 μμ, ο/η Joel Goldstick έγραψε: On Fri, Nov 1, 2013 at 11:25 AM, Nick the Gr33k wrote: Στις 31/10/2013 9:22 μμ, ο/η ru...@yahoo.com έγραψε: On 10/31/2013 03:24 AM, Nick the Gr33k wrote: [...] # find out if visitor has downloaded torrents in the past cur.execute

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-01 Thread Nick the Gr33k
Στις 1/11/2013 7:07 μμ, ο/η Paul Simon έγραψε: If you have a list of values of the same type, but different values, you need a new table with a foreign key to the table it relates to. This is a relational database question. You can read more here: http://en.wikipedia.org/wiki/Database_normaliz

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-01 Thread Nick the Gr33k
Στις 1/11/2013 9:12 μμ, ο/η Denis McMahon έγραψε: On Thu, 31 Oct 2013 11:32:29 +0200, Nick the Gr33k wrote: The error seen form error log is: [Thu Oct 31 09:29:35 2013] [error] [client 46.198.103.93] pymysql.err.InternalError: (1241, 'Operand should contain 1 column(s)') (cID,

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-02 Thread Nick the Gr33k
Στις 2/11/2013 4:00 πμ, ο/η ru...@yahoo.com έγραψε: On Friday, November 1, 2013 9:04:08 AM UTC-6, Ferrous Cranus wrote: Rurpy can you help me please solve this? is enum or set column types what needed here as proper columns to store 'download' list? I'd help if I could but I don't use MySql an

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-02 Thread Nick the Gr33k
You can see the erro as its appearing here: http://superhost.gr/ Its weird that no single quotes are enclosing the string values though and the other bizarre thign is that 'downloads' list is tryign to fiull in all the movies. -- https://mail.python.org/mailman/listinfo/python-list

How to add a current string into an already existing list

2013-11-02 Thread Nick the Gr33k
Trying to add the current filename into the existent 'downloads' column Somehow i don't think i just use the plus sign into an existing column. We don't try to add numbers here but add an extra string to an already existing array of strings(list). ==

Re: How to add a current string into an already existing list

2013-11-02 Thread Nick the Gr33k
Στις 2/11/2013 3:03 μμ, ο/η Andreas Perstinger έγραψε: On 02.11.2013 12:58, Nick the Gr33k wrote: Trying to add the current filename into the existent 'downloads' column Somehow i don't think i just use the plus sign into an existing column. We don't try to add numbers h

Printing appropriately based on values retrieved

2013-11-02 Thread Nick the Gr33k
for row in newdata: (host, refs, city, useros, browser, visits, hits, downloads) = row if downloads != 'Δεν έχει κατεβάσει ταινία': print( '' ) for n, download in enumerate( downloads ): if n == 0: op_

Re: Printing appropriately based on values retrieved

2013-11-02 Thread Nick the Gr33k
Στις 2/11/2013 8:25 μμ, ο/η Nick the Gr33k έγραψε: for row in newdata: (host, refs, city, useros, browser, visits, hits, downloads) = row if downloads != 'Δεν έχει κατεβάσει ταινία': print( '' ) for n, download in enumerate( downloads ):

Re: How to add a current string into an already existing list

2013-11-04 Thread Nick the Gr33k
Στις 3/11/2013 2:16 μμ, ο/η Roy Smith έγραψε: In article , Gregory Ewing wrote: Nick the Gr33k wrote: I just want a mysql column type that can be eligible to store an array of elements, a list that is, no need for having a seperate extra table for that if we can have a column that can

Re: How to add a current string into an already existing list

2013-11-04 Thread Nick the Gr33k
Στις 5/11/2013 12:46 πμ, ο/η Denis McMahon έγραψε: On Mon, 04 Nov 2013 19:03:58 +0200, Nick the Gr33k wrote: There is no built in support in the python / mysql system for puttinga list straight into a database, because mysql does not have"collection" record type. Does postgresq

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 8:54 πμ, ο/η Nick the Gr33k έγραψε: Στις 5/11/2013 12:46 πμ, ο/η Denis McMahon έγραψε: On Mon, 04 Nov 2013 19:03:58 +0200, Nick the Gr33k wrote: There is no built in support in the python / mysql system for puttinga list straight into a database, because mysql does not have

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:21 πμ, ο/η Chris Angelico έγραψε: On Tue, Nov 5, 2013 at 7:07 PM, Nick the Gr33k wrote: How is ti possible for data to be none iterable? Do you know how to call a method in Python? If not, go back to the beginning of the tutorial and start reading. If so, look through your

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:21 πμ, ο/η Chris Angelico έγραψε: On Tue, Nov 5, 2013 at 7:07 PM, Nick the Gr33k wrote: How is ti possible for data to be none iterable? Do you know how to call a method in Python? If not, go back to the beginning of the tutorial and start reading. If so, look through your

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 11:10 πμ, ο/η M.F. έγραψε: On 11/05/2013 04:54 PM, Nick the Gr33k wrote: === data = cur.fetchall data = cur.fetchall() That is what the stack trace and Christ tried to inform you. for row in data: === The only thing i can understand by looking the

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 11:34 πμ, ο/η Nick the Gr33k έγραψε: Στις 5/11/2013 11:10 πμ, ο/η M.F. έγραψε: On 11/05/2013 04:54 PM, Nick the Gr33k wrote: === data = cur.fetchall data = cur.fetchall() That is what the stack trace and Christ tried to inform you. for row in data

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row of data while the latter returned a list of rows of data. I dont know why it copmains about: TypeError: 'NoneType' o

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 1:49 μμ, ο/η Steven D'Aprano έγραψε: On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k wrote: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a r

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 3:15 μμ, ο/η Dave Angel έγραψε: On Tue, 05 Nov 2013 14:25:41 +0200, Nick the Gr33k wrote: i tried inserting a type function to notify me of the datatype of 'data' but that didnt help too. What did that print show ? In what way didn't it help? It said the type

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 5:45 μμ, ο/η Tim Chase έγραψε: On 2013-11-05 17:39, Nick the Gr33k wrote: data = infile.readlines You're assigning it to the bound function rather than calling the function. Use the "call" operator: data = infile.readlines() -tkc -- infile=open(&qu

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 1:16 μμ, ο/η Dave Angel έγραψε: On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k wrote: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: > Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row

Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
== # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s''', (cID, host) ) data = cur.fetchone() ref

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 7:41 μμ, ο/η Steven D'Aprano έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LIS

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 8:02 μμ, ο/η Denis McMahon έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. Try starting with something simple. The following is a step by step guide to working out how you need to do this. Follow

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:19 μμ, ο/η John Gordon έγραψε: In Nick the Gr33k writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε: In Nick the Gr33k writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:15 πμ, ο/η Piet van Oostrum έγραψε: Nick the Gr33k writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:54 πμ, ο/η John Gordon έγραψε: The code i provided only worked once before it failed and managed to store this: counterID,host,refs,city,userOS,browser,visits,hits,download - 1, 176-92-96-218.adsl.cyta.gr, Euro

Adding 'download' column to existing 'visitors' table (as requested)

2013-11-05 Thread Nick the Gr33k
I have decided to take your advice. I wasn't able to fit those 'lists' of mine into MySQL's varchar() datatype after converting them to long strings and that sads me. My implementation is like the following. I do not use an extra table of downlaods that i asoociate with table visitors with a f

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-05 Thread Nick the Gr33k
Ah great!!! I just examined my other MySQL database which just stored webpages and their corresponding visits and voila. Someone was able to pass values into my counters table: look: http://superhost.gr/?show=stats thats why it didn't had 1 or 2 or 3 as 'counterID' but more values were pre

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-06 Thread Nick the Gr33k
Στις 6/11/2013 9:38 πμ, ο/η Nick the Gr33k έγραψε: Ah great!!! I just examined my other MySQL database which just stored webpages and their corresponding visits and voila. Someone was able to pass values into my counters table: look: http://superhost.gr/?show=stats thats why it didn't

Re: Accessing next/prev element while for looping

2005-12-18 Thread Nick Craig-Wood
other builtin somewhere that provides better functionality > that I'm missing? I suppose you could use itertools... >>> from itertools import * >>> L=range(10) >>> (L1, L2, L3) = tee(L, 3) >>> L2.next() 0 >>> L3.next() 0 >>> L3.next() 1 >

Re: [OT] How can I change Debian's default Python version?

2006-01-05 Thread Nick Craig-Wood
p you using ubuntu's python packages with careful use of apt preferences and sources.list. Or you can swap to ubuntu completely using apt-get! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Cross Compile Mips / Linux

2006-01-11 Thread Nick Craig-Wood
nique to cross build stuff for ARM. I found the debian ARM python quite sufficient for my needs so I didn't have to build that! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: flatten a level one list

2006-01-12 Thread Nick Craig-Wood
"b","c"], "") Traceback (most recent call last): File "", line 1, in ? TypeError: sum() can't sum strings [use ''.join(seq) instead] >>> I've no idea why this limitation is here... perhaps it is because pre python2.4 cal

Re: flatten a level one list

2006-01-13 Thread Nick Craig-Wood
Alex Martelli <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > Except if you are trying to sum arrays of strings... > > > > >>> sum(["a","b","c"], "") > > Traceback (most recent

Re: Addressing a COM port from Python

2006-01-17 Thread Nick Craig-Wood
n my experience -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: add pexpect to the standard library, standard "install" mechanism.

2006-01-20 Thread Nick Craig-Wood
up.py install If on linux you can python setup.py bdist_rpm which builds an .rpm to install which you might prefer. If you want a .deb use alien to convert the rpm However in the case of this package apt-get install python-pexpect works for me on Debian and hence probably on ubuntu

Re: How to delete a Python package

2006-07-13 Thread Nick Craig-Wood
Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-07-12, Nick Vatamaniuc <[EMAIL PROTECTED]> wrote: > > As a rule, if you use a Linux distribution, you should just install > > the package and then remove the package using the package manager. > > That'

Re: time.clock()

2006-07-17 Thread Nick Craig-Wood
0 1.77 1.77 1.77 1.77 time.clock() is elapsed cpu time of just that process. I think the precisions are the other way round on windows. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: range() is not the best way to check range?

2006-07-18 Thread Nick Craig-Wood
"set) That took %.3f seconds: result %s" % (dt, a) start = time.time() a = 1.0 mine = set(range(0, 1)) for i in range(0, 3): if 0 <= i < 1: a += 1 dt = time.time() - start print "comparison) That took %.3f seconds: result %s" % (dt, a) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Tkinter and exceptions

2006-07-25 Thread Nick Craig-Wood
ack(side=TOP, fill=X) Button(self.toolbar, text='Quit', command=self.quit).pack(side=TOP, fill=X) def make_exception(self): raise ValueError("Exception") def make_callback_exception(self): self.bang = 1 if __name__ == "__main__": AppDemo().mainloop() -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter and exceptions

2006-07-26 Thread Nick Craig-Wood
Peter Otten <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > How do you catch general exceptions in a Tkinter program. > Overriding report_callback_exception() seems to work: Thank you. That is exactly what I needed to know! -- Nick Craig-Wood <[EMAIL PROTECTED]

Re: How to force a thread to stop

2006-07-27 Thread Nick Craig-Wood
ead %s running" % self.name _do_stuff(1.0) if __name__ == "__main__": thread1 = KillableThread(name="thread1") thread1.start() _do_stuff(0.5) thread2 = KillableThread(name="thread2") thread2.start() _do_stuff(2.0) thread1.kill() thread1.join() _do_stuff(2.0) thread2.kill() thread2.join() print "Done" -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads vs Processes

2006-07-27 Thread Nick Craig-Wood
ot;"" t = threading.Thread(target=do_child_stuff) t.start() # wait for child to finish t.join() def main(): print "Forking" timeit.main(["-s", "from __main__ import fork_test", "fork_test()"]) print "Threading&qu

Re: subprocess module

2006-07-27 Thread Nick Craig-Wood
;5', '-vframes', '1', '-s', '160x120', '-an', 'video.gif'] p = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE) If you mix the two styles then you are probably heading for trouble with argument quoting. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: PySNMP Thread unsafe?

2006-07-27 Thread Nick Craig-Wood
h. This is surely a job for twisted not threads? You'd be able to poll all 250 devices at once with twisted... This might be helpful (haven't tried it myself though) http://twistedsnmp.sourceforge.net/ -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Nick Craig-Wood
t;abcdefgh\nabc\n") >>> p = subprocess.Popen(["cat"], stdout = subprocess.PIPE, stdin = inp) Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/subprocess.py", line 534, in __init__ (p2cread, p2cwrite, File &qu

Re: Py_BuildValue("I", ...) does not work

2006-08-21 Thread Nick Craig-Wood
cd build/lib.linux-i686-2.4 $ python2.4 Python 2.4.4c0 (#2, Jun 14 2006, 22:35:41) [GCC 4.1.2 20060613 (prerelease) (Debian 4.1.1-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mi

Re: Sending binary pickled data through TCP

2006-10-13 Thread Nick Craig-Wood
\\n, \\t and \\any_char into CR, LF, TAB and any_char""" def _translate(m): return m.group(1).translate(_unescape_mapping) return _unescape_re.sub(_translate, s) (These functions have been through the optimisation mill which is why they may not look immediately like how you might first think of writing them!) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: building extensions for Windows Python

2006-10-13 Thread Nick Craig-Wood
ensions with mingw under linux, using -lpython2.4 which will run under windows. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: building extensions for Windows Python

2006-10-13 Thread Nick Craig-Wood
-the-box'. Neither of those statements are true. It is fairly easy to build python extensions using mingw hosted on linux which work with the standard python.org install - see my other post in this thread. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://

<    8   9   10   11   12   13   14   15   16   17   >