Re: Sys.path entries

2009-12-30 Thread Marco Salden
On Dec 30, 8:13 pm, Alan Harris-Reid wrote: > Hi there, > > In my sys.path (interpreter only, no application loaded), I have the > following strange entries... > 'C:\\WINDOWS\\system32\\python31.zip'.  This file does not exist > anywhere (although python31.dll does exist in \windows\system32\), wh

Re: Importing bitly.py in twitter-gedit.py

2009-12-30 Thread Vikash Dhankar
any reply to my query .. please send me On Thu, Dec 31, 2009 at 10:28 AM, Vikash Dhankar wrote: > Hi, > I am newbie in the python, I am stuck into a small problem. > > Me and my friend are working on the gedit based Twitter plugin. > http://code.google.com/p/gedit-twitter-plugin/ > > Now I want t

Re: Create attribute from string

2009-12-30 Thread Chris Rebert
On Wed, Dec 30, 2009 at 9:22 PM, AON LAZIO wrote: > Hi, >     I would like to know how we could create attribute from string > > say I want to assign value 0.05 to an object attribute > > I like to input "SIGNIFICANT" and 0.05 and get > object.SIGFICANT equals to 0.05 setattr(obj, "SIGNIFICANT",

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > You know, neither one of those tutorials I followed gave clear, or any, > instruction about putting a > print cookie > statement in the header! How misleading! Don't blame the tutorials for your failure to read them carefully. The tutorial you mentioned (http://www.doughell

Re: getting name of passed reference

2009-12-30 Thread Tim Roberts
Joel Davis wrote: > >Emile, essentially, the situation is that I'm trying to create an API >for consumption scripting. As it stands now, in initial development >they can pass callback function. The idea was to enable them to pass >variables and have the handling function determine the type and jus

Re: subprocess returncode is masked

2009-12-30 Thread Yinon Ehrlich
On Dec 30, 7:59 pm, Nobody wrote: > On Mon, 28 Dec 2009 17:12:23 +0100, Emmanuel wrote: > > I'm using Python 2.6 and the new subprocess module to get the exit value > > of an external executable. It appears the return value given by wait() > > or poll() operations is masked under Unix: I only get

whoops: create a splash window in python

2009-12-30 Thread Ron Croonenberg
sorry about posting with the wrong subject... * hello, is there a way, in python, to create a splash window and when the program has completed disappears by sending a msg to it? (I tried creating two gtk windows but gtk_main doesn't seem to return unless it gets closed.) tia Ron *

Re: I think I found a bug in Python 2.6.4 (in the inspect module)

2009-12-30 Thread Ron Croonenberg
hello, is there a way, in python, to create a splash window and when the program has completed disappears by sending a msg to it? (I tried creating two gtk windows but gtk_main doesn't seem to return unless it gets closed.) tia Ron -- http://mail.python.org/mailman/listinfo/python-list

Create attribute from string

2009-12-30 Thread AON LAZIO
Hi, I would like to know how we could create attribute from string say I want to assign value 0.05 to an object attribute I like to input "SIGNIFICANT" and 0.05 and get object.SIGFICANT equals to 0.05 Thanks -- Passion is my style -- http://mail.python.org/mailman/listinfo/python-list

Thread performance on Python 2.6

2009-12-30 Thread Rodrick Brown
I started dabbling with threads in python and for some odd reason the performance seems extremely poor on my 2 core system. It this a simplified version spawn 2 threads write some data to a file and time the results vs doing the same sequentially. Why is the performance so much slower with the thre

Re: Windows, IDLE, __doc_, other

2009-12-30 Thread Lie Ryan
On 12/30/2009 6:21 AM, W. eWatson wrote: Lie Ryan wrote: On 12/29/2009 5:10 AM, W. eWatson wrote: Lie Ryan wrote: If you're on Windows, don't use the "Edit with IDLE" right-click hotkey since that starts IDLE without subprocess. Use the shortcut installed in your Start menu. When I go to Star

Importing bitly.py in twitter-gedit.py

2009-12-30 Thread Vikash Dhankar
Hi, I am newbie in the python, I am stuck into a small problem. Me and my friend are working on the gedit based Twitter plugin. http://code.google.com/p/gedit-twitter-plugin/ Now I want to add the tiny URL thing into this. I am using the bitly API for this. Its is already available in the python

Re: Dangerous behavior of list(generator)

2009-12-30 Thread Benjamin Kaplan
On Wed, Dec 30, 2009 at 7:01 PM, Steven D'Aprano wrote: > > I don't see why. What's wrong with it? Unless you embed it in a call to > list, or similar, it will explicitly raise StopIteration as expected. > > >> I used to have that a lot in cases where not finding at least one valid >> foo is an ac

Re: I think I found a bug in Python 2.6.4 (in the inspect module)

2009-12-30 Thread Lie Ryan
On 12/30/2009 9:10 AM, inhahe wrote: Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import inspect def a(b=1): pass inspect.getargvalues(a) Traceback (most recent call last):

Re: Bare Excepts

2009-12-30 Thread Steve Holden
Victor Subervi wrote: > On Wed, Dec 30, 2009 at 3:29 PM, Ben Finney > wrote: > > samwyse mailto:samw...@gmail.com>> writes: > > > I inherited some code that used bare excepts *everywhere*. There were > > about 4K lines of code, IIRC, and I think

Re: Cookies

2009-12-30 Thread Steve Holden
Victor Subervi wrote: > You know, neither one of those tutorials I followed gave clear, or any, > instruction about putting a > print cookie > statement in the header! How misleading! > beno > At the risk of repeating myself, if you understood more about what you are trying to do you wouldn't have

Re: Cookies

2009-12-30 Thread Victor Subervi
You know, neither one of those tutorials I followed gave clear, or any, instruction about putting a print cookie statement in the header! How misleading! beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 3:29 PM, Ben Finney > wrote: > samwyse writes: > > > I inherited some code that used bare excepts *everywhere*. There were > > about 4K lines of code, IIRC, and I think that they were more except > > clauses than elses. > > Visual Basic programmers will learn how to writ

Re: Python and FastCGI

2009-12-30 Thread John Nagle
Steffen Ebermann wrote: Hi, this might be a little off topic (could be any other language) but I'm trying to set up Python to use FastCGI instead of plain CGI. The basic setup is no problem but every tutorial (including Python's 'HOWTO Use Python in the web') ends with some basic dispatch fi

Re: Python and FastCGI

2009-12-30 Thread MRAB
Steffen Ebermann wrote: Hi, this might be a little off topic (could be any other language) but I'm trying to set up Python to use FastCGI instead of plain CGI. The basic setup is no problem but every tutorial (including Python's 'HOWTO Use Python in the web') ends with some basic dispatch fi

Python and FastCGI

2009-12-30 Thread Steffen Ebermann
Hi, this might be a little off topic (could be any other language) but I'm trying to set up Python to use FastCGI instead of plain CGI. The basic setup is no problem but every tutorial (including Python's 'HOWTO Use Python in the web') ends with some basic dispatch file and that's it. I guess

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Steve Holden
Brian D wrote: [...] > I'm definitely acquiring some well-deserved schooling -- and it's > really appreciated. I'd seen the "is/is not" preference before, but it > just didn't stick. > Yes, a lot of people have acquired the majority of their Python education from this list - I have certainly learn

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 7:08 pm, MRAB wrote: > Brian D wrote: > > Thanks MRAB as well. I've printed all of the replies to retain with my > > pile of essential documentation. > > > To follow up with a complete response, I'm ripping out of my mechanize > > module the essential components of the solution I got to

