Re: pyPgSQL giving error!

2005-01-13 Thread Harald Massa
> I am using Redhat 9.0/python2.3. I installed pyPgSQL-2.4.tar.gz and it
> was successfull. Now when I am trying to import that module, I got:
> Type "help", "copyright", "credits" or "license" for more information.
 from pyPgSQL import PgSQL
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "pyPgSQL/PgSQL.py", line 391, in ?
> from libpq import *
>   File "pyPgSQL/libpq/__init__.py", line 23, in ?
> from libpq import *
> ImportError: No module named libpq

did you really do ./configure, make and make install?

where is libpq.*

was a postgres installation present while doing ./configure et all?

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


Re: py2exe problem

2005-01-26 Thread Harald Massa
Grant Edwards 

> LookupError: no codec search functions registered: can't find encoding
> Googling for the error message will find you the answer.  

http://starship.python.net/crew/theller/moin.cgi/Py2Exe

carries within "encodings" and "encodings again" receipes to get it 
working.

A software development system which REALLY solves the encodings problem 
WITHOUT creating a swarm of new ones could would challange even my 
devotedness to Python :

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


Re: py2exe problem

2005-01-26 Thread Harald Massa
Thomas Heller <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

>>
>> A software development system which REALLY solves the encodings
>> problem WITHOUT creating a swarm of new ones could would challange
>> even my devotedness to Python :
> 
> AFAIK, McMillan Installer solves this by including all the encodings
> stuff by default, and it has a --ascii flag to override this
> behaviour. Would that be a solution?

Thomas,

I solved the headaches with py2exe and encodings, again and again ...
even documented some of these steps within the wiki. 

But encodings still give me new pain any day: storing filenames to
databases, displaying filenames in windows-controls, sending
database-extracts to excel or word ... time on time encodings and/or
unicode errors pop up and cause me misery. 

So my cryout is for a solution for all encoding-problems like the python
for-loop or list-comprehensions: elegant, simple, robust, flexible. Easy
to use, easy to implement. 

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


Re: py2exe problem

2005-01-27 Thread Harald Massa
Thomas,

> Would the above (include all encodings stuff by default) be a good
> solution, or do you have other ideas?

I assume a good solution would involve switching pythons default from 
"ASCII" to "UNICODE" :)

But ... as far as py2exe is concerned, yeah, I think it would be helpfull 
to include all encoding by default (undefaultable, of course), or at least 
provide in the very very first simple setup.py example the include 
encodings.* stuff.

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


Re: Is there a market for python developers?

2005-02-03 Thread Harald Massa
> I am new to python and took my first attempts at working with this
> language today.  Is there a market for people who work with Python?

Absolutely no. Only unimportant and unknown companies like Google, Nokia, 
Industrial Light and Magic as well as GHUM Harald Massa do work with 
Python.

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


Re: Java RMI-like services in Python

2005-07-18 Thread Harald Massa
Maurice LING <[EMAIL PROTECTED]> wrote in news:dbfmbq$e49$1
@domitilla.aioe.org:
> I am wondering if Python has services or frameworks that does the same 
> as Java RMI?

google for pyro

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


Re: Py: a very dangerous language

2005-08-01 Thread Harald Massa
"yoda" 

> It was 6 a.m just one more lambda...I'll really sleep
> now...seriously... I've got to go to work in a few hours

I also love Python deeply, and really enjoyed the intense description of 
your experience. One experience I won and wanna share with you: allways go 
to bed exactly when you want to write the first lambda.

That has 2 benefits: you get sleep, and your programs less lambda.

Harald


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


Re: Python dutch

2005-08-22 Thread Harald Massa
Sybren Stuvel ,

> I'd suggest learning English. The programming language is based on
> English anyway. 

There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.

To be even more exact, it would help to learn or even be Dutch to program 
in Python, as those quoted lines out of the ZEN might suggest.

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


Googling for wmi and python....

2005-02-06 Thread Harald Massa
I upgraded Python to 2.4

now the game really starts, looking all over the internet for all the 
packages ... I needed Tim Goldens WMI ... and googeld, dropping there:


http://www.microsoft.com/technet/scriptcenter/scripts/python/misc/wmi/defau
lt.mspx

With comment: Sample scripts for retrieving WMI configuration information. 
These sample scripts were written using Python for Windows. For sample 
scripts written using VBScript, please visit the Script Repository home 
page.


And that is above Tims GREAT WMI.module ... 

just wanted to drop that note.
-- 
http://mail.python.org/mailman/listinfo/python-list


overwriting method in baseclass

2005-02-06 Thread Harald Massa
Hello!

I am using a library (= code of so else) within Python. Somewhere in this 
library there is:

class foo:
def baa(self, parameters):
 print "something"
 self.baazanan(some other parameters)


class mirbo(foo):
  def baazanan(self, lalala):
  print "heylo tada"

class fujiko(foo):
  def baazanan(self, ltara):
  print "sing a song with me"





now I want to change the common baa-method. so that

def baa(self, parameters):
  print "soemthing special"
  self.baazanan(some other parameters)

Of course, I use a Python- and GPL-Licence compatible library, I can 
change the source of foo, and use my changed library.

But someday, it happened before, there will be an update by the publisher 
to that library and I have to do all again.

So, what is the most elegant solution to administer these changes? 

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


Re: overwriting method in baseclass

2005-02-07 Thread Harald Massa
bruno modulix <[EMAIL PROTECTED]> wrote in
> 
>> So, what is the most elegant solution to administer these changes? 
> 
> 
> Use a version control system (svn is quite fine...).
> 

Thanks for that recommendation, I really do use subversion for some time. 
But how can I use it to solve this problem? I do changes to the common 
baseclass which is OUTSIDE my development. I quite correctly assume that 
the developers of the classlib also use Subversion, alas, having no public 
access.

So HOW can SVN be of any use for THIS prob?

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


Re: overwriting method in baseclass

2005-02-09 Thread Harald Massa
marc,

>> So HOW can SVN be of any use for THIS prob?
> 
> Take a look at the Subversion documentation (the "book") and search
> for `Vendor branches`.
> 
[...]
> The section deals specifically with the situation how to manage 3rd
> party source code with subversion which you want to update from time
> to time and even apply some modifications.

thank you very much for pointing this out! I did not even dare to hope to 
find sth. of this kind with a rcs for MY software.

So I did not even start searching.

Thank you,

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


head for grouped data - looking for best practice

2005-03-12 Thread Harald Massa
Old, very old informatical problem: I want to "print" grouped data with 
head information, that is:


eingabe=[
("Stuttgart","70197","Fernsehturm","20"),
("Stuttgart","70197","Brotmuseum","123"),
("Stuttgart","70197","Porsche","123123"),
("Leipzig","01491","Messe","91822"),
("Leipzig","01491","Schabidu","9181231"),
]

shall give: ( Braces are not important...)

'Stuttgart', '70197'
--data-- ('Fernsehturm', '20')
--data-- ('Brotmuseum', '123')
--data-- ('Porsche', '123123')
Leipzig', '01491'
--data-- ('Messe', '91822')
--data-- ('Schabidu', '9181231')

my first approach was:


from itertools import groupby
from operator import itemgetter

for key, bereich in groupby(eingabe,itemgetter(0)):
print "Area:",key
headnotprinted=True
for data in bereich:
if headnotprinted:
headnotprinted=False
print "additional head info", data[1]
print "--data--", data[2:]

leading to:

Area: Stuttgart
additional head info 70197
--data-- ('Fernsehturm', '20')
--data-- ('Brotmuseum', '123')
--data-- ('Porsche', '123123')
Area: Leipzig
additional head info 01491
--data-- ('Messe', '91822')
--data-- ('Schabidu', '9181231')


which is quite what I expected. But ... 
if headnotprinted:
headnotprinted=False
print "additional head info", data[1]

REALLY looks patched, not programmed.

my second try was:


def getdoublekey(row):
return row[0:2]

for key, bereich in groupby(eingabe,getdoublekey):
print "Area:",key
for data in bereich:
print "--data--", data[2:]

which indeed leeds to the expected result, while looking less "hacky" .. 
on the other hand side, that "getdoublekey" ist not very flexible; when 
doing the same with 3 Columns forming the head information, I have to 
define the next function...

gettriplekey(row):
return (row[1], row[0], ---yadda yadda yadda

so, what is the best recommended practice for this usual problem within 
Python?

Harald

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


Re: How to send browser to open a different URL

2005-03-12 Thread Harald Massa
"Mike Wimpe" <[EMAIL PROTECTED]> wrote in news:1110628448.532469.117000
@g14g2000cwa.googlegroups.com:

http://groups.google.de/groups?hl=de&lr=&c2coff=1&threadm=
2c60a528.0309251324.109d4af5%40posting.google.com&rnum=5&prev=/groups%3Fq%
3Dhttp%2520redirect%2520header%2520python%26hl%3Dde%26lr%3D%26c2coff%3D1%
26sa%3DN%26tab%3Dwg

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


Re: head for grouped data - looking for best practice

2005-03-12 Thread Harald Massa
Steve,


> Why don't you just pass a slice to itemgetter?
py> for key, bereich in groupby(eingabe, itemgetter(slice(0, 2))):


WHOW, that is great! that makes it really simple, just have to structure 
the SQL to make a real "cut first, serve first" structure.

Thanks to all who helped!

also the "function factory function" bei Dietz was very helpfull; and 
Peters classes looked really impressive!

Thanks again... now my code will be even clearer.

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


Re: Beware complexity

2005-03-13 Thread Harald Massa
Philip,

more often than not, all needed was included in Python years ago. 

Especially:

> I wonder if anyone has any thoughts not on where Python should go but
> where it should stop?

The answer is included within the standard library. On any Python command 
prompt type:

>>>import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

> Nothing wrong with coding conventions of course unless you:
 
So "coding conventions" are more or less rendered as something of ancient 
times; Python has its Zen. (of course, as I said, included in the 
standard library)

And: the fear that Python gets extended over sensible bounds maybe real. 
But: Just have a look within python.devel, what happens on any (pun 
intended) extension to builtins: It's a gentle and polite, nontheless 
strong and hard discussion; a real evolutionary survival test.

Python is a healthy tree: it grows. But Guido and the Bots are 
thoughtfull gardeneres: they are not afraid to cut bad branches.

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


Re: Use macros in Excel via win32com

2004-12-19 Thread Harald Massa
chris,

> I'm creating an excel document dynamically from scratch using Python
> and the win32com module.  All is well, but now I need to add a macro to
> the spreadsheet and run it (to enable some sorting features in the
> spreadsheet).  

I recommend to create the excel document not from scratch but from a 
template.

 I learned from experience that it is speadier to have all the static parts 
allready prepared - and especially diagrams and macros are MUCH easier to 
handle if allready in the programm

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


Re: Example Code - Named Pipes (Python 2.4 + ctypes on Windows)

2005-03-26 Thread Harald Massa
"Srijit Kumar Bhadra" <[EMAIL PROTECTED]> wrote in
> Here is an example of Multithreaded Pipe Server and Client using the
> excellent ctypes library (Windows).

Excellent. Maybe you would also like to post it to the

http://starship.python.net/crew/theller/moin.cgi/CtypesModule

Ctypes-Wiki for easier reference?

best regards,

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


Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread Harald Massa
Mage <[EMAIL PROTECTED]> wrote in news:mailman.2339.1114242211.1799.python-

> The "lambda functions" was an unclear part of the tutorial I read.
> Should I use them? Are they pythonic?
> As far I see they are good only for type less a bit.

And to obfusicate code. lambda is evil, do not play with it.

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


Re: query progress bar

2005-05-16 Thread Harald Massa
> it's for wx, the problem isn't making the progress bar itself, it's 
> knowing how long the query is going to run for.
> i'm using pypgsql

It is quite easy:

from timemachine import oracle

guesser=oracle(guess="SQL")
guesser.set_hint(driver="pypgsql")
guesser.set_hint(gui="wx")

expected_runtime=guesser.estimate("")

Only problem is that the timemachine module is currently only installed 
on Guidos and Tims Python.

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


Re: Dealing with marketing types...

2005-06-10 Thread Harald Massa
> They want a 
> "scalable, enterprise solution" (though they don't really know what
> that means) and are going crazy throwing around the Java buzzwords
> (not to mention XML).
> 
There is a very cheap solution: Ryan Tomayko debunkes all these myths.
You can google it up, "astronaut architects" 

There is a cheap solution: on this years EuroPython (www.europython.org)
there will be a special Slot in Social Skills track dealing with
"Selling Python", giving you a Python Sales Pitch and two more excellent
seminars about persuading people. More than that, in Python in Business
Track we will do slots about using Python for real worthy enterprise
apps which scale and are FULLY buzzword-compatible. 

Join us!

Harald Armin Massa
GHUM Harald Massa
perusasion. python. postgresql.


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