MySQLdb ImportError

2007-08-31 Thread Sjoerd
Hello!

When I try to import the MySQLdb lib python generates an error:

Traceback (most recent call last):
  File "", line 1, in 
import MySQLdb
  File "C:\Python25\lib\site-packages\MySQLdb\__init__.py", line 19,
in 
import _mysql
ImportError: DLL load failed with error code 193

This is on a AMD64 bit machine, when I import it on a 32 bit machine
it works fine.
Is there anyway to fix this? Is there a build for AMD64 bit machines
or is there simply no way
that I can get MySQLdb working on it?

Thanks in advance,
Sjoerd

-- 
http://mail.python.org/mailman/listinfo/python-list


mod_python and pysvn

2007-09-11 Thread Sjoerd
Hello all,

I have a script that uses pySVN. It gets the latest build information.
I want to create a call to that function in a PSP file but everytime I
try I get an error message:

ClientError: Unable to open an ra_local session to URL
Unable to open repository 'file:///P:/tools/builds/repository'

does anyone know how I can fix this?

thanks in advance!
Sjoerd

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: mod_python and pysvn

2007-09-11 Thread Sjoerd
On Sep 11, 7:41 pm, Bjoern Schliessmann  wrote:
> Tim Golden wrote:
> > Sjoerd wrote:
> >> ClientError: Unable to open an ra_local session to URL
> >> Unable to open repository 'file:///P:/tools/builds/repository'
>
> >> does anyone know how I can fix this?
>
> > Usually means that the process which Apache is running under
> > (may well be LocalSystem) doesn't know about or doesn't have
> > access to p:/tools etc.
>
> Isn't this an SVN client error? Seems to me that the repository URL
> is invalid.
>
> Tim, try accessing the repository using svn list from the command
> line.
>
> Regards,
>
> Björn
>
> --
> BOFH excuse #350:
>
> paradigm shift...without a clutch

Thank you both for your replies!
I suspect that if I import the script that the script becomes local
for apache
Who tries to form the path.
The actual command:

client = Client()
repLog = client.log("\\P:\\tools\builds\publish\\")
I used an UNC path. The forming of the repository path must be inside
the pysvn
library.

When I run the script via the command console it returns the right
values.
So I think what Tim replies is quite acurate!
I'm going to try that tomorrow!

Cheers!
Sjoerd

-- 
http://mail.python.org/mailman/listinfo/python-list

test, please ignore

2006-09-20 Thread Sjoerd Mullender
This is a test message from your mailing list administrator.  Please ignore.

-- 
Sjoerd Mullender
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Rounding a number to nearest even

2008-04-15 Thread Sjoerd Mullender
Thomas Dybdahl Ahle wrote:
> On Fri, 2008-04-11 at 03:14 -0700, bdsatish wrote:
>> The built-in function round( ) will always "round up", that is 1.5 is
>> rounded to 2.0 and 2.5 is rounded to 3.0.
>>
>> If I want to round to the nearest even, that is
>>
>> my_round(1.5) = 2# As expected
>> my_round(2.5) = 2# Not 3, which is an odd num
>>
>> I'm interested in rounding numbers of the form "x.5" depending upon
>> whether x is odd or even. Any idea about how to implement it ?
> 
> This seams to work fine:
> evenRound = lambda f: round(f/2.)*2
> 
>>>> [(f*.5, evenRound(f*.5)) for f in xrange(0,20)]
> [(0.0, 0.0),(0.5, 0.0),
> (1.0, 2.0), (1.5, 2.0), (2.0, 2.0), (2.5, 2.0),
> (3.0, 4.0), (3.5, 4.0), (4.0, 4.0), (4.5, 4.0),
> (5.0, 6.0), (5.5, 6.0), (6.0, 6.0), (6.5, 6.0),
> (7.0, 8.0), (7.5, 8.0), (8.0, 8.0), (8.5, 8.0),
> (9.0, 10.0), (9.5, 10.0)]
> 

No, this does not work:
>>> [(f*.25, evenRound(f*.25)) for f in xrange(0,20)]
[(0.0, 0.0), (0.25, 0.0), (0.5, 0.0), (0.75, 0.0), (1.0, 2.0), (1.25,
2.0), (1.5, 2.0), (1.75, 2.0), (2.0, 2.0), (2.25, 2.0), (2.5, 2.0),
(2.75, 2.0), (3.0, 4.0), (3.25, 4.0), (3.5, 4.0), (3.75, 4.0), (4.0,
4.0), (4.25, 4.0), (4.5, 4.0), (4.75, 4.0)]

x.75 should be rounded up.

-- 
Sjoerd Mullender



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Is massive spam coming from me on python lists?

