python sqlite THREADSAFE?

2007-09-08 Thread EuGeNe Van den Bulke
Hi,

Is the sqlite distributed with Python 2.5 compiled with the 
-DTHREADSAFE=1 flag? My gutt feeling is Windows (yes) MacOS/Linux (no) 
but ...

If it is not on MacOS/Linux, how do I go about replacing the sqlite so 
file with a threadsafe sqlite?

Thanks,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ActiveRecord for Python/MySQL

2007-08-26 Thread EuGeNe Van den Bulke
Devraj wrote:
 My application uses MySQL as a backend and am using the MySQL/Python
 bindings. Are there any libraries that provide a database abstraction
 layer like Activerecords for Python?'

SQLObject
SQLAclhemy
DejaVu
Storm

Google for Python ORM you may find more!

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ORM layer

2007-06-29 Thread EuGeNe Van den Bulke
David wrote:
 I am looking for an ORM for Python that fulfills a few simple needs.

* SQLObject
* SQLAlchemy (+Elixir)
* DejaVu

There are probably others but these are the most commonly used AFAIK.

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: poplib.retr doens't flag message as read

2007-06-20 Thread EuGeNe Van den Bulke
Gabriel Genellina wrote:
 The POP protocol has no concept of read or unread messages; the LIST 
 command simply shows all existing messages. 

My mistake, I guess I was confused by the documentation

retr( which) Retrieve whole message number which, and set its seen flag. 
Result is in form (response, ['line', ...], octets).

What is the seen flag? Nothing it seems 
http://mail.python.org/pipermail/python-list/2005-July/329888.html

Thanks for your help,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


poplib.retr doens't flag message as read

2007-06-19 Thread EuGeNe Van den Bulke
Hi there,

I am trying to use the poplib library to get emails using the retr 
method. The small program bellow works but the message aren't flagged as 
read which puzzles me. I believe the pop server is qmail 1.0.6 / 
vpopmail 5.2.1 and I am running the following script on Windows using 
Pyhton 2.5.

import poplib
import email

pop = poplib.POP3('mail.server.com')
pop.user('[EMAIL PROTECTED]')
pop.pass_('password')
status, msg_list, octets = pop.list()

for msg_number in [msg.split(' ')[0] for msg in msg_list]:
 status, lines, octets = pop.retr(msg_number)
 msg = email.message_from_string('\n'.join(lines))

 if not msg.is_multipart() and msg.get_content_type() == 'text/plain':
 print msg.get('Subject')
 print msg.get_payload()

pop.quit()

Why aren't the message flagged as read? Is there a way to manually mark 
them read?

Thanks,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: file / module / package - import problem

2007-05-31 Thread EuGeNe Van den Bulke
aspineux wrote:
 import os.path
 
 file=open(os.path.join(os.path.dirname(__file__), 'hauteur.yaml'))

Thanks that worked ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


file / module / package - import problem

2007-05-30 Thread EuGeNe Van den Bulke
Hi there,

I have a problem which could be a bad design on my behalf but I am not 
sure so ...

I have a package WMI which contains a module hauteur.py which, when 
imported, load data from a file located in WMI/data/. In hauteur.py I 
call open('data/hauteur.yaml').

test.py
WMI/
 hauteur.py
 data/
 hauteur.yaml
 lot.py

It works well when hauteur is imported in lot.py but if I try import 
WMI.hauteur in test.py it doesn't work because it looks for the 
hauteur.yaml file in the wrong place.

Is there a way to tell a module in a package to look for a file in a 
specific place i.e. a within package location?

Thanks,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: preferred windows text editor?

2007-05-09 Thread EuGeNe Van den Bulke
T. Crane wrote:
 Right now I'm using Notepad++.  What are other people using?
 
 trevis 
 
 
VIM here as well ... here we go again :P

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


base64 and unicode

2007-05-04 Thread EuGeNe Van den Bulke
Hi,