Re: Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe executables?

2009-12-30 Thread prakash jp
Hi all, #use py2exe properly to create a single distributable exe #setup.py- create a single exe that runs all boxex from distutils.core import setup import py2exe import sys # no arguments if len(sys.argv) == 1: sys.argv.append("py2exe") # creates a standalone .exe file, no zip files setup(

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread MRAB
Brian D wrote: Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the solution I got to work. The main body of the code passes a URL to

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the solution I got to work. The main body of the code passes a URL to the scrape_record

Re: Dangerous behavior of list(generator)

2009-12-30 Thread Steven D'Aprano
On Wed, 30 Dec 2009 15:18:11 -0800, Tom Machinski wrote: > Thanks for the comment and discussion guys. > > Bottom line, I'm going to have to remove this pattern from my code: > > foo = (foo for foo in foos if foo.bar).next() I don't see why. What's wrong with it? Unless you embed it in a call

Re: class version of func_globals?

2009-12-30 Thread Jan Kaliszewski
29-12-2009 samwyse wrote: On Dec 29, 5:18 am, Dave Angel wrote: samwyse wrote: > Is there any way to get the global namespace of the module in which a > class was defined?  Answers for both Python 2.x and 3.x will be > cheerfully accepted. I don't know if it's the same in general, but consid

Re: Dangerous behavior of list(generator)