2008-04-21 Thread Sjoerd Mullender
On 2008-04-21 08:01, Brian Vanderburg II wrote:
> I've recently gotten more than too many spam messages and all say 
> Sender: [EMAIL PROTECTED]  I'm wondering 
> if my mail list registration is now being used to spam myself and 
> others.  If so, sorry, but I'm not the one sending messages if other are 
> getting them even though Sender seems to include my address (I'm not 
> sure about mail headers so I don't know how From: is different than 
> Sender:)  Anyway, it seems to be a bunch of spam emails about cracks and 
> stuff.
> 
> Brian Vanderburg II

That is just mailman (the mailing list software) keeping track of 
things.  If there were a bounce, mailman can determine from the address 
of the bounce message (the bounce gets sent back to the Sender, not the 
From) which address bounced.

So *all* python-list messages you get have that Sender.

In other words, these spams do not come from you.

-- 
Sjoerd Mullender
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is massive spam coming from me on python lists?

2008-04-21 Thread Sjoerd Mullender
Torsten Bronger wrote:
> Hallöchen!
> 
> Sjoerd Mullender writes:
> 
>> On 2008-04-21 08:01, Brian Vanderburg II wrote:
>>
>>> I've recently gotten more than too many spam messages and all say
>>> Sender: [EMAIL PROTECTED]  [...]
>> That is just mailman (the mailing list software) keeping track of
>> things.
> 
> By the way, why does mailman change the Message-IDs when tunneling
> postings to the newsgroup?  This destroys the thread structure.

I have no idea.  There is no setting in the mailman administration
interface that I can see that influences this.

Perhaps submit this as a bugreport to mailman?

-- 
Sjoerd Mullender



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Sjoerd Mullender
Grant Edwards <[EMAIL PROTECTED]> writes:

> Could whoever is responsible for the gateway that is grabbing
> my postings off of Usenet and e-mailing them out please fix the
> headers in the mail messages so that I don't get the bounce
> messages?  
> 
> While you're at it, might as well fix it for everybody else
> too. ;)
> 
> Its a bit rude to send out mass e-mail messages with headers
> faked up so that the bounce messages go to somebody else.

Messages you submit to the newsgroup are forwarded to the mailing list.
When mail messages bounce, the MTA (Message Transfer Agent--the program
that handles mail) *should* send the bounce message to whatever is in
the Sender header, and only if that header does not exist, should it
use the From header.  Messages forwarded by the gateway get a Sender
header which points back to the gateway.  In other words, if a message
gets bounced back to the From address, the MTA does it incorrectly.
There is nothing the list administrator can do about it.  You can try
complaining to the postmaster of the bouncing system, but that's about it.

In other words, your question in the first paragraph is already
implemented and was implemented from the beginning.  It is not the
gateway's fault that there are systems that don't follow the standards.

-- 
Sjoerd Mullender, python-list administrator
--
http://mail.python.org/mailman/listinfo/python-list


Re: removing a post

2009-09-27 Thread Sjoerd Mullender
You need to put this request to [email protected].  As mailing list 
administrator I have no access to the archives.


On 2009-09-26 05:32, Mike L wrote:

hello
could you remove this old post, off topic and spam

http://www.mail-archive.com/[email protected]/msg175722.html

thank you


We are your photos. Share us now with Windows Live Photos.
<http://go.microsoft.com/?linkid=9666045>



--
Sjoerd Mullender
--
http://mail.python.org/mailman/listinfo/python-list


Re: regex question on .findall and \b

2009-07-02 Thread Sjoerd Mullender

On 2009-07-02 18:38, Ethan Furman wrote:

Greetings!

My closest to successfull attempt:

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.9.1 -- An enhanced Interactive Python.

In [161]: re.findall('\d+','this is test a3 attempt 79')
Out[161]: ['3', '79']

What I really want in just the 79, as a3 is not a decimal number, but
when I add the \b word boundaries I get:

In [162]: re.findall('\b\d+\b','this is test a3 attempt 79')
Out[162]: []

What am I missing?

~Ethan~


Try this:
>>> re.findall(r'\b\d+\b','this is test a3 attempt 79')
['79']

The \b is a backspace, by using raw strings you get an actual backslash 
and b.


--
Sjoerd Mullender
--
http://mail.python.org/mailman/listinfo/python-list


Re: zip codes

