PUB (Python Users Berlin) meeting: 24.09., 7pm, newthinking store

2008-09-22 Thread Stephan Diehl
The next PUB meeting takes place on 24.09. at newthinking store,
tucholskystr. 48, 10117 Berlin, Germany at 7pm.
Afterwards, we'll go to a restaurant for food and drink.
We welcome all people interested in the Python programming language.

best regards, stephan
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Berlin User Group Meeting 25.07.

2008-07-17 Thread Stephan Diehl

The Berlin User Group is meeting on Fr., the 25th of July at 7pm.
Address: Prater beergarden - Kastanienallee 7-9 - 10435 Berlin - Germany
In case of bad weather, there is a restaurant at the same location.
See you there!

Stephan

http://wiki.python.de/User_Group_Berlin
--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


Re: PyPy questions

2008-07-01 Thread Stephan Diehl
Allen schrieb:
 I read the website of some information about PyPy, and how a translator
 translates the RPython code to C/CLI/Java/etc to be compiled to a native
 executable or something like that.  Would it be possible, in PyPy, to
 write such an extension that could easily be compiled to native code
 from Python code?  Is this functionality planned in a future release of
 it?  Also, how is the source distributed (If I opt to use it I will end
 up compiling it on a system without an initial python install (a scratch
 linux system)), so does the source include the generated C code?
 
 B. Vanderburg II

these kind of questions are better asked on pypy-dev.
Anyway, at the moment you need a working python installation in order to
run the pypy chain. I have to admit that I didn't understand your
question, but you should read the pypy documentation on codespeak.net as
it will probably answer all of your questions. Alternativly, you might
want to join the #pypy channel on freenode
Stephan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Access to CAN-Bus

2008-06-09 Thread Stephan Diehl

Thin Myrna schrieb:

I'd like to access some drive hardware via CAN bus from Python under Linux
(sending rec'ing PDOs). Googling around I couldn't find a Python package,
but people who said that they are doing this, though. I guess they are
using their home brewn software. 

Any pointer to 
-  such software (anyone willing to share his experience?)

-  how to write such software?

Under Windows, I guess, I could use some COM or ctypes functionality to
access the hardware vendor's hardware. What if I wanted to access such
hardware from Linux? Is there a package that allows that in a vendor (who
doesn't support Linux) independent way?

Many thanks in advance
Thin


We've done this once (sorry no open source). If I remember right, we've 
been using ctypes on windows to access the CAN card. If I had to do 
something like this again, I'd definatelly check out an USB CAN adapter 
which might be easier to handle (but one never knows).


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


money data type

2008-06-09 Thread Stephan Diehl
Hi lazyweb,
I'm wondering, if there is a usable money data type for python available.
A quick search in pypi and google didn't convey anything, even though the 
decimal data type seemed to be planned as a money data type originaly.
Thanks for any pointers

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


Re: money data type

2008-06-09 Thread Stephan Diehl
Lie wrote:

 On Jun 9, 10:22 pm, Stephan Diehl [EMAIL PROTECTED] wrote:
 Hi lazyweb,
 I'm wondering, if there is a usable money data type for python available.
 A quick search in pypi and google didn't convey anything, even though the
 decimal data type seemed to be planned as a money data type originaly.
 Thanks for any pointers

 Stephan
 
 What is it that you feel is lacking in the decimal datatype that makes
 you feel you require a money datatype?
 Decimal datatype was a general purpose fixed-point number, which is
 usually the behavior required for money calculation, but it's not
 named 'money' because this behavior isn't only useful for money
 calculation, so they don't name it money.

I'm actually quite sure that the decimal data type will be sufficient for
what I plan to do, but in a general setting, one would need currency
support, maybe different rounding rules for different currencies, exchange
rates, etc. 



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

Meeting Python User Group Berlin 07.05.

2008-04-30 Thread Stephan Diehl
Hallo,

The next berlin python user group meeting is Wednesday, 7th of may, 7pm
Place: new thinking store, Tucholskystr. 48, 10117 Berlin 
Further information can be found at http://wiki.python.de/User_Group_Berlin

See you there

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Berlin Area Python User's Group Meeting

2008-03-12 Thread Stephan Diehl
The next meeting is on Wednesday, the 19th of march at newthinking store,
starting 7pm. Details can be found at
http://wiki.python.de/User_Group_Berlin

See you there

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: Eurosymbol in xml document

2008-03-04 Thread Stephan Diehl
Hallo Helmut,

 Hi,
 i'm new here in this list.
 
 i'm developing a little program using an xml document. So far it's easy
 going, but when parsing an xml document which contains the EURO symbol
 ('€') then I get an error:
 
 UnicodeEncodeError: 'charmap' codec can't encode character u'\xa4' in
 position 11834: character maps to undefined

first of all, unicode handling is a little bit difficult, when encountered
the first time, but in the end, it really makes a lot of sense :-)
Please read some python unicode tutorial like
http://www.amk.ca/python/howto/unicode

If you open up a python interactive prompt, you can do the following:
 print u'\u20ac'
€
 u'\u20ac'.encode('utf-8')
'\xe2\x82\xac'
 u'\u20ac'.encode('iso-8859-15')
'\xa4'
 u'\u20ac'.encode('iso-8859-1')
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u20ac' in
position 0: 

\u20ac is the unicode code point for the Euro sign, so u'\u20ac' is the
unicode euro sign in python. The different encode calls translate the
unicode into actual encodings.
What you are seeing in your xml document is the iso-8859-15 encoded euro
sign. As Diez already noted, you must make shure, that 
1. the whole xml document is encoded in latin-15 and the encoding header
reflects that
or
2. make sure that the utf-8 encoded euro sign is in your xml document.

Hope that makes sense

Stephan

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

Re: appwsgi

2008-02-14 Thread Stephan Diehl
gert wrote:

 can my http://appwsgi.googlecode.com/ be on the http://wsgi.org/ page
 somewhere please :)