2009-12-30 Thread Tom Machinski
Thanks for the comment and discussion guys. Bottom line, I'm going to have to remove this pattern from my code: foo = (foo for foo in foos if foo.bar).next() I used to have that a lot in cases where not finding at least one valid foo is an actual fatal error. But using StopIteration to signal

Re: Thanks for the help not given :)

2009-12-30 Thread Aahz
In article , J wrote: >> Jon Clements wrote: >> >>> You have a bear that likes a Python? The one I have just keeps going >>> on about Piglet and eating my honey reserves... > >As for Jon, and Aahz, I'd try the teddy bear approach, but the last >one I knew led me down the dark path to Perl and thu

Re: The infamous "distutils has already been patched by" error

2009-12-30 Thread Aahz
[p&e] In article , David <71da...@libero.it> wrote: > >I am writing these notes because there is little or no documentation about >this annoying problem. > >The error message in subject appears when you try to get the list of >installed modules under the help() enviroment. Please file a report

Re: the need for 64 bits

2009-12-30 Thread Aahz
In article , Cameron Simpson wrote: >On 29Dec2009 21:42, Aahz wrote: >| In article ><8950e4a5-f630-4ffb-b7ed-5c539913a...@a6g2000yqm.googlegroups.com>, >| Mensanator wrote: >| >Ah, the 8 GB Mac wouldn't have helped. Glad I didn't spend the extra >| >$1000. >| >| It's almost always cheaper to

Re: detect interactivity

2009-12-30 Thread Steven D'Aprano
On Wed, 30 Dec 2009 14:42:12 +0100, Vito 'ZeD' De Tullio wrote: > Steven D'Aprano wrote: > > >>> if I run 'python <<< "import sys; print(sys.ps1)"', I get an error. >> >> Of course you do, because you're not running interactively > > Excuse me, why do you say that? Two reasons. First, becaus

Re: Dynamic text color

2009-12-30 Thread John Posner
On Wed, 30 Dec 2009 12:58:06 -0500, Dave McCormick wrote: Hi All, I am new to Python and the list so I hope I am posting this correctly... I am working on a way to have text automatically formated in a Tkiniter Text widget and would like some input on my code. Currently I am using Python

Re: DST and datetime