2009-08-17 Thread Sjoerd Mullender
Martin P. Hellwig wrote:
> Shailen wrote:
>> Is there any Python module that helps with US and foreign zip-code
>> lookups? I'm thinking of something that provides basic mappings of zip
>> to cities, city to zips, etc. Since this kind of information is so
>> often used for basic user-registration, I'm assuming functionality of
>> this sort must be available for Python. Any suggestions will be much
>> appreciated.
>>
> There might be an associated can of worms here, for example in the
> Netherlands zip codes are actually copyrighted and require a license if
> you want to do something with them, on the other hand you get a nice SQL
> formatted db to use it. I don't know how this works in other countries
> but I imagine that it is likely to be generally the same.
> 

Also in The Netherlands, ZIP codes are much more fine-grained than in
some other countries: ZIP code plus house number together are sufficient
to uniquely identify an address.  I.e. you don't need the street name.
E.g., my work address has ZIP code 1098 XG and house number 123, so
together they indicate that I work at Science Park 123, Amsterdam.

In other words, a simple city <-> ZIP mapping is not sufficient.

-- 
Sjoerd Mullender



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Stop a thread on deletion

2007-08-08 Thread Sjoerd Op 't Land
Hello all,

I'm using threading for generating video content. The trouble is how to 
kill the thread, because there are multiple (simultaneous) owners of a 
thread. Ideally, a flag would be set when the reference count of the 
thread becomes zero, causing the run() loop to quit. Example:

import threading
import time
import gc

class myThread(threading.Thread):
   def __init__(self):
 self.passedOut = threading.Event()
 threading.Thread.__init__(self)
   def __del__(self):
 self.passedOut.set()
   def run(self):
 i = 0
 while not self.passedOut.isSet():
   i += 1
   print "Hi %d" % i
   time.sleep(0.25)


a = myThread()
a.start()
time.sleep(2.5)
a = None
time.sleep(2.5)

Unfortunately, this doesn't work. When I remove the while-loop, __del__ 
is called, actually. Appearantly there is still some reference to the 
thread while it is running.

I tried gc.get_referrers(self), but it seems to need some parsing. I'm 
not sure how to implement that and I'm not sure whether it will work 
always or not.

Thanks in advance for any suggestion,
Sjoerd Op 't Land
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stop a thread on deletion

2007-08-08 Thread Sjoerd Op 't Land
Dear Cris,

Thanks a lot. This works! (What you didn't know, there was already such 
a 'proxy' object in the design, so it isn't the hack it looks ;).)

Thanks again,
Sjoerd Op 't Land

Chris Mellon schreef:
> On 8/8/07, Sjoerd Op 't Land <[EMAIL PROTECTED]> wrote:
>> Hello all,
>>
>> I'm using threading for generating video content. The trouble is how to
>> kill the thread, because there are multiple (simultaneous) owners of a
>> thread. Ideally, a flag would be set when the reference count of the
>> thread becomes zero, causing the run() loop to quit. Example:
>>
>> import threading
>> import time
>> import gc
>>
>> class myThread(threading.Thread):
>>def __init__(self):
>>  self.passedOut = threading.Event()
>>  threading.Thread.__init__(self)
>>def __del__(self):
>>  self.passedOut.set()
>>def run(self):
>>  i = 0
>>  while not self.passedOut.isSet():
>>i += 1
>>print "Hi %d" % i
>>time.sleep(0.25)
>>
>>
>> a = myThread()
>> a.start()
>> time.sleep(2.5)
>> a = None
>> time.sleep(2.5)
>>
>> Unfortunately, this doesn't work. When I remove the while-loop, __del__
>> is called, actually. Appearantly there is still some reference to the
>> thread while it is running.
>>
>> I tried gc.get_referrers(self), but it seems to need some parsing. I'm
>> not sure how to implement that and I'm not sure whether it will work
>> always or not.
>>
> 
> gc.get_referrers returns a list of object instances that hold a
> reference to the object. The important one in this case is, of course,
> the thread itself. The thread holds a reference to the run method
> which (of course) requires a reference to the object. In other words,
> a running thread cannot be refcounted to zero. You are going to need a
> better method of handling your resources.
> 
> Perhaps instead of holding a reference to the thread, they could hold
> a reference to a proxy object:
> 
> import threading
> import time
> import gc
> import pprint
> 
> class myThread(threading.Thread):
> def __init__(self):
> self.passedOut = threading.Event()
> threading.Thread.__init__(self)
> def run(self):
> i = 0
> while not self.passedOut.isSet():
>   i += 1
>   print "Hi %d" % i
>   time.sleep(1)
> print "stopped"
> 
> 
> class ThreadProxy(object):
> def __init__(self, proxy_for):
> self.proxy_for = proxy_for
> def __del__(self):
> self.proxy_for.passedOut.set()
> def start(self):
> self.proxy_for.start()
-- 
http://mail.python.org/mailman/listinfo/python-list