you are free to register yourself on wsgi.org and put a link to your
software at the appropriate place. It's a wiki, after all.
-- 
http://mail.python.org/mailman/listinfo/python-list


Berlin (Germany) Python User Group is meeting on 23.1.

2008-01-21 Thread Stephan Diehl
The Berlin Python User Group is meeting on the 23.1. at newthinking store at
7pm. All details can be found at http://wiki.python.de/User_Group_Berlin.

  
The Berlin Python User Group is planning to meet every two month to talk
about Python. Most talking will be done in german, but I can assure you that 
english could be spoken as well, if the need arises...
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Berlin (Germany) Python User Group is meeting on 23.1.

2008-01-21 Thread Stephan Diehl
The Berlin Python User Group is meeting on the 23.1. at newthinking store at
7pm. All details can be found at http://wiki.python.de/User_Group_Berlin.

The Berlin Python User Group is planning to meet every two month to talk
about Python. Most talking will be done in german, but I can assure you
that english could be spoken as well, if the need arises...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Standard Full Text Search Engine

2007-10-26 Thread Stephan Diehl
Martin Marcher wrote:

 Hello,
 
 is there something like a standard full text search engine?
 
 I'm thinking of the equivalent for python like lucene is for java or
 ferret for rails. Preferrably something that isn't exactly a clone of
 one of those but more that is python friendly in terms of the API it
 provides.
 
 Things I'd like to have:
 
  * different languages are supported (it seems most FTSs do only english)
  * I'd like to be able to provide an identifier (if I index files in
 the filesystem that would be the filename, or an ID if it lives in a
 database, or whatever applies)
  * I'd like to pass it just some (user defined) keywords with content,
 the actual content (as string, or list of strings or whatever) and to
 retrieve the results by search by keyword
  * something like a priority should be assignable to different fields
 (like field: title(priority=10, content=My Draft),
 keywords(priority=50, list_of_keywords))
 
 Unnecessary:
 
  * built-in parsing of different files
 
 The standard I'm referring to would be something with a large and
 active user base. Like... WSGI is _the_ thing to refer to when doing
 webapps it should be something like $FTS-Engine is _the_ engine to
 refer to.
 
 any hints?
 