I am trying to convert the file hebrew.b64 attached into hebrew.lang 
(text file usable by Inline Search http://www.ieforge.com/InlineSearch 
for localization purposes.

  import base64
  base64.decode(file(hebrew.b64,r),file(hebrew.lang,w))

It runs but the result is not correct: some of the lines in hebrew.lang 
are correct but not all of them (hebrew.expected.lang is the correct 
file). I guess it is a unicode problem but can't seem to find out how to 
fix it.

 hebrew.b64 = file to convert 

//4jACAARQBuAGcAbABpAHMAaAAgAHYAIAAxAC4ANAANAAoAMQA6AOIF0QXoBdkF6gUNAAoA
DQAKADEAMAAxADoA0QXZBdgF1QXZBSAA3AXQBSAA4AXeBeYF0AUNAAoAMQAwADIAOgDUBdIF
2QXiBSAA3AXhBdUF4wUgANQF0wXjBSwAIADeBd4F6QXZBdoFIADeBegF0AXpBSAA1AXTBeMF
DQAKADEAMAAzADoA0gXoBeEF1AUgANcF0wXpBdQFIADpBdwFIABJAG4AbABpAG4AZQAgAFMA
ZQBhAHIAYwBoACAA4AXeBeYF0AXUBS4AIADcBdcF5QUgAOIF3AUgACIA2wXfBSIAIADbBdMF
2QUgANwF4gXRBdUF6AUgANwF0wXjBSAA1AXUBdUF6AXTBdQFLgANAAoAMQAwADQAOgDZBekF
IADcBdoFIADQBeoFIADUBdIF6AXhBdQFIADUBdAF1wXoBdUF4AXUBSAA6QXcBSAASQBuAGwA
aQBuAGUAIABTAGUAYQByAGMAaAAuAA0ACgAxADAANQA6AN4F5gXQBSAAOgANAAoAMQAwADYA
OgDUBeoF0AXdBSAA6AXZBekF2QXVBeoFDQAKADEAMQAxADoA3gXmBdAFIADQBeoFIADUBdEF
0AUNAAoAMQAxADIAOgDeBeYF0AUgANAF6gUgANQF5wXVBdMF3QUNAAoAMQAxADMAOgDUBdMF
0gXpBSAA1AXbBdwFDQAKAA0ACgAjACAATQBlAG4AdQANAAoAMwAyADcANgA4ADoA0AXVBdMF
1QXqBQ0ACgAzADIANwA2ADkAOgDRBdMF1QXnBSAA0AXdBSAA5wXZBdkF3QUgAOIF0wXbBdUF
3wUNAAoAMwAyADcANwAwADoA1AXqBdAF3QUgANAF2QXpBdkF6gUuAC4ALgANAAoADQAKACMA
IABPAHAAdABpAG8AbgAgAGQAaQBhAGwAbwBnAA0ACgAxADAANwA6ANQF6gXQBd0FIADQBdkF
6QXZBeoFIADQBeoFIABJAG4AbABpAG4AZQAgAFMAZQBhAHIAYwBoAA0ACgAxADAAOAA6AOkF
5AXUBQ0ACgAxADAAOQA6ANEF1wXoBSAA0AXqBSAA1AXpBeQF1AUgANQF3gXVBeIF0wXkBeoF
IADiBdwF2QXaBSAAOgANAAoAMQAxADAAOgDpBdkF4AXVBdkF2QXdBSAA0QXpBeQF1AUgANkF
1QXkBdkF4gXVBSAA0QXUBeQF4gXcBdQFIADUBdEF0AXUBSAA6QXcBSAASQBuAHQAZQByAG4A
ZQB0ACAARQB4AHAAbABvAHIAZQByAA0ACgA=

 hebrew.expected.lang = expected output 
# English v 1.4
1:עברית

101:ביטוי לא נמצא
102:הגיע לסוף הדף, ממשיך מראש הדף
103:גרסה חדשה של Inline Search נמצאה. לחץ על כן כדי לעבור לדף ההורדה.
104:יש לך את הגרסה האחרונה של Inline Search.
105:מצא :
106:התאם רישיות
111:מצא את הבא
112:מצא את הקודם
113:הדגש הכל

# Menu
32768:אודות
32769:בדוק אם קיים עדכון
32770:התאם אישית...

# Option dialog
107:התאם אישית את Inline Search
108:שפה
109:בחר את השפה המועדפת עליך :
110:שינויים בשפה יופיעו בהפעלה הבאה של Internet Explorer

Could someone enlighten me on how to go from hebrew.b64 to 
hebrew.expected.lang?

Thanks a lot,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: base64 and unicode

2007-05-04 Thread EuGeNe Van den Bulke
Duncan Booth wrote:
 However, the decoded text looks as though it is utf16 encoded so it should be 
 written as binary. i.e.  
 the output mode should be wb.

Thanks for the wb tip that works (see bellow). I guess it is 
experience based but how could you tell that it was utf16 encoded?

 Simpler than using the base64 module you can just use the base64 codec. 
 This will decode a string to a byte sequence and you can then decode that 
 to get the unicode string:
 
 with file(hebrew.b64,r) as f:
text = f.read().decode('base64').decode('utf16')
 
 You can then write the text to a file through any desired codec or process 
 it first.

  with file(hebrew.lang,wb) as f:
  ... file.write(text.encode('utf16'))

Done ... superb!

 BTW, you may just have shortened your example too much, but depending on 
 python to close files for you is risky behaviour. If you get an exception 
 thrown before the file goes out of scope it may not get closed when you 
 expect and that can lead to some fairly hard to track problems. It is much 
 better to either call the close method explicitly or to use Python 2.5's 
 'with' statement.

Yes I had shortened my example but thanks for the 'with' statement tip 
... I never think about using it and I should ;)

Thanks,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EuroPython vs PyconUK

2007-04-27 Thread EuGeNe Van den Bulke
Alex Martelli wrote:
 I like the kudos, thanks!, but I'm not quite sure what you're saying
 about my travel plans... just to clarify, once again I'll have to miss
 EuroPython _and_ PythonUK, two events I attended most assiduously when I
 was living in Europe (but then, for two years running I've also missed
 PyCon, _despite_ living in the US, sigh).