2009-12-30 Thread Ben Finney
"W. eWatson" writes: > =Program > from datetime import datetime, timedelta > import time > > DST_dict = { # West coast, 8 hours from Greenwich for PST > 2007:("2007/03/11 02:00:00", "2007/11/04 02:00:00"), > 2008:("2008/03/09 02:00:00", "2008/11/02 02

Re: Bare Excepts

2009-12-30 Thread Ben Finney
samwyse writes: > I inherited some code that used bare excepts *everywhere*. There were > about 4K lines of code, IIRC, and I think that they were more except > clauses than elses. Visual Basic programmers will learn how to write “ON ERROR RESUME NEXT” http://www.vbinfozine.com/a_onerror.shtml>

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 12:31 pm, Philip Semanchuk wrote: > On Dec 30, 2009, at 11:00 AM, Brian D wrote: > > > > > I'm actually using mechanize, but that's too complicated for testing > > purposes. Instead, I've simulated in a urllib2 sample below an attempt > > to test for a valid URL request. > > > I'm attem

DST and datetime

2009-12-30 Thread W. eWatson
Try this. It works for me and my application. =Program from datetime import datetime, timedelta import time DST_dict = { # West coast, 8 hours from Greenwich for PST 2007:("2007/03/11 02:00:00", "2007/11/04 02:00:00"), 2008:("2008/03/09 02:00:00", "2

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-30 Thread Giampaolo Rodola'
On 30 Dic, 18:52, MrJean1 wrote: > Brendan, > > The timeout argument of the FTP class (and the connect method) is used > only to establish the connection to FTP sockets.  If the timeout > expires, an error called socket.timeout is raised. > > AFAIK, the timeout argument does not limit FTP transfer

Sys.path entries

2009-12-30 Thread Alan Harris-Reid
Hi there, In my sys.path (interpreter only, no application loaded), I have the following strange entries... 'C:\\WINDOWS\\system32\\python31.zip'. This file does not exist anywhere (although python31.dll does exist in \windows\system32\), where could it have come from? 'C:\\program files\\py

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread MRAB
Brian D wrote: On Dec 30, 11:06 am, samwyse wrote: On Dec 30, 10:00 am, Brian D wrote: What I don't understand is how to test for a valid URL request, and then jump out of the "while True" loop to proceed to another line of code below the loop. There's probably faulty logic in this approach.

Re: Portable way to tell if a process is still alive

2009-12-30 Thread Nobody
On Tue, 29 Dec 2009 12:35:11 +0430, Laszlo Nagy wrote: > Suppose we have a program that writes its process id into a pid file. > Usually the program deletes the pid file when it exists... But in some > cases (for example, killed with kill -9 or TerminateProcess) pid file is > left there. I woul

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Philip Semanchuk
On Dec 30, 2009, at 11:00 AM, Brian D wrote: I'm actually using mechanize, but that's too complicated for testing purposes. Instead, I've simulated in a urllib2 sample below an attempt to test for a valid URL request. I'm attempting to craft a loop that will trap failed attempts to request a U

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 11:06 am, samwyse wrote: > On Dec 30, 10:00 am, Brian D wrote: > > > What I don't understand is how to test for a valid URL request, and > > then jump out of the "while True" loop to proceed to another line of > > code below the loop. There's probably faulty logic in this approach. I >

Re: subprocess returncode is masked

2009-12-30 Thread Nobody
On Mon, 28 Dec 2009 17:12:23 +0100, Emmanuel wrote: > I'm using Python 2.6 and the new subprocess module to get the exit value > of an external executable. It appears the return value given by wait() > or poll() operations is masked under Unix: I only get the lower 8 bits. > So an exit value of

Dynamic text color

2009-12-30 Thread Dave McCormick
Hi All, I am new to Python and the list so I hope I am posting this correctly... I am working on a way to have text automatically formated in a Tkiniter Text widget and would like some input on my code. Currently I am using Python 2.5 because the server I use has that installed. Tkinter is tk

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-30 Thread MrJean1
Brendan, The timeout argument of the FTP class (and the connect method) is used only to establish the connection to FTP sockets. If the timeout expires, an error called socket.timeout is raised. AFAIK, the timeout argument does not limit FTP transfers. To impose a time limit on FTP transfers, t

Re: socket programming

2009-12-30 Thread Mark Tolonen
"Zubin Mithra" wrote in message news:8e7c74320912300315r625f4c89kb8002e4b8c384...@mail.gmail.com... The code snippet i have pasted at, http://paste.pocoo.org/show/160555/ produces a traceback which also has been pasted at the above link. The snippet attempts at socket programming using OOPs

Re: Simple distributed example for learning purposes?

2009-12-30 Thread Nobody
On Sat, 26 Dec 2009 20:06:02 +, Tim Golden wrote: > I'm trying to come up with something which will illustrate > the usefulness of a distributed processing model. Since I > may not be using the term "distributed" exactly, my > criteria are: > > * It should be clear that the application produc

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:51 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Comments from a left-brain thinker without any concept of how difficult > > it is for a right-brain thinker to think like you. Care to compare > > poetry? I'd bury you. > > That may be so, but the difference is that

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:51 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Comments from a left-brain thinker without any concept of how difficult > > it is for a right-brain thinker to think like you. Care to compare > > poetry? I'd bury you. > > That may be so, but the difference is that

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread samwyse
On Dec 30, 10:00 am, Brian D wrote: > What I don't understand is how to test for a valid URL request, and > then jump out of the "while True" loop to proceed to another line of > code below the loop. There's probably faulty logic in this approach. I > imagine I should wrap the URL request in a fu

Re: Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe executables?

2009-12-30 Thread kakarukeys
I tried on a fresh XP on VM. I moved all dlls in C:\WINDOWS\WinSxS which are in the file handles shown by Process Explorer including the 3 CRT dlls to the my dist folder and the two subfolders suggested by http://wiki.wxpython.org/py2exe. It didn't work out. My app couldn't start. Windows XP gave a

Solved: TypeError: startView() takes exactly 1 argument (3 given)

2009-12-30 Thread Ron Croonenberg
ok, problem solved. In the directory the plugin lives I have(had) a directory called 'backup' to save things just in case I mess up. Guess what, RB apparently looks into that directory too and uses the class, py file, it finds there instead of the one I am making changes to. Dave Angel wro

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:43 PM, Carsten Haese wrote: > Anyway, the likely answer is that you guessed incorrectly. As I said > before, you need to make sure that the cookie is printed as part of the > page headers. I'll give you one last hint: The page header is where > you're printing the "Conte

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > Comments from a left-brain thinker without any concept of how difficult > it is for a right-brain thinker to think like you. Care to compare > poetry? I'd bury you. That may be so, but the difference is that Steve is not trying to earn a living writing poetry as far as I kn

Re: call to pypcap in separate thread blocks other threads

2009-12-30 Thread Dmitry Teslenko
On Wed, Dec 30, 2009 at 18:25, aspineux wrote: > On Dec 30, 3:07 pm, Dmitry Teslenko wrote: >> On Wed, Dec 30, 2009 at 16:18, aspineux wrote: >> > On Dec 30, 1:34 pm, Dmitry Teslenko wrote: >> >> Hello! >> >> I'm making gui gtk application. I'm using pypcap >> >> (http://code.google.com/p/pypca

Re: call to pypcap in separate thread blocks other threads

2009-12-30 Thread Grant Edwards
On 2009-12-30, Dmitry Teslenko wrote: > I'm making gui gtk application. I'm using pypcap > (http://code.google.com/p/pypcap/) to sniff some network packets. > To avoid gui freezing I put pcap call to another thread. > Pypcap call looks like: > > pc = pcap.pcap() > pc.setfilter('tcp') > for ts, pk

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > I've revised the code thus: > > cookie = os.environ.has_key('HTTP_COOKIE') > if not cookie: > cookie = Cookie.SimpleCookie() > cExpires, cPath, cComment, cDomain, cMaxAge, cVersion = myCookie() > cookie['lastvisit'] = str(time.time()) > cookie['lastvisit

Re: regex object limitations/behavior for large regexes?

2009-12-30 Thread Aaron Watters
Sorry, I should have looked harder. I found this: http://bugs.python.org/issue1160 It looks exactly like my use case. drat. -- Aaron Watters http://whiffdoc.appspot.com === less is more. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:23 PM, Steve Holden wrote: > Victor Subervi wrote: > > On Wed, Dec 30, 2009 at 9:23 AM, Jean-Michel Pichavant > [...] > > In your example you must lookt at your sql module documentation to > > know which kind of exception it can throw. > > > > > > Or just throw

Re: Any way to use cProfile in a multi-threaded program?

2009-12-30 Thread Jonathan Hartley
On Dec 30, 3:00 pm, mk wrote: > I'm stumped; I read somewhere that one would have to modify Thread.run() >   method but I have never modified Python methods nor would I really > want to do it. > > Is there any way to start cProfile on each thread and then combine the > stats? > > Regards, > mk W

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:19 PM, Steve Holden wrote: > Carsten Haese wrote: > I will point out again, without the least expectation that it will do > any good, that the reason this problem has occurred is that Victor > simply refuses to take the time to absorb the principles of what he is > atte

Re: Bare Excepts

2009-12-30 Thread Steve Holden
Victor Subervi wrote: > On Wed, Dec 30, 2009 at 9:23 AM, Jean-Michel Pichavant [...] > In your example you must lookt at your sql module documentation to > know which kind of exception it can throw. > > > Or just throw the exception once and grab it. Okay, thanks ;) > beno > Now *that* i

regex object limitations/behavior for large regexes?

2009-12-30 Thread Aaron Watters
I'm thinking of a design which automatically generates regex objects which are essentially disjunctions of simple pattern alternatives. The number of alternatives might conceivably run into the thousands or more. This raises the question: do regex objects behave nicely when the regex gets very la

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 11:54 AM, Carsten Haese wrote: > Victor Subervi wrote: > > Here again is my code: > > > > #! /usr/bin/python > > > > import string > > import cgitb; cgitb.enable() > > import MySQLdb > > import cgi > > import sys,os > > sys.path.append(os.getcwd()) > > from login import log

Re: Cookies

2009-12-30 Thread Steve Holden
Carsten Haese wrote: > Victor Subervi wrote: [...] > Pardon me for not being able to read your mind. The code you're now > posting is significantly more code than your first post included. The > line that I had determined to be missing is in fact not missing, you > just didn't bother to post your a

How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
I'm actually using mechanize, but that's too complicated for testing purposes. Instead, I've simulated in a urllib2 sample below an attempt to test for a valid URL request. I'm attempting to craft a loop that will trap failed attempts to request a URL (in cases where the connection intermittently

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > Here again is my code: > > #! /usr/bin/python > > import string > import cgitb; cgitb.enable() > import MySQLdb > import cgi > import sys,os > sys.path.append(os.getcwd()) > from login import login > import datetime, Cookie, random > from particulars import title > from te

multithreading, performance, again...

2009-12-30 Thread mk
Hello everyone, I have figured out (sort of) how to do profiling of multithreaded programs with cProfile, it goes something like this: #!/usr/local/bin/python import cProfile import threading class TestProf(threading.Thread): def __init__(self, ip): threading.Thread.__init__(sel

Re: TypeError: startView() takes exactly 1 argument (3 given)

2009-12-30 Thread Ron Croonenberg
Dave Angel wrote: Ron Croonenberg wrote: Hello, I am trying to write a plugin for Rhythmbox in python and run into a 'strange' problem. For a method (an action for clicking a button) I started a method and however many arguments I use, it keeps giving me the same error: 'TypeError: start

Re: call to pypcap in separate thread blocks other threads

2009-12-30 Thread aspineux
On Dec 30, 3:07 pm, Dmitry Teslenko wrote: > On Wed, Dec 30, 2009 at 16:18, aspineux wrote: > > On Dec 30, 1:34 pm, Dmitry Teslenko wrote: > >> Hello! > >> I'm making gui gtk application. I'm using pypcap > >> (http://code.google.com/p/pypcap/) to sniff some network packets. > >> To avoid gui fr

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:56 AM, Carsten Haese wrote: > So, guess again. The "trivial example" has three more lines of code. One > of them is unlike any line you have in your code. That's the line > responsible for producing the "Set-Cookie" header, and that's the line > you're missing. > So you'

Any way to use cProfile in a multi-threaded program?

2009-12-30 Thread mk
I'm stumped; I read somewhere that one would have to modify Thread.run() method but I have never modified Python methods nor would I really want to do it. Is there any way to start cProfile on each thread and then combine the stats? Regards, mk -- http://mail.python.org/mailman/listinfo/

Re: How to write simple code to match strings?

2009-12-30 Thread Stefan Behnel
Steven D'Aprano, 30.12.2009 07:01: def _re_match_items(s): # Setup some regular expressions. COMMON_RE = r'\$?([-+]?[0-9,]*\.?[0-9,]+)' FLOAT_RE = COMMON_RE + '$' BRACKETED_FLOAT_RE = r'\(' + COMMON_RE + r'\)$' DATE_RE = r'\d{1,2}-\w+-\d{1,2}$' mo = re.match(FLOAT_RE, s)

Re: Bare Excepts

2009-12-30 Thread samwyse
On Dec 30, 7:23 am, Jean-Michel Pichavant wrote: > Rule N°2: > dont use BARE EXCEPT, or you'll piss off MRAB for good :o). Beside from > kidding, don't use bare except. I inherited some code that used bare excepts *everywhere*. There were about 4K lines of code, IIRC, and I think that they were

Re: call to pypcap in separate thread blocks other threads

2009-12-30 Thread Dmitry Teslenko
On Wed, Dec 30, 2009 at 16:18, aspineux wrote: > On Dec 30, 1:34 pm, Dmitry Teslenko wrote: >> Hello! >> I'm making gui gtk application. I'm using pypcap >> (http://code.google.com/p/pypcap/) to sniff some network packets. >> To avoid gui freezing I put pcap call to another thread. >> Pypcap call

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > On Tue, Dec 29, 2009 at 3:43 PM, Carsten Haese > wrote: > You apparently haven't followed the tutorials carefully enough. You do > know that a cookie is a piece of information that's stored in your > browser, don't you? So tell me

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:23 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > > On Wed, Dec 30, 2009 at 9:09 AM, Victor Subervi > > victorsube...@gmail.com>> wrote: >> >> >>Anyway, you should definitely use a coding rule checker, like >>pylint or pycke

Re: detect interactivity

2009-12-30 Thread Vito 'ZeD' De Tullio
Steven D'Aprano wrote: >> if I run 'python <<< "import sys; print(sys.ps1)"', I get an error. > > Of course you do, because you're not running interactively Excuse me, why do you say that? -- By ZeD -- http://mail.python.org/mailman/listinfo/python-list

Re: Bare Excepts

2009-12-30 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Wed, Dec 30, 2009 at 9:09 AM, Victor Subervi mailto:victorsube...@gmail.com>> wrote: Anyway, you should definitely use a coding rule checker, like pylint or pyckeck. It would sometimes point you into the correct direction. For instance, pylint will tell you

Re: call to pypcap in separate thread blocks other threads

2009-12-30 Thread aspineux
On Dec 30, 1:34 pm, Dmitry Teslenko wrote: > Hello! > I'm making gui gtk application. I'm using pypcap > (http://code.google.com/p/pypcap/) to sniff some network packets. > To avoid gui freezing I put pcap call to another thread. > Pypcap call looks like: > > pc = pcap.pcap() > pc.setfilter('tcp')

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:09 AM, Victor Subervi wrote: > >> Anyway, you should definitely use a coding rule checker, like pylint or > pyckeck. It would sometimes point you into the correct direction. For > instance, pylint will tell you that except: pass is often (not always) a > clue for bad desi

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:04 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > >> Hi; >> I'll trouble-shoot bare excepts as I work on new code. I'll trouble-shoot >> the others that don't (seem to) cause problems later. Here's a new one: >> >>for optionsStore

Re: Bare Excepts

2009-12-30 Thread Jean-Michel Pichavant
Victor Subervi wrote: Hi; I'll trouble-shoot bare excepts as I work on new code. I'll trouble-shoot the others that don't (seem to) cause problems later. Here's a new one: for optionsStore, storeOptions in ourOptions().iteritems(): if store == optionsStore: for option in sto

call to pypcap in separate thread blocks other threads

2009-12-30 Thread Dmitry Teslenko
Hello! I'm making gui gtk application. I'm using pypcap (http://code.google.com/p/pypcap/) to sniff some network packets. To avoid gui freezing I put pcap call to another thread. Pypcap call looks like: pc = pcap.pcap() pc.setfilter('tcp') for ts, pkt in pc: spkt = str(pkt) ... Sa

Re: detect interactivity

2009-12-30 Thread Roald de Vries
On Dec 30, 2009, at 4:10 AM, Steve Holden wrote: Roald de Vries wrote: On Dec 30, 2009, at 2:28 AM, Dave Angel wrote: Roald de Vries wrote: On Dec 29, 2009, at 8:34 PM, Dave Angel wrote: Antoine Pitrou wrote: Le Tue, 29 Dec 2009 16:09:58 +0100, Roald de Vries a écrit : Dear all, Is it

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-30 Thread Giampaolo Rodola'
On 14 Dic, 20:08, Brendan wrote: > I was quite happy to see that ftplib in Python 2.6 now has a timeout > parameter. With large file downloads my script would often hang, > presumably from timing out. Now that there is a timeout parameter, how > would I detect when a timeout occurs? The socket ob

Re: How to write simple code to match strings?

2009-12-30 Thread Steven D'Aprano
On Tue, 29 Dec 2009 23:07:15 -0800, beginner wrote: >> def convert_data_item(s): >>     if s = '-': [...] > I don't know if it should be s=='-' or s='-'. I thought == means equal > and = means assignment? Er, you're absolutely right. Sorry for that, that's an embarrassing brain-fart. I don't kno

Re: Absolute beginner

2009-12-30 Thread Luc
Also thanks Ben and Simon for your help ! On Dec 30, 1:07 pm, Luc wrote: > Thanks Krister ! > Should have read specific 3.1 documentation :-(  . > > Regards,  Luc > > On Dec 30, 12:56 pm, Krister Svanlund > wrote: > > > In Python 3 the syntax for print has changed to print() so just put > > brac

Re: Absolute beginner

2009-12-30 Thread Luc
Thanks Krister ! Should have read specific 3.1 documentation :-( . Regards, Luc On Dec 30, 12:56 pm, Krister Svanlund wrote: > In Python 3 the syntax for print has changed to print() so just put > braces around the string and you'r good to go! > > On Wed, Dec 30, 2009 at 12:48 PM,   wrote: >

Re: Absolute beginner

2009-12-30 Thread Ben Finney
lucbo...@hotmail.com writes: > I installed python 3.1 on Windows Vista PC. Thank you for this information, it's essential to solving the problem. > Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more inform

Re: Absolute beginner

2009-12-30 Thread Simon Brunning
2009/12/30 : > At a dos-prompt : > > Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. print "Hello" >  File "", line 1 >    print "Hello" >                ^ > SyntaxError: invali

Re: Absolute beginner

2009-12-30 Thread Krister Svanlund
In Python 3 the syntax for print has changed to print() so just put braces around the string and you'r good to go! On Wed, Dec 30, 2009 at 12:48 PM, wrote: > Hi there, > I installed python 3.1 on Windows Vista PC. > Am an absolute beginner with Python. > This is my problem : > > In Idle : > > Py

Absolute beginner

2009-12-30 Thread lucbonne
Hi there, I installed python 3.1 on Windows Vista PC. Am an absolute beginner with Python. This is my problem : In Idle : Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> print "Hello" Syntax

socket programming

2009-12-30 Thread Zubin Mithra
The code snippet i have pasted at, http://paste.pocoo.org/show/160555/ produces a traceback which also has been pasted at the above link. The snippet attempts at socket programming using OOPs concepts. Please help. Thankx in advance Zubin Mithra -- http://mail.python.org/mailman/listinfo/python

Bare Excepts

2009-12-30 Thread Victor Subervi
Hi; I'll trouble-shoot bare excepts as I work on new code. I'll trouble-shoot the others that don't (seem to) cause problems later. Here's a new one: for optionsStore, storeOptions in ourOptions().iteritems(): if store == optionsStore: for option in storeOptions: try:

Re: Cookies

2009-12-30 Thread Victor Subervi
On Tue, Dec 29, 2009 at 3:43 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Hi; > > I have these lines: > > > > cookie = os.environ.get('HTTP_COOKIE') > > if not cookie: > > cookie = Cookie.SimpleCookie() > > cExpires, cPath, cComment, cDomain, cMaxAge, cVersion = myCookie() > >

Re: Another Sets Problem

2009-12-30 Thread Victor Subervi
On Tue, Dec 29, 2009 at 6:08 PM, Emile van Sebille wrote: > On 12/29/2009 12:52 PM Victor Subervi said... > >> On Tue, Dec 29, 2009 at 4:30 PM, Carsten Haese > > wrote: >>You need to rethink your priorities. Understanding your code is a >>prerequisite, not

Re: Portable way to tell if a process is still alive

2009-12-30 Thread Michel Claveau - MVP
Hi! For Windows, you can use the command-line tasklist Example: tasklist tasklist /FI "IMAGENAME eq iexplore.exe" tasklist /FI "PID eq 4044" /FO LIST The last line is for known PID. Prior for search by (exe's) name. Note than STATUS give if the process is RUNNING / NOT RESPONDING / etc

  1   2   >