I'm using swish-e (swish-e.org) for all my indexing needs. I'm not sure if
there's a python binding available, I'm using swish-e as an external
executable and live quite happyly with that.

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


next python berlin user group meeting / naechstes berliner python treffen

2007-03-30 Thread Stephan Diehl
time: 3.4., 7pm
place: c-base
info: http://groups.google.de/group/python-berlin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A little more advanced for loop

2007-02-09 Thread Stephan Diehl
Horta wrote:
 Hi folks,
 
   Suppose I have to loop over 3 lists being the same size at the same
 time and order. How can I do that without using the range() function
 or whatever indexing?
 
 Example using range:
 
 a = ['aaa', '']
 b = ['bb', '']
 c = ['c', '']
 
 for i in range(len(a)):
 # using a[i], b[i], and c[i]
 
   I'm sure there's a elegant way to do that...
 
   Thanks in advance.
 
Sure, there is:

for a_item, b_item , c_item in zip(a,b,c):
# do something
-- 
http://mail.python.org/mailman/listinfo/python-list


next berlin python-group meeting fr., 2.2.

2007-01-29 Thread Stephan Diehl
after a long (veeeyy) long time, I'm pleased to announce our next 
python meeting in berlin.
time: friday 2.2. 7pm
place:Cafe  Restaurant UNENDLICH
Boetzowstrasse 14
10407 Berlin (Prenzlauer Berg Boetzowviertel)

This is a fun meeting without offical talks.
If you haven't done so already, subscribe to
http://starship.python.net/cgi-bin/mailman/listinfo/python-berlin
for last minute information. If you plan to come, please leave a short 
notice there, so we know how many people to expect.

Cheers

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


Re: next berlin python-group meeting fr., 2.2.

2007-01-29 Thread Stephan Diehl
Stephan Diehl wrote:

 http://starship.python.net/cgi-bin/mailman/listinfo/python-berlin

argghhh, wrong link. please try
http://starship.python.net/mailman/listinfo/python-berlin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dr. Dobb's Python-URL! - weekly Python news and links (Oct 10)

2006-10-10 Thread Stephan Diehl
Cameron Laird wrote:

 goon summarizes WSGI resources:
   http://groups.google.com/group/comp.lang.python/msg/f7d67bc039748792
 

THE wsgi resource at the moment is http://wsgi.org . (sorry, I've missed 
the original thread)

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


Re: Behavior on non definded name in Cheetah

2006-08-02 Thread Stephan Diehl
Paolo Pantaleo wrote:
 [I hope I am posting to the right place]
 
 I have a cheetah template something like this:
 
 x is: $x
 y is: $y
 z is: $z
 
 [Actually more complicated]
 
 If for example $y is not defined I get an exception and  the parsing
 of the template stops. Is  there any way to substitute $y with an emty
 string and making cheeta going on with parsing?
 
 Thnx
 PAolo
 

http://cheetahtemplate.org/docs/users_guide_html_multipage/language.namemapper.missing.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Registry of Methods via Decorators

2006-06-22 Thread Stephan Diehl
bayerj schrieb:
 I want to make a registry of methods of a class during creation. My
 attempt was this
 
  classdecorators.py
 
 Author: Justin Bayer
 Creation Date: 2006-06-22
 Copyright (c) 2006 Chess Pattern Soft,
 All rights reserved.  
 
 class decorated(object):
 
 methods = []
 
 @classmethod
 def collect_methods(cls, method):
 cls.methods.append(method.__name__)
 return method
 
 class dec2(decorated):
 
 @collect_methods
 def first_func(self):
 pass
 
 @collect_methods
 def second_func(self):
 pass

replace '@collect_methods' with '@decorated.collect_methods'
and this will do what you want.

But keep in mind, that the 'methods' list in decorated will be used for 
all derived classes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dumb-as-rocks WSGI serving using standard library

2006-05-22 Thread Stephan Diehl
On Mon, 22 May 2006 18:18:34 +1000, Ben Finney wrote:

[...]
 
 Everything else that I can find leads to dependencies I don't want for
 flexibility I don't need: cherrypy, paste, et al.
 
 Any suggestions for how to serve up a simple WSGI application with
 just the standard library?

the easiest seems to be james: http://wsgiarea.pocoo.org/james/
or
flup: http://www.saddi.com/software/flup/ (for FCGI adapter)

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


Re: Active Directory Authentication

2006-05-05 Thread Stephan Diehl
On Fri, 05 May 2006 05:39:08 -0700, D wrote:

 Is it possible to have Python authenticate with Active Directory?
 Specifically what I'd like to do is have a user enter a
 username/password, then have Python check the credentials with AD - if
 what they entered is valid, for example, it returns a 1, otherwise a
 0..  Thanks!

It's possible and you need the python-ldap package for it.
The actual authentication will look like (simplified):

def authenticate(user='',passwd=''):
dn = find_user_dn(user)
try:
l = ldap.open(AD_HOST_URL)
l.protocol_version = ldap.VERSION3
l.simple_bind_s(dn,passwd)
l.search_s(SEARCHDN,ldap.SCOPE_SUBTREE,'objectType=bla')
l.unbind_s()
return True
except ldap.LDAPError:
return False

obviously, you need to supply some function 'find_user_dn' that maps
the user to its DN.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stackless Python for 2.4.3

2006-03-30 Thread Stephan Diehl
On Thu, 30 Mar 2006 06:04:27 -0800, Fuzzyman wrote:

 
 Richard Tew wrote:
 Hi,

 Stackless Python is now available for the recent release of Python
 2.4.3 (final).

 
 Does anyone happen to know if Stackless Python is compatible with
 existing third party extension modules (like e.g. Tkinter and wxPython)
 ?
 
It's definatelly compatible with wxPython. If memory serves right, there
were some issues with Tkinter. It would be best to ask on stackless 
mailinglist for details (I'm not sure, if wxPython worked out of the box
or if there was some trick involved)

Stephan

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


Re: Alternatives to Stackless Python?

2005-09-20 Thread Stephan Diehl
On Tue, 20 Sep 2005 08:50:44 -0700, [EMAIL PROTECTED] wrote:

 After recently getting excited about the possibilities that stackless
 python has to offer
 (http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/)
 and then discovering that the most recent version of stackless
 available on stackless.com was for python 2.2 I am wondering if
 Stackless is dead/declining and if so, are there any viable
 alternatives that exist today?

Well, it's not dead and the last recent version is for python 2.3
The developer of stackless, Christian Tismer, is one of the main
developers of the PyPy project. (http://codespeak.net/pypy)
For this reason, there is an extremely good chance that the ideas
behind stackless will survive :-) .
Visit www.stackless.com for further info.
---
Stephan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python CGI and Firefox vs IE

2005-09-07 Thread Stephan Diehl
On Wed, 07 Sep 2005 10:50:15 -0700, Jason wrote:

 Hey y'all, this falls under the murky realm of HTML, CGI and
 Python...and IE.
 
 Python 2.4, using CGI to process a form.
 
 Basically I've got 3 buttons.  Here's the HTML code:
 
 form action='http://127.0.0.1/cgi-bin/server_status.py' method=post
 button name='display' value='all,status' type='submit'All
 Servers/button
 button name='display' value='wkpea1,status'
 type='submit'WKPEA1/button
 button name='display' value='wknha2,status'
 type='submit'WKNHA2/button
 /form
 
 
 And the code that's messing things up:
 

No, here you are wrong. IE doesn't work as expected with buttons.
See
http://www.solanosystems.com/blog/archives/2005/04/12/the-submit-button-problem/

This has nothing to do with Python.
---
Stephan
 jason

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


curious about slice behaviour

2005-09-05 Thread Stephan Diehl
I just found out by accident, that slice indices can be larger than
the length of the object. For example
 'test'[:50]
'test'
 'test'[40:50]
''

I'd rather expected to be confronted with an IndexError.
(This is actually described in 
http://docs.python.org/lib/typesseq.html, so my expectation was wrong :))

Does anybody know, why this is preferred to just raising an error?

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


Re: curious about slice behaviour

2005-09-05 Thread Stephan Diehl
On Mon, 05 Sep 2005 14:26:14 -0400, Terry Reedy wrote:

 
 Stephan Diehl [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
I just found out by accident, that slice indices can be larger than
 the length of the object. For example
 'test'[:50]
 'test'
[...]
 Does anybody know, why this is preferred to just raising an error?
 
 Slicing was intentially designed to always give an answer (given int 
 coords) and never say 'can't answer' (whether by exception or a None 
 return).  This avoids having to call len() when you don't care and avoids 
 having to use try:...except:... or conditionalize the code when it is not 
 needed.  For  instance c=s[0:1] is equivalent to
 
 c=s[0:min(1,len(s))]  # if slice had to be exact, or
 
 c = s and s[0] or '' # or
 
 if s:
   c = s[0]
 else:
   c = ''  # or
 
 try:
   c = s[0]
 except IndexError:
   c = ''
 
 People occasionally post buggy code which simply needs s[0] changed to 
 s[0:1].
 
 The form s[i:], which I am sure you agree is useful, is effectively 
 equivalent to eithers[i:len(s)] or s[i:maxint].   The latter view 
 generalizes to iterables without a knowable length.

I do think that this is useful and can save some lines of code.
Just never expected this.

 
 Terry J. Reedy




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


Re: python and ajax

2005-08-30 Thread Stephan Diehl
On Mon, 29 Aug 2005 12:04:46 -0700, Steve Young wrote:

 Hi, I was wondering if anybody knew of any good
 tutorial/example of AJAX/xmlhttprequest in python.
 Thanks.
 
 -Steve

As all the others have said already, AJAX has nothing to do with python,
but everything with JavaScript.
You might want to check out MochiKit (http://mochikit.com), a lightweight
JavaScript library written by Bob Ippolito. Bob did a very good job in
turning programming JS into a more python like experience.
- stephan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: variable arguments question

2005-03-15 Thread Stephan Diehl
On Tue, 15 Mar 2005 03:48:40 -0400, vegetax wrote:

 if i have a dictionary: 
 d = {'a':2,'b':3 }
 l = (1,2)
 
 how can i pass it to a generic function that takes variable keywords as
 arguments? same thing with variable arguments, i need to pass a list of
 arguments to the function
 
 def asd(**kw): print kw
 def efg(*arg): print arg
 
 asd(d) 
 doesnt work
 asd(kw = d) 
 doesnt work

but asd(**d)

 
 efg(l)
 doesnt work

and efg(*l)

will work.
 
 i need to pass those as a dictionary and a list,since i dont know ahead of
 time if which items would have d and l

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


Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-04 Thread Stephan Diehl
On Tue, 04 Jan 2005 05:43:32 -0800, michele.simionato wrote:

 Holger:
 
 FWIW, i added the recipe back to the online cookbook. It's not
 perfectly
 formatted but still useful, i hope.
 
   http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/361742
 
 Uhm... on my system I get:
 
 german_ae = unicode('\xc3\xa4', 'utf8')
 print german_ae # dunno if it will appear right on Google groups
 ä
 
 german_ae.decode('latin1')
 Traceback (most recent call last):
 File stdin, line 1, in ?
 UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in
 position 0: ordinal not in range(128)
 ?? What's wrong?

I'd rather use german_ae.encode('latin1')
 ^^

which returns '\xe4'.
 
 Michele Simionato

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