I was just using your possible travel plans as an example to express my 
concerns :P

Re your effective travel plans, thanks God for Google Video then :D

Cheers,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EuroPython vs PyconUK

2007-04-27 Thread EuGeNe Van den Bulke
Michele Simionato wrote:
   I don't see the problem. In my view EuroPython is the big event in
 Europe. If you can
 go to only one conference and you have the possibility to travel to
 Vilnius, then go to EuroPython.
 The national conferences are of interest primarily for people of that
 national (of course, not
 exclusively).

Thanks, I didn't see it that way but that was ignorance on my behalf. I 
was WRONGLY under the impression that we were in front of a classical 
European pattern named what WE can do collectively I can do better 
alone - known use : European constitution :P (but I am digressing :D).

 BTW, this year I will go both to PyCon It and EuroPython, last year I
 went both to
 PyUK and EuroPython. The more, the better ;)

The more the merrier indeed in that respect! I learnt a lot from your 
Using decorators talk last year. Thanks.

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


EuroPython vs PyconUK

2007-04-26 Thread EuGeNe Van den Bulke
I do realize that the UK is not really part of Europe (no polemic :P) 
but I am nevertheless curious about the logic behind creating another 
major Python event in Europe. Wasn't EuroPython enough?

Like many I am sure, I probably won't be able to attend both (and I 
really enjoyed the Geneva experience so definitely want to renew it). 
How would you go about selecting which conference to attend?

They are only 2 months apart, 6 would have been easier for the 
attendees! Could the organizers liaise one way or another to make 
Pythoneers life as easy and fun as the language and give as much 
information out as possible as early as possible (early bird early) for 
people to make the best decision?

I know marketing matters but ...

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EuroPython vs PyconUK

2007-04-26 Thread EuGeNe Van den Bulke
Steve Holden wrote:
   So by this reasoning there should have been no Python UK conference
 for the last four years (in case you didn't know it ran as a track of 
 the C/C++ conference, but ths track has now broadened to include all 
 scripting languages). And what about the people who can't get the time 
 and/or money to attend EuroPython?

I am afraid there is a misunderstanding. I have no problem with PyCon UK 
but would like to have elements to help me choose (the official language 
of PyCon Uno Italy is Italian so that fixes it :P).

 Diversity is good, so it isn't one vs. the other. And the UK really *is* 
 part of Europe (no matter how its politicians behave) :P

I agree that diversity is good (you won't hear me say that there are too 
many web frameworks in Python :D) but isn't dilution a danger?

If Guido was a rock star and I was a groupie, I would want to know which 
festival to attend to see him on stage. I guess there is always Google 
Video ;)

More seriously in Geneva there were people from all over the place, 
speakers and attendees, which is one of the reason why such conferences 
are interesting (or am I deluded?). It is harder for someone from 
Australia to come twice to Europe in the space of 2 months than for a 
pythoneer lambda to spend a couple of days studying another web 
framework to see if it fits how his brain works and the problem he's got 
to solve.

Looking at the reactions to my post, I must be wrong. I didn't mean to 
offend anyone if I did. I'll go to Vilnius because I have never seen the 
city and try to go to Birmingham if the program looks interesting (not 
very rational or is it?).

Cheers,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EuroPython vs PyconUK

2007-04-26 Thread EuGeNe Van den Bulke
Fuzzyman wrote:
 I assume you have the same problem with the Italian one?

Not so much because the official language of Pycon Uno Italy is Italian 
so I don't feel too concerned (unfortunately my Italian is not quite 
good enough).

 Seriously though, it is *great* to see the UK Python scene flourishing
 (and the Italian one). The more events that happen the better, and I
 don't think they need be in competition with each other... I *hope*
 the Europython guys don't see it like that.

I agree it is great to see the Python scene grow (everywhere). The AFPY 
is organizing journees python francophones early June too cf. 
http://journees.afpy.org/.

I have only been to one conference before so I may be under the wrong 
impressions but I don't see how the three events won't be competing for 
Ri (as in Shu Ha Ri) speakers for example. Do I sound like a groupie?

Alex Martelli, brilliant speaker and Python evangelist (in my Shu Ha 
eyes anyway), lives in the States and is Italian. Busy as you'd expect 
from  someone working for Google, decides to make the trip to Europe for 
a Python related conference, henceforth spends 3 1/2 months in Europe so 
he can do Italy in June (he is listed as an organizer), Lithuania in 
July and UK in September...

I don't know how the EuroPython guys see it.

Cheers,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Access to file dropped on .exe/.app icon

2007-04-22 Thread EuGeNe Van den Bulke
Martin wrote:
 If i create an app using py2exe/py2app is there then a way on windows/
 mac to get access to a file dragged and dropped on to the .exe/.app
 icon?
 
 Martin
 

I did something like that for a small program I wrote to learn more 
about Python Programming on Windows ... check it out 
http://www.3kwa.com/Tutorial/PumpItUp

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list