Re: what's OOP's jargons and complexities?

2005-01-28 Thread Martin Ambuhl
Gabriel Dos Reis wrote:
Martin Ambuhl <[EMAIL PROTECTED]> writes:
| Dan Perl wrote:
| 
| > Actually, it can be as simple as:
| > public class test {
| 
| There is no "public" or "class" in C.  Please don't post such trash to
| comp.lang.c.  In fact, C++ is not topical in any of the five

But, it was anything but C++.  Maybe Java.
And why is Java topical for any of the five newsgroups he spewed on, 
which deal with perl, python, lisp, scheme, and C?  There must be a high 
correlation between using Java and idiocy.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pystone benchmark: Win vs. Linux (again)

2005-01-28 Thread Fredrik Lundh
Franco Fiorese wrote:

> I am relatively new about Python benchmarks.
> After some experiments I found that Python on my PC Windows XP has a relevant 
> higher performance 
> than on Linux. The simple test using pystone.py shows this:
>
>  * Windows XP Pro:  16566.7 pystones/second
>  * Linux (kernel 2.6.9 NPTL): 12346.2 pystones/second

what Python version are you using for these tests?  what Windows build?

 



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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread jacob navia
Good post.
First article that demistifies this OO centered approach
in quite a long time.
This approach has its strength, but also has it weakness,
it is not the solution for every problem appearing in
data processing.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pystone benchmark: Win vs. Linux (again)

2005-01-28 Thread Simon John
Franco Fiorese wrote:

> Is there any way, that you know, to get better performance under
Linux?

Build Python yourself, using relevant CFLAGS and TARGET for your
processor?

I've always noticed that Windows Python takes a lot longer to startup
than Linux, but never really looked at runtime performance.

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


Re: An mysql-python tutorial?

2005-01-28 Thread Kartic
Dfenestr8 said the following on 1/28/2005 5:21 PM:
Hi.
Been told by the admin of my (free!) server that he'd rather I should
learn to use mysql if I want to continue writing cgi scripts there.
Not even sure exactly what mysql is.
Is there a simple tutorial anywhere on the web about using python + mysql?  
Did you try googling?
There are two items in the very first page that should be of use to you. 
One is the Python-MySQL module, which you should have installed.

http://sourceforge.net/projects/mysql-python
There is an examples directory that has some concrete stuff to help you 
learn.

Another hit is a basic tutorial, simple to follow and learn :- 
http://images.devshed.com/Server_Side/Python/PythonMySQL/PythonMySQL.pdf

And here is one more site, good stuff here too:-
http://www.kitebird.com/articles/pydbapi.html
You might also want to check the "Charming Python" pages at IBM.com but 
I dont know if they have articles covering mysql.

HTH!
Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Gabriel Dos Reis
Martin Ambuhl <[EMAIL PROTECTED]> writes:

| Dan Perl wrote:
| 
| > Actually, it can be as simple as:
| > public class test {
| 
| There is no "public" or "class" in C.  Please don't post such trash to
| comp.lang.c.  In fact, C++ is not topical in any of the five

But, it was anything but C++.  Maybe Java.

-- 
   Gabriel Dos Reis 
   [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Daylight savings and getmtime

2005-01-28 Thread Nick Coghlan
[EMAIL PROTECTED] wrote:
on my windows xp box os.path.getmtime gives back local time (I just
saved the file):
os.path.getmtime('c:\\temp\\testset.py')
1106955016
print time.mktime(time.localtime())
1106955034.0
No. mktime is converting the local time to UTC. Try this instead:
Py> time.gmtime(os.path.getmtime("c:/devel/mtime_test.txt"))
(2005, 1, 29, 3, 35, 37, 5, 29, 0)
Py> time.localtime(os.path.getmtime("c:/devel/mtime_test.txt"))
(2005, 1, 29, 15, 35, 37, 5, 29, 1)
(This is with my machine set to Sydney time, so that I'm at UTC + 10, with 
daylight savings currently active)

You can try to figure out if DST is on by comparing time.localtime()
versus time.gmtime(). In the Western European Timezone there's one hour
difference in winter and two hours  in summer.
To figure out if DST is currently active, you can use:
Py> import time
Py> time.localtime()
(2005, 1, 29, 14, 29, 26, 5, 29, 0)
Py> time.localtime().tm_isdst
0
Switching to Sydney time (which actually uses DST, unlike Brisbane) gives:
Py> import time
Py> time.localtime().tm_isdst
1
The same trick will work on historical dates, too. For instance, consider a file 
created last winter, when Sydney was NOT on daylight savings:

Py> time.localtime(os.path.getmtime("c:/log.txt"))
(2004, 7, 20, 19, 46, 35, 1, 202, 0)
Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: Elliptic Code

2005-01-28 Thread Philip Smith
Quite so - but thanks for your help in any case

"Paul Rubin"  wrote in message 
news:[EMAIL PROTECTED]
> Nick Craig-Wood <[EMAIL PROTECTED]> writes:
>> >  I understand the algorithm quite well but how to code the 
>> > multiplication
>> >  stage most efficiently in python eludes me.
>>
>> You might want to look at
>>
>>   http://gmpy.sourceforge.net/
>>
>> It has very fast multiplication up to any size you like!
>
> I think he's talking about point multiplication on the elliptic curve
> group, not integer multiplication. 


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


Re: Who should security issues be reported to?

2005-01-28 Thread Paul Rubin
Nick Coghlan <[EMAIL PROTECTED]> writes:
> After my original flippant reply, I've been thinking some more about
> this, and whether CPython can really benefit from initial notification
> of a security flaw going privately to the developers first.
> 
> And, due to CPython's release model, I really don't think it can.
>
> Upgrading your Python interpreter (even to a new maintenance branch
> release) in a production environment is usually a fairly involved
> exercise requiring a significant amount of testing, and the fact of

That's true of any production environment, and yet if there's a
serious flaw, you absolutely have to do it.  

> So, for CPython, the window of vulnerability is driven mainly by the
> time to when application developers, system administrators and end
> users get around to upgrading, not by the time to when a patched
> version is released. 

No.  If you're running a production system you have to stay on top of
security patches and install them ASAP.  If a vulnerability is bad
enough, you have to close down your service until you're done
installing the fix.  

If it takes 72 hours for the developers to make a patch, and 8 hours
for you to install the patch once it's announced, then your exposure
to attackers who learn of the bug from the announcement is 10 times
smaller if the bug and patch are announced simultaneously than if the
bug is announced immediately and the patch is released 72 hours later.

> More significantly, any security problem is likely to be with a
> specific function or object that has been implemented in C. 

False; the Cookie module example we talked about was caused by an
unforeseen interaction between pure Python modules (Cookie and pickle).

> So the most appropriate response to security issues in the CPython
> interpreter and standard library is to notify application developers
> as to what the issue is, and exactly which features it affects.

It helps a lot if when the application developers are notified, a
patch is already available, since once there's a lot of notification,
the bug is public.

> Sending a private notification to the *interpreter* developers does
> nothing to assist in this.

Um, it lets them get a patch ready before they notify the app developers.

> If the problem is significant, then it should also be brought directly
> to the attention of python-dev.

It's a sure bet that attackers are monitoring python-dev and one
should generally assume that they're monitoring the email of any
developer for projects with serious security footprints.  Notifying
python-dev isn't much different than broadcasting the info on "Attack
TV".  Security bug reports should be made through SSL-encrypted web
pages, not unencrypted email.

Bugzilla already has this feature.  I think it should also be added to
Sourceforge, if it's not already there.  If it's available in
Sourceforge, then Python's Sourceforge project should enable it.

Meanwhile, the OP can always open a CERT notification (www.cert.org),
though it usually takes a very long time for anything to happen with
those.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Installing Numeric with ATLAS and LAPACK

2005-01-28 Thread drife
Could you clarify this please?

Let's say that I want to make a call to the LAPACK
routine sspevd, and pass it a matrix, and get the result. How do I
accomplish this?


Thanks,


Daran

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


Re: Who should security issues be reported to?

2005-01-28 Thread Nick Coghlan
[EMAIL PROTECTED] wrote:
Who are the appropriate people to report security problems to
in respect of a module included with the Python distribution?
I don't feel it appropriate to be reporting it on general mailing
lists.
After my original flippant reply, I've been thinking some more about this, and 
whether CPython can really benefit from initial notification of a security flaw 
going privately to the developers first.

And, due to CPython's release model, I really don't think it can.
Upgrading your Python interpreter (even to a new maintenance branch release) in 
a production environment is usually a fairly involved exercise requiring a 
significant amount of testing, and the fact of the matter is, you're unlikely to 
do so unless there is some feature or bug-fix in a new version that you really 
need. (I'm still using Python 2.2.2 at work - it's entirely adequate for our 
needs, so there's no real pressure to upgrade on the current project. For a new 
project, I'd probably start with 2.4, planning to go to 2.4.1 in a couple of 
months time, but there aren't really any post-2.2 additions to Python that I 
can't handle living without).

So, for CPython, the window of vulnerability is driven mainly by the time to 
when application developers, system administrators and end users get around to 
upgrading, not by the time to when a patched version is released. In that sort 
of environment, even if the developers were to release a new maintenance patch 
within an hour of being notified of the problem, the window of vulnerability is 
still going to be huge (there are still systems out there running Python *1.5*, 
fer cryin' out loud).

More significantly, any security problem is likely to be with a specific 
function or object that has been implemented in C. This means any such security 
problem can be worked around by not using the affected feature, by employing 
appropriate safeguards against abuse, or by substituting a Python equivalent.

This is something which is going to be application dependent, and relies on 
application developers being notified.

So the most appropriate response to security issues in the CPython interpreter 
and standard library is to notify application developers as to what the issue 
is, and exactly which features it affects. Sending a private notification to the 
*interpreter* developers does nothing to assist in this.

In accordance with the above, I would suggest that, even for security problems, 
Python's standard Sourceforge bug tracker is the most appropriate place to file 
the problem report.

If the problem is significant, then it should also be brought directly to the 
attention of python-dev. At that point, the decision may be made to make a 
general announcement as to the feature which needs to be avoided or handled 
carefully. This would likely take the form of announcements on the 
www.python.org website, and on comp.lang.python.announce.

Regards,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: what's OOP's jargons and complexities?

2005-01-28 Thread beliavsky
PA wrote:

> Plus, a man which such cinematographic tastes [1] cannot be entirely
> bad :P
>
> http://xahlee.org/PageTwo_dir/Personal_dir/favorite_movies.html

The site proves he is evil. Grep "Titus" if you have a strong stomach.
I'm sure you did not get that far.

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


Re: PythonWin (build 203) for Python 2.3 causes Windows 2000 to grind to a halt?

2005-01-28 Thread Colin J. Williams
Chris P. wrote:
AWESOME - my life just got THAT much better.
The bug you suggested is exactly the problem that I was having... I
had looked through the bugs being tracked, but the title of that one
didn't jump out at me as something that would help.  Thanks!
- Chris
P.S. For anyone reading this group who wants to know exactly what I
did:
1) Uninstall Pywin32
2) Open the registry editor ('regedit' at the command prompt)
3) Go to HKEY_CURRENT_USER\Software\Python[version]\Python for Win32
You will likely find many many many keys that have the format
"ToolbarDefault-Bar#".  These keys filling up your registry cause
Windows 2000 to become extremely slow/unstable when Python is running
(especially if your debugger is running.)
4) Delete the keys... I just deleted it at the "Python[version]" root
5) Reinstall Pywin32
This is a great workaround but I've found that, with build 203, it needs 
to be repeated from time to time.

Colin W.

"Roger Upole" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
These look like symptoms of sf bug #1017504
http://sourceforge.net/tracker/index.php?func=detail&aid=1017504&group_id=78018&atid=551954
What version of Pywin32 are you running ?
There's a (semi) fix for this in the latest build.
  hth
 Roger
--
http://mail.python.org/mailman/listinfo/python-list


Re: What's so funny? WAS Re: rotor replacement

2005-01-28 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes:
> > Let's see, the urandom module was recently released in 2.4, I think
> > initially at my urging.
> 
> There is no urandom module in Python 2.4.

Oops, sorry, it's in the os module:

   http://docs.python.org/lib/os-miscfunc.html

The difference is simply a matter of the packaging.  It's important
functionality and it was added after an amount of review and testing
that was deemed to be reasonable.  Unless you're saying that if I
wanted to add AES to the string module (so you could say 
'spam and sausage'.aes_encrypt('swordfish banana')) instead of writing a
separate module, then we wouldn't need this discussion.  (Putting it
in the string module is not a serious proposal but it wouldn't be
completely insane.)  What matters is the code complexity, not whether
something is in a separate module or not.

> > If Guido says "no crypto", is that something other than a
> > policy?  And are you speaking for him when you say that?  
> 
> If he had said such a thing in general, it would be a policy
> (although it best would be documented somewhere). I don't think
> he said that, in general, and with the intent of stating a policy.

Well, if he indicates that it's not a policy and that the question is
still open, then I could see getting interested again in writing an
AES module.  At the moment I continue to see his python-dev post as
quite discouraging.

> We don't normally invite people to work on anything. People pick the
> things they work on themselves.

Not true.  For example, you once invited me to work on an ancillary
message feature for the socket module (SF bug 814689), and so it's
been on my want-to-do-one-of-these-days list since then.  I think it's
reasonable for me to have taken your message there as an expression of
interest, sufficient to get me to want to work on it.  So it's bogus
to say the Python developers should avoid expressing interest in
something that hasn't already been written.

> > IETF often decides and announces that a feature is good long before
> > any such details are decided or agreed on.
> 
> No. They decided that spam machinery in DNS would be a good thing,
> people started to work on it, and then they decided that it is not
> such a good thing, after all, because it causes too many problems.

There's no contradiction.  IETF decided something based on some
reasonable beliefs that later turned out to be wrong, so they had to
undo the original decision because the original expectations couldn't
be met.  That happens sometimes.  Everyone has worked on projects that
ended up failing and getting cancelled for reasons like that.  There
are few ironclad guarantees of anything, only reasonable beliefs.  But
real-world organizations are not afraid to start projects based on
reasonable beliefs regardless.  Otherwise, few things would ever get
done.

> It does matter for me, yet Python is still more than the core.
> 
> You might be ignoring that, but it surely is more to the many
> developers which create Python libraries and distribute them
> themselves, see
> 
> http://www.python.org/pypi
> THIS IS ALL PYTHON.

No.  Those are programs people have written in Python or as Python
extensions.  I've written programs like that myself.  I don't consider
them to be part of Python.  They are separate programs.  If one of
them gets accepted into the distro (as this thread is about), then it
becomes part of Python.  See :

1.1.6   How do I obtain a copy of the Python source?

The latest Python source distribution is always available from
python.org, at http://www.python.org/download/. The latest development
sources can be obtained via anonymous CVS from SourceForge, at
http://www.sourceforge.net/projects/python.

Python is what you get from following the download instructions and
installing the result.  In ,
where it asks "why is Python installed on my machine?", that is what
they are referring to by "Python".

> > Obviously those require a different type of consideration.  I'm
> > talking about patches where there's a core developer with an interest.
> 
> I though you were talking about the AES module...

No, when this started you were talking about modules in general.
-- 
http://mail.python.org/mailman/listinfo/python-list


SUCCESS!

2005-01-28 Thread Erik Johnson
- Original Message - 
From: "Peter Otten" <[EMAIL PROTECTED]>
> According to http://cnswww.cns.cwru.edu/php/chet/readline/CHANGES the
> features you missed were introduced in readline 4.0 and 4.2, so version
4.3
> should be sufficient. So let me ask you again, you have both the readline
> and the readline-devel package installed? If yes, and configure still
> complains, it may be time to look for something entirely different...


Sorry! Sorry! I made a mistake - I went and checked whether readline was
installed and not readline-devel.
I installed readline-devel. (Thank you for re-asking that question.)

Interestingly, configure *still* says...
[EMAIL PROTECTED]:~/Python-2.3.4> ./configure | grep readline
checking for rl_pre_input_hook in -lreadline... no
checking for rl_completion_matches in -lreadline... no

And the readline module is still not configured by default:
#readline readline.c -lreadline -ltermcap


But... if I change the line (in Modules/Setup) above to:
readline readline.c -lreadline

I get a clean compile and my up-arrow is now fixed!
Thank you so much for your help, Peter! :)

I don't know how to look at what is in a .so file, and I'm not clear on
whether /usr/lib/libreadline.a and the /usr/include/readline headers existed
prior to installing readline-devel or not (I would guess not), but it would
seem that version 4.3 definitely *should* be sufficient (as you pointed
out).
[EMAIL PROTECTED]:/usr/lib> ls *readline*
libguilereadline-v-12.a   libguilereadline-v-12.so.12  libreadline.so
libguilereadline-v-12.la  libguilereadline-v-12.so.12.3.0
libguilereadline-v-12.so  libreadline.a
[EMAIL PROTECTED]:/usr/lib> nm libreadline.a | grep letion_match
08d0 t gen_completion_matches
1c60 T rl_completion_matches
0070 T completion_matches
 U rl_completion_matches
[EMAIL PROTECTED]:/usr/lib> nm libreadline.a | grep input_hook
0030 B rl_pre_input_hook
[EMAIL PROTECTED]:/usr/lib> cd /usr/include/readline/
[EMAIL PROTECTED]:/usr/include/readline> ls
chardefs.h  keymaps.h   rlconf.h  rltypedefs.h
history.h   readline.h  rlstdc.h  tilde.h
[EMAIL PROTECTED]:/usr/include/readline> grep input_hook *
readline.h:extern rl_hook_func_t *rl_pre_input_hook;
[EMAIL PROTECTED]:/usr/include/readline> grep rl_completion_matches *
readline.h:extern char **rl_completion_matches PARAMS((const char *,
rl_compentry_func_t *));

So, there still seems to be a misbehaviour in the configure script. I'm
sure there must be other people on similar systems that would like to just
type:
./configure
make
make install

and be done with it, running v2.3.4 (or other?) with command line editing
working!
Looks like a bug worth reporting, yeah?

Thanks again for your help! :)


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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread PA
Hi Dan,
On Jan 29, 2005, at 02:31, Dan Perl wrote:
At first I thought you were being sarcastic.
For once, no. Something which is pretty much out of character I have to 
confess 8^)

 I doubt that now.  Iindulge my
curiosity please and tell us what you enjoy about it.
Well... perhaps it's a question of timing...
I'm trying to keep up with some New Year resolutions:
http://www.pragmaticprogrammer.com/loty/
And therefore learning a little language named Lua:
http://www.lua.org/about.html
The catch is that I have been doing OOP for well over a decade now, so 
me first Lua perversion is to build an OO system of sort:

http://article.gmane.org/gmane.comp.lang.lua.general/13515
Ironically enough, Xah Lee's post spelled out quite incisively all the 
things I was attempting to do in Lua, but from the opposite point of 
view. Therefore my sincere enjoyment of his post :)

Even though Mr Lee seems to have quite a reputation in some circles, I 
have to admit I enjoyed reading some of his, er, more convoluted essays 
as well.

Plus, a man which such cinematographic tastes [1] cannot be entirely 
bad :P

http://xahlee.org/PageTwo_dir/Personal_dir/favorite_movies.html
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: limited python virtual machine

2005-01-28 Thread Steven Bethard
Alex Martelli wrote:
Steven Bethard <[EMAIL PROTECTED]> wrote:
   ...
If I could see how to go from 'object' (or 'int', 'str', 'file', etc.)
to 'eval' or '__import__', that would help out a lot...

object.__subclasses__()
[, , , ,
, , , , , ,
, , , , , , ]
Traipse through these, find one class that has an unbound method, get
that unbound method's func_globals, bingo.
Thanks for the help!  I'd played around with object.__subclasses__ for 
a while, but I hadn't realized that func_globals was what I should be 
looking for.

Here's one route to __builtins__:
py> string_Template = object.__subclasses__()[17]
py> builtins = string_Template.substitute.func_globals['__builtins__']
py> builtins['eval']

py> builtins['__import__']

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


Re: Who should security issues be reported to?

2005-01-28 Thread grahamd
> OP: Did you discover this supposed security hole from black-box
observation
> of behavior or by being one of the 'lots of people being able to look
at
> source code', thereby giving evidence to the point?

The technique used which is the source of the problem was actually
first discovered in a separate package to the Python distribution, but
it was known that the same technique was used in a module within the
Python distribution. It is quite possible that other third party
packages might use it as well, although a few of the main stream
packages have been checked and they don't use exactly the same
technique so are okay. I could have just ignored the fact that the
Python distribution had the problem and worried about the other package
only.

> a) The OP has provided no info about his/her claim.

Since the problem at least affects two packages and because of the
potential for mischief, I am hardly about to identify the packages
concerned, nor describe anything that is going to allow people to work
out what the issue is.

> b) The OP's original post is a classical troll: blast volunteer
developers
> for not having anticipated and planned for a novel situation; argue
against
> things not said, at least now here, not recently; imply that
volunteers own
> him something.  Most people with the expertise to detect a security
hole
> would know better.

And the reaction is what I have more and more been seeing in Open
Source circles. That, is either treat posters like ignoreant newbies
who know no better, or assume they are a trolls trying to discredit
Open Source. Quite sad really, one tries to do the right thing and gets
abused for it. It doesn't matter if a large project may be perceived as
being mostly immune to security problems, one could still occur and if
it isn't simple to raise such an issue I am sure than some people
wouldn't even bother.

> c) The noise generated because of b) has alerted any malware writers
> monitering c.l.p for hints about exploitable security holes that
there
> might be one in one of the few modules where such could reasonably
be.

With approx 200+ modules in the Python distribution I can hardly see
how this helps. If I had done what you had wanted in (a) and gave
actual information about the problem I would have been narrowing down
the problem to less than a dozen modules. You can't have it both ways.

> OP: If my doubts are wrong and you really do have something to
quietly
> report to the 'authority', then do so, and quit making a noise about
it.

And so it is was and knowledgeable people are looking at the issue. It
should not though have necessitated me making a noise in order to find
someone to deal with it in a timely manner. When a proprietary company
doesn't have an easy way of reporting problems or seems not to care too
much, Open Source people are on top of them like wolves. Why can't Open
Source people hold themselves to the same standard.

Not sure why I have even bothered to respond to you as it is probably
just the sort of attention you want. You even appear to have some
history of taking issue with people, even though in one of your own
posts you state:

> Responding to trollish postings. (Jan 26)
>
> My personal strategy is to read only as much of trollish
> threads as I find interesting or somehow instructive, almost never
respond,
> and then ignore the rest.  I also mostly ignore discussions about
such
> threads.
>
> Terry J. Reedy

Maybe you should simply have not responded. Lets see if you now ignore
the followup discussion. :-)

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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl

"PA" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> On Jan 29, 2005, at 01:09, Martin Ambuhl wrote:
>
>> Xah Lee wrote his usual masturbatory crap:
>
> Well... I have to admit that I tremendously enjoyed such "masturbatory 
> crap" (sic).
>
> Eagerly looking toward the next installment.

At first I thought you were being sarcastic.  I doubt that now.  Iindulge my 
curiosity please and tell us what you enjoy about it. 


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


Re: Who should security issues be reported to?

2005-01-28 Thread Nick Coghlan
Fredrik Lundh wrote:
Nick Coghlan wrote:

I'm sorry, but this isn't really good enough. If Open Source wants to
say that they are better than these proprietary companies, they need
to deal with these sorts of things more professionally and establish
decent channels of communications for dealing with it.
Is that the sound of a volunteer I hear?
All you have to do is put your hand up, and the problem will be solved. If not you, who?

oh, please.  this is a security issue.  it needs a little more coordination
than an ordinary bug report.
 
Well, a less facetious answer to the OP's question would be Anthony Baxter. As 
the current release manager, he's the best contact point I can think of.

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: limited python virtual machine

2005-01-28 Thread Nick Coghlan
Alex Martelli wrote:
Steven Bethard <[EMAIL PROTECTED]> wrote:
   ...
If I could see how to go from 'object' (or 'int', 'str', 'file', etc.)
to 'eval' or '__import__', that would help out a lot...

object.__subclasses__()
[, , , ,
, , , , , ,
, , , , , , ]
Traipse through these, find one class that has an unbound method, get
that unbound method's func_globals, bingo.
So long as any Python modules are imported using the same restricted environment 
 their func_globals won't contain eval() or __import__ either.

And C methods don't have func_globals at all.
However, we're talking about building a custom interpreter here, so there's no 
reason not to simply find the dangerous functions at the C-level and replace 
their bodies with "PyErr_SetString(PyExc_Exception, "Access to this operation 
not allowed in restricted build"); return NULL;".

Then it doesn't matter *how* you get hold of file(), it still won't work. (I can 
hear the capabilities folks screaming already. . .)

Combine that with a pre-populated read-only sys.modules and a restricted custom 
interpreter would be quite doable. Execute it in a separate process and things 
should be fairly solid.

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread Robert Kern
drife wrote:
David,
I noticed that the libraries that ATLAS builds are not shared
objects (e.g., liblapack.a). Should these be shared objects?
I see nothing in the ATLAS documentation about building
things as shared objects.
Wondering if this is why the Numeric install is failing.
No, they should work just fine as static libraries.
--
Robert Kern
[EMAIL PROTECTED]
"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
--
http://mail.python.org/mailman/listinfo/python-list


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Eric Sosman
Xah Lee wrote:
[...]
Tomorrow i shall cover more manmade jargons and complexities arising
out of the OOP hype, in particular Java. [...]
I hope you will not, or that if you do so you will
do it elsewhere.  Go pound sand.
--
Eric Sosman
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: a sequence question

2005-01-28 Thread Nick Coghlan
Duncan Booth wrote:
Try this:
l = [1, 2, 3, 4]
for a, b in zip(*[iter(l)]*2):
   print a, b
zip(*[iter(seq)]*N) will group by N (but if there are any odd items at the 
end it will ignore them).

map(None, *[iter(seq)]*N) will group by N padding the last item with None 
if it needs to.
For anyone else who was as bemused as I was that Duncan's and F. Petitjean's 
suggestions actually *work*, this was what I had to do to figure out *why* they 
work:

Py> l = [1, 2, 3, 4]
Py> itr = iter(l)
Py> zip(itr) # Put all items from iterator in position 1
[(1,), (2,), (3,), (4,)]
Py> itr = iter(l)
Py> zip(itr, itr) # Put every second item in position 2
[(1, 2), (3, 4)]
Using zip(*[iter(l)]*N) or zip(*(iter(l),)*N) simply extends the above to the 
general case.

I'd definitely recommend hiding this trick inside a function. Perhaps something 
like (using Michael's function name):

from itertools import izip, repeat, chain
def partition(seq, part_len):
  return izip(*((iter(seq),) * part_len))
def padded_partition(seq, part_len, pad_val=None):
  itr = iter(seq)
  if (len(seq) % part_len != 0):
padding = repeat(pad_val, part_len)
itr = chain(itr, padding)
  return izip(*((itr,) * part_len))
Py> list(partition(range(10), 2))
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9)]
Py> list(partition(range(10), 3))
[(0, 1, 2), (3, 4, 5), (6, 7, 8)]
Py> list(padded_partition(range(10), 2))
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9)]
Py> list(padded_partition(range(10), 3))
[(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, None, None)]
Py> list(padded_partition(range(10), 3, False))
[(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, False, False)]
Py> zip(*padded_partition(range(10), 3))
[(0, 3, 6, 9), (1, 4, 7, None), (2, 5, 8, None)]
Not sure how useful that last example is, but I thought it was cute :)
Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread drife
David,

I noticed that the libraries that ATLAS builds are not shared
objects (e.g., liblapack.a). Should these be shared objects?
I see nothing in the ATLAS documentation about building
things as shared objects.
Wondering if this is why the Numeric install is failing.


Daran

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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread PA
On Jan 29, 2005, at 01:09, Martin Ambuhl wrote:
Xah Lee wrote his usual masturbatory crap:
Well... I have to admit that I tremendously enjoyed such "masturbatory 
crap" (sic).

Eagerly looking toward the next installment.
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: some kind of LFU dict...

2005-01-28 Thread Larry Bates
Sounds like you want a database (e.g. on disk storage
of keys and values that get accessed via the key).
Take a look at one of the databases for storing your
key/value pairs.
Larry Bates
Joh wrote:
Hello,
(first i'm sorry for my bad english...)
for a program, i need to have some kind of dictionary which will
contain a huge amount of keys and values. i have tried 'to do it
simple' using a normal dict but when available memory was exhausted,
my computer started to be really slow as it swap-ed.
so i wondered if i can not use some kind of cache, i googled and found
information on LRU, LFU, and LFU interested me : keep only most
frequently used items inside dict (and memory) and writing others on
disk for a possible future reuse.
here is a silly attempt to do it, it still missed some features but
before to continue i would like to have your opinions. i'm interested
in any propositions or refactorisations :) and btw i may have missed
others already/tuned/better solutions...
best.
---
import fileinput, pickle, random, shutil, sys
class sLFU:
TMP = """%s.bak"""
""" a simple kind of Least Frequently Used container"""
def __init__(self, size, ratio, filename = None):
""" filename = a temporary file which will could be deleted"""
self.d = {} #   container
self.size, self.ratio = size, ratio
self.freqs, self.fmin = {}, 0
self.filename = filename
if self.filename: open(self.filename, 'w')
def __setitem__(self, obj, v):
self.d[obj] = v
self.freqs[obj] = self.freqs.get(obj, self.fmin) + 1
if len(self.d) > self.size:
""" lfu = { (size / ratio) least frequently used
objects... }"""
freqs = [(f, obj) for (obj, f) in self.freqs.items()]
# maybe should i use a generator () like
# ((f, obj) for (obj, f) in self.freqs.items())
freqs.sort()
lfu = {}
# and here enumerate(sorted(freqs))
for i, (f, obj) in enumerate(freqs):
if i > self.size / self.ratio:
break
lfu[obj] = self.d[obj]
""" next minimal frequency will be max frequency of the
lfu
(maybe it would be better to substract this from others in
self.freqs)"""
self.fmin = f
"""   and now delete theses objects..."""
for obj in lfu:
del self.freqs[obj]
del self.d[obj]
if self.filename:
""" now must save lfu to disk...
as i do not managed to do otherwise, copy file to a
tmp
file and read it line by line, updating when
necessary...
there must be plenty rooms for improvement here :("""
shutil.copy(self.filename, self.TMP % self.filename)
fhs = open(self.TMP % self.filename)
fh = open(self.filename, 'w')
""" flag to ignore 'value' line"""
ignoreNext = False
for i, line in enumerate(fhs):
""" first copy old lfu which were already set,
updating
them if necessary..."""
if ignoreNext:
ignoreNext = False
continue
line = line.rstrip()
if i % 2 == 0:
obj = self.loads(line)
if obj not in lfu and obj in self.d:
""" obj available from memory, do not to
keep it on disk..."""
ignoreNext = True
continue
elif obj in lfu:
""" obj was available from memory, but as
a lfu,
was removed and must be updated on disk"""
fh.write("%s\n" % line)
fh.write("%s\n" % self.dumps(lfu[obj]))
del lfu[obj]
ignoreNext = True
continue
""" default behaviour : copy line..."""
fh.write("%s\n" % line)
""" from now lfu should contain only unseen lfu
objects,
add them to file..."""
fh = open(self.filename, 'a')
for obj in lfu:
fh.write("%s\n" % self.dumps(obj))
fh.write("%s\n" % self.dumps(lfu[obj]))
def __getitem__(self, obj):
if obj in self.d:
""" from memory :)"""
return self.d[obj]
if self.filename:
""" if a filename was provided, search inside file if
such an obj is present, then return it ; else raise
IndexErrror."""
fh = open(self.filename)
found = False
for i, line in enumerate(fh):
line = line.rstrip()

Re: move bugs from Zope BITS into Bugzilla?

2005-01-28 Thread richard
[EMAIL PROTECTED] wrote:
> I inherited a bug reporting system at work, and it's currently in Zope
> BITS (Bug Information Tracking System).  This version of BITS uses ZODB
> -- not the RDBMS version.  I would like to export all the incident
> reports from BITS to later import into Bugzilla, but as of yet I
> haven't quite figured it out.  As soon as I'm done with this, that's it
> for BITS and Zope, so I'd like to avoid writing a Zope app just for
> this.
> 
> Anyone solved this problem, or at least the part about exporting from
> BITS?  I'd hand-enter the open issues, but they also want the closed
> ones for tracking & posterity.

I'm not helping you with your problem, just plugging my own tracker ;)

Use Roundup! It's Pure Python :)

http://roundup.sf.net/



   Richard

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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Carl Banks

Dan Perl wrote:
> I will not get into your "history" of the "OOP hype".


The best thing to is just ignore him.

But, if he bothers you too much to let it slide, then don't take issue
with anything he writes.  Just post a follow-up warning the newbies
that he's a pest, that his claims are untrue and his advice is not
good, and that he appears that his posts are just trolling in disguise.

(Or, you could do what I do when I feel a need to reply: follow-up with
a Flame Warriors link.  For Xah, it would probably be this:
http://tinyurl.com/4vor3 )


-- 
CARL BANKS

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


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread drife
David,

One more thing. I checked to see if the SciPy libraries had
dependencies on ATLAS. They do not, however, the eigenvector
calculation is still much faster than Numeric?
This is very strange.

Daran

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


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread drife
Hi David,

Yes, when Numeric compiles it does look like the linking is being
done properly. I captured the build to a file and see a few lines
similar to:


gcc -pthread -shared build/temp.linux-i686-2.4/Src/lapack_litemodule.o
-L/d2/lib/atlas -llapack -lptcblas -lptf77blas -latlas -lg2c -o
build/lib.linux-i686-2.4/lapack_lite.so

I checked the files in build/lib.linux-i686-2.4 and none have
dependencies on ATLAS.

When I run Python interpreter with:

>>> import Numeric
>>> Numeric.__file__

I get the answer I expect.
I am totall baffled.

Any other ideas?

Thanks for your help,

Daran

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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Martin Ambuhl
Xah Lee wrote his usual masturbatory crap:
Lisp is not topical in 3 of the 5 newsgroups you spewed on.
Java is not topical in 5 of the 5 newsgroups you spewed on.
Get your head out your butt and post to Java newsgroups if you want and 
they'll have you.  Are you inflicting this crap on the rest of us 
because the Java people know you to be a troll?
Followup-to set to comp.lang.java.advocacy where it might belong.
--
http://mail.python.org/mailman/listinfo/python-list


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Keith Thompson
"Xah Lee" <[EMAIL PROTECTED]> writes:
[snip]

If you must post a followup to this, please drop comp.lang.c from the
newsgroups header.  I can't speak for the other newsgroups, but it's
definitely off-topic here in comp.lang.c.  Thank you.

-- 
Keith Thompson (The_Other_Keith) [EMAIL PROTECTED]  
San Diego Supercomputer Center <*>  
We must do something.  This is something.  Therefore, we must do this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Where can I find sample "beginner" programs to study?

2005-01-28 Thread Marc Poulin
Todd_Calhoun wrote:

> I'm trying to learn Python (and programming), and I'm wondering if there
> are any places where I can find small, simple programs to study.
> 
> Thanks.

Look at
http://www.livewires.org.uk/python/

Good projects and tutorials for beginners.

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


move bugs from Zope BITS into Bugzilla?

2005-01-28 Thread lmhaskins
I inherited a bug reporting system at work, and it's currently in Zope
BITS (Bug Information Tracking System).  This version of BITS uses ZODB
-- not the RDBMS version.  I would like to export all the incident
reports from BITS to later import into Bugzilla, but as of yet I
haven't quite figured it out.  As soon as I'm done with this, that's it
for BITS and Zope, so I'd like to avoid writing a Zope app just for
this.

Anyone solved this problem, or at least the part about exporting from
BITS?  I'd hand-enter the open issues, but they also want the closed
ones for tracking & posterity.

Thanks!

-lmh

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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Martin Ambuhl
Dan Perl wrote:
Actually, it can be as simple as:
public class test {
There is no "public" or "class" in C.  Please don't post such trash to 
comp.lang.c.  In fact, C++ is not topical in any of the five newsgroups 
you posted to. I don't know where you're posting from, so I apologize to 
the perl, python, lisp, scheme, and C people who see this in their 
newsgroups.  Followup-To set to comp.lang.c++ where you can play with 
your bloated language all you wish.
--
http://mail.python.org/mailman/listinfo/python-list


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread David M. Cooke
"drife" <[EMAIL PROTECTED]> writes:

> Hi David,
>
> I performed the above check, and sure enough, Numeric
> is --not-- linked to the ATLAS libraries.
>
> I followed each of your steps outlined above, and Numeric
> still is not linking to the ATLAS libraries.
>
> My setup.py file is attached below.

> # delete all but the first one in this list if using your own LAPACK/BLAS
> sourcelist = [os.path.join('Src', 'lapack_litemodule.c')]
> # set these to use your own BLAS;
>
> library_dirs_list = ['/d2/lib/atlas']
> libraries_list = ['lapack', 'ptcblas', 'ptf77blas', 'atlas', 'g2c']
>
> # set to true (1), if you also want BLAS optimized 
> matrixmultiply/dot/innerproduct
> use_dotblas = 1
> include_dirs = ['/d2/include']

This all look right (assuming you've got the right stuff in /d2).

When it compiles, does it look like it's actually doing the linking?
After doing python setup.py build, you can run ldd on the libraries in
the build directory (something like build/lib.linux-i386-2.3/lapack_lite.so).
If that's linked, then it's not being installed right.

You don't have a previous Numeric installation that's being picked up
instead of the one you're trying to install, do you?

At the interpreter prompt, check that
>>> import Numeric
>>> Numeric.__file__

gives you something you're expecting, and not something else.

-- 
|>|\/|<
/--\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Where can I find sample "beginner" programs to study?

2005-01-28 Thread Todd_Calhoun
Thanks for the great links.  The cookbook page has some smaller stuff that 
looks great.


"JanC" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Todd_Calhoun schreef:
>
>> I'm trying to learn Python (and programming), and I'm wondering if
>> there are any places where I can find small, simple programs to study.
>
> Try:
> 
> 
>
> -- 
> JanC
>
> "Be strict when sending and tolerant when receiving."
> RFC 1958 - Architectural Principles of the Internet - section 3.9 


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


Re: Daylight savings and getmtime

2005-01-28 Thread Christophe Cavalaria
Qvx wrote:

> Hello,
> 
> I'we written a simple web deployment program which scans for the
> changes made to local copy of web site. Changed files are than
> packaged into a zip file and deployed to web server.
> 
> Now here's the catch. Changes are computed using (1) log file from the
> last deployment and (2) local file system. Log file contains
> datestamps (integers) returned from os.path.getmtime(f) function at
> the time of last deployment. So i'm comparing two getmtime() values.
> The problem is when Daylight saving kicks in: suddenly all local files
> are reported as older than they were at the time of deployment.
> 
> How do I compensate for this?
> 
> Thanks,
> Tvrtko

Never use the local time, always use GMT ( UTC ) time instead.

Since it seems os.path.getmtime already gives UTC time, onemust wonder if
your OS isn't broken in some way ;) If you can't solve that problem, then
use a simple md5sum of the files instead. md5sum isn't that slow to compute
and it gives better results than timestanps.

Or use a specialised tool like rsync which does a very good job for that.

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


Re: example needed: sip + Qt

2005-01-28 Thread Phil Thompson
So have you created the library you are trying to wrap? The documentation is 
describing how to wrap a library and describes a fictional library as the 
basis for the example.

Phil

On Friday 28 January 2005 11:02 pm, Uwe Mayer wrote:
> Friday 28 January 2005 23:39 pm Uwe Mayer wrote:
> > Friday 28 January 2005 23:18 pm Uwe Mayer wrote:
> >> Traceback (most recent call last):
> >>   File "", line 1, in ?
> >> ImportError: ./hello.so: undefined symbol: _ZTV5Hello
> >>
> >> $ c++filt _ZTV5Hello
> >> vtable for Hello
> >>
> >> The compilation did not give any warnings or error messages. Any ideas?
> >
> > $ ldd -d hello.so
> > libqt-mt.so.3 => /usr/lib/libqt-mt.so.3 (0x40057000)
> > libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4190c000)
> > libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4154e000)
> > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x41173000)
> > libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40743000)
> > libm.so.6 => /lib/tls/libm.so.6 (0x4114f000)
> > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x407fd000)
> > libc.so.6 => /lib/tls/libc.so.6 (0x41019000)
> > libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x418d8000)
> > libaudio.so.2 => /usr/lib/libaudio.so.2 (0x40807000)
> > libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x4191c000)
> > libpng12.so.0 => /usr/lib/libpng12.so.0 (0x4081c000)
> > libz.so.1 => /usr/lib/libz.so.1 (0x41856000)
> > libXrender.so.1 => /usr/lib/libXrender.so.1 (0x41749000)
> > libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x40842000)
> > libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x41734000)
> > libXft.so.2 => /usr/lib/libXft.so.2 (0x416e1000)
> > libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x42487000)
> > libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x42583000)
> > libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4256a000)
> > libdl.so.2 => /lib/tls/libdl.so.2 (0x41184000)
> > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x8000)
> > libexpat.so.1 => /usr/lib/libexpat.so.1 (0x40847000)
> > undefined symbol: _ZTV5Hello(./hello.so)
> > undefined symbol: _ZNK5Hello9classNameEv(./hello.so)
> > undefined symbol: _ZN5Hello7qt_castEPKc (./hello.so)
> > undefined symbol: _ZN5Hello9qt_invokeEiP8QUObject   (./hello.so)
> > undefined symbol: _ZN5Hello7qt_emitEiP8QUObject (./hello.so)
> > undefined symbol: _ZN5Hello11qt_propertyEiiP8QVariant   (./hello.so)
> > undefined symbol: _ZTI5Hello(./hello.so)
> >
> > undefined symbol: _Py_NoneStruct(./hello.so)
> > undefined symbol: PyCObject_Type(./hello.so)
>
> Those last two can be removed if you link against libpython2.3.so and by
> appending -lpython2.3 to the libs in the Makefile.
>
> Uwe
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Daylight savings and getmtime

2005-01-28 Thread [EMAIL PROTECTED]
on my windows xp box os.path.getmtime gives back local time (I just
saved the file):
>>> os.path.getmtime('c:\\temp\\testset.py')
1106955016
>>> print time.mktime(time.localtime())
1106955034.0

You can try to figure out if DST is on by comparing time.localtime()
versus time.gmtime(). In the Western European Timezone there's one hour
difference in winter and two hours  in summer.

>>> os.path.getmtime('c:\\temp\\testset.py')
1106954702
>>> g = time.mktime(time.gmtime())
>>> l = time.mktime(time.localtime())
>>> print g, l
1106951381.0 1106954987.0
>>> os.path.getmtime('c:\\temp\\testset.py')
1106955016
>>> print time.mktime(time.localtime())
1106955034.0
>>> print l - g
3606.0
>>>

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


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread drife
Hi John,

I do have more than one version of Python laying around.

To do the build and install I am typing:

/d2/python/bin/python setup.by build > &! build.out
/d2/python/bin/python setup.by install > &! install.out
Should I be doing something different?

Daran

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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread PA
On Jan 29, 2005, at 00:10, Xah Lee wrote:
Tomorrow i shall cover more manmade jargons and complexities arising
out of the OOP hype, in particular Java.
Good read. Keep them coming :)
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/
--
http://mail.python.org/mailman/listinfo/python-list


Mail sent to Hibernian has a virus !!!

2005-01-28 Thread MAILsweeper
Mail sent to Hibernian was received with a computer 
virus infected attachment. The mail has been 
intercepted and did not reach the intended recipient. 
Sender please remove the virus from the message 
and resend the mail.

From:  python-list@python.org
To:  [EMAIL PROTECTED]

Subject: Mail Delivery (failure [EMAIL PROTECTED])
Virus:  Scenarios/Incoming/Content Scanner: Threat: 'W32/Netsky-P' detected by 
'Sophos AV Interface for MIMEsweeper'.
Scenarios/Incoming/Blocking .SCR file types incoming: A filename matching the 
file mask was detected: 'message.scr'.
Scenarios/Incoming/Restrict Attachments In: 'ItemLength.GE.0'.


was blocked at Fri, 28 Jan 2005 23:30:42 +

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


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl

"Dan Perl" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Actually, it can be as simple as:
> public class test {
>public static void main(String[] args) {
>String c = new String("a string"+" another one");
>System.out.println(c);
>}
> }

I forgot.  It can be even simpler:

public class test {
public static void main(String[] args) {
System.out.println("a string"+" another one");
}
} 


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


Re: example needed: sip + Qt

2005-01-28 Thread Uwe Mayer
Saturday 29 January 2005 00:23 am Phil Thompson wrote:

> So have you created the library you are trying to wrap? The documentation
> is describing how to wrap a library and describes a fictional library as
> the basis for the example.

No, the extracts from before are from the code example of the fictional
library with no further implementation. 

By now I also found the problem: the poor python programmer did not care to
create the makefile (for building hello.cpp and hello.h) with qmake and
thus there were no moc files and that stupid programmer (me) could not link
against them. 

It compiles and loads in python now. 
Thanks
Uwe 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl

"Xah Lee" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> public class test {
> public static void main(String[] args) {
> String a = new String("a string");
> String b = new String("another one");
> StringBuffer c = new StringBuffer(40);
> c.append(a); c.append(b);
> System.out.println(c.toString());
> }
> }

Actually, it can be as simple as:
public class test {
public static void main(String[] args) {
String c = new String("a string"+" another one");
System.out.println(c);
}
}

I will not get into your "history" of the "OOP hype". 


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


Re: Mac OS and MySQLdb

2005-01-28 Thread T. Kaufmann
Andy Dustman wrote:
The source is for all platforms. Use the Source, Luke. If 1.1.9 does
not compile on Mac OS X, file a bug.
Thanks a lot;-).
--
http://mail.python.org/mailman/listinfo/python-list


Re: What's so funny? WAS Re: rotor replacement

2005-01-28 Thread "Martin v. Löwis"
Paul Rubin wrote:
Let's see, the urandom module was recently released in 2.4, I think
initially at my urging.  
There is no urandom module in Python 2.4.
If you can't speak for others, how can you say there's no policy in
force?
I should say I'm not aware of a policy.
If Guido says "no crypto", is that something other than a
policy?  And are you speaking for him when you say that?  
If he had said such a thing in general, it would be a policy
(although it best would be documented somewhere). I don't think
he said that, in general, and with the intent of stating a policy.
That's much different than merely deciding
that a feature is good and inviting people to work on it.
We don't normally invite people to work on anything. People
pick the things they work on themselves.
IETF often decides and announces that a feature is good long before
any such details are decided or agreed on.  For example, they decided
that IP connection encryption was a good feature, and appointed a
working group a general mandate to go figure out the details (IPSEC)
and write a spec.  See?
No. They decided that spam machinery in DNS would be a good thing,
people started to work on it, and then they decided that it is not
such a good thing, after all, because it causes too many problems.
So the decision "this is a good thing" is no guarantee for
"if it is done, we will publish it as a standard". They might
start a process, people might get nearly through it, and then
the process stucks or is given up entirely. Happens all the time.
I realize that the difference might
not matter to you, but it does matter to a heck of a lot of other
users.
It does matter for me, yet Python is still more than the core.
You might be ignoring that, but it surely is more to the many
developers which create Python libraries and distribute them
themselves, see
http://www.python.org/pypi
THIS IS ALL PYTHON.
Obviously those require a different type of consideration.  I'm
talking about patches where there's a core developer with an interest.
I though you were talking about the AES module...
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list


what's OOP's jargons and complexities?

2005-01-28 Thread Xah Lee
in computer languages, often a function definition looks like this:

subroutine f (x1, x2, ...) {
variables ...
do this or that
}

in advanced languages such as LISP family, it is not uncommon to define
functions inside a function. For example:

subroutine f (x1, x2, ...) {
variables...
subroutine f1 (x1...) {...}
subroutine f2 (x1...) {...}
}

often these f1 f2 inner functions are used inside f, and are not
relevant outside of f. Such power of the language gradually developed
into a style of programing. For example:

subroutine a_surface () {
coordinatesList = ...;
subroutine translate (distance) {...}
subroutine rotate (angle) {..}
}

such a style is that the a_surface is no longer viewed as a function.
But instead, a boxed set of functions, centered around a piece of data.
And, all functions for manipulating this piece of data are all embodied
in this function. For example:

subroutine a_surface (arg) {
coordinatesList = ...
subroutine translate (distance) {set coordinatesList to translated
version}
subroutine rotate (angle) {set coordinatesList to rotated version}
subroutine return () {return coordinatesList}

if (no arg) {return coordinatesList}
else { apply arg to coordinatesList }
}

In this way, one uses a_surface as a data, which comes with its owe set
of functions:

mySurface = a_surface();
a_surface(rotate(angle)); # now the surface data has been rotated
a_surface(translate(distance)); # now its translated
myNewSurface = a_surface(return())

So now, a_surface is no longer viewed as a subroutine, but a boxed set
of things centered around a piece of data. All functions that work on
the data are included in the boxed set. This paradigm available in
functional languages has refined so much so that it spread to other
groups that it became knows as Object Oriented Programing, and complete
languages with new syntax catered to such scheme emerged.

In such languages, instead of writing them like this:

mySurface = a_surface();
a_surface(rotate(angle));

the syntax is changed to like this, for example:

mySurface = new a_surface();
mySurfaceRotated = mySurface.rotate(angle);

In such languages, the super subroutine a_surface is no longer called a
function or subroutine. They are now called a "Class". And now the
variable "mySurface = a_surface()" is now called a "Object". The
subroutines inside the function a_surface() is no longer called
inner-subroutines. They are called "Methods".

This style of programing and language have become so fanatical that in
such dedicated languages like Java, everything in the language are
"Classes". One can no longer just define a variable or subroutine.
Instead, one creates these meta-subroutine "Classes". Everything one do
are inside Classes. And one assign variables inside these Classes to
create "Objects". And one uses "Methods" to manipulate Objects. In this
fashion, even data types like numbers, strings, and lists are no longer
atomic data types. They are now Classes.

For example, in Java, a string is a class String. And inside the class
String, there are Methods to manipulate strings, such as finding the
number of chars, or extracting parts of the string. This can get very
complicated. For example, in Java, there are actually two Classes of
strings: One is String, and the other is StringBuffer. Which one to use
depends on whether you intend to change the data.

So, a simple code like this in normal languages:

a = "a string";
b = "another one";
c = join(a,b);
print c;

or in lisp style

(set a "a string")
(set b "another one")
(set c (join a b))
(print c)

becomes in pure OOP languages:

public class test {
public static void main(String[] args) {
String a = new String("a string");
String b = new String("another one");
StringBuffer c = new StringBuffer(40);
c.append(a); c.append(b);
System.out.println(c.toString());
}
}

here, the "new String" creates a String object. The "new
StringBuffer(40)"
creates the changeable string object StringBuffer, with room for 40
chars. "append" is a method of StringBuffer. It is used to join two
Strings.

Notice the syntax "c.append(a)", which we can view it as calling a
inner subroutine "append", on a super subroutine that has been assigned
to c, where, the inner subroutine modifies the inner data by appending
a to it.

And in the above Java example, StringBuffer class has another method
"toString()" used to convert this into a String Class, necessary
because System.out.println's parameter requires a String type, not
StringBuffer.

For a example of the complexity of classes and methods, see the Java
documentation for the StringBuffer class at
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html

in the same way, numbers in Java have become a formalization of many
classes: Double, Float, Integer, Long... and each has a bunch of
"methods" to operate or convert from one to the other.

Instead of

aNumber = 3;
print aNumber^3;

in Java the programer needs to master the ins and outs of the several
number classes, and deci

Re: Problems with PyQt

2005-01-28 Thread Phil Thompson
I suggest that you post your question to the PyKDE mailing list and include a 
complete example that demonstrates your problem as an attachment (so the 
indentation is preserved).

Phil

On Friday 28 January 2005 9:42 pm, Michael McGarry wrote:
> Hi,
>
> I am having a problem making a widget appear. I have 5 widgets which
> are windows with no parents. 3 of the widgets appear without a problem
> the other 2 widgets will not appear when I invoke widget.show() from
> within a handler for another widget. I am completely clueless as to why
> these 2 widgets will not draw. One of them is simply a wait window I
> want to appear while I am performing a time consuming task.
>
> Here is a snippet of code:
>
> def viewSimButton_pressed(self):
> wait_win.waitProgressBar.setPercentageVisible(1)
> wait_win.waitProgressBar.setTotalSteps(5)
> wait_win.waitProgressBar.setProgress(0)
> wait_win.show()
> self.hide()
> self.viewSimButton.setDown(0)
> for loopIdx in range(self.simListBox.count()):
> if self.simListBox.isSelected(loopIdx) == 1:
> simIdx = loopIdx
> simID = self.simListBox.item(simIdx).text().ascii()
> # Clear list box
> sim_view_win.simOutputListBox.clear()
> if os.path.exists(simID) == 1:
> os.chdir(simID)
> wait_win.waitProgressBar.setProgress(1)
> # Check process ID file
> if os.path.exists('pid') == 1:
> time.sleep(1) # wait 1 second, then check again
> pidFile = open('pid','r')
> pidStr = pidFile.readline()
> if pidStr == 'done\n':
> sim_view_win.simStatusLbl.setText('Completed')
> else:
> sim_view_win.simStatusLbl.setText('Running')
> simData = sims[simID]
> sim_view_win.simIDEdit.setText(simID)
> sim_view_win.hostEdit.setText(simData['host'])
> wait_win.waitProgressBar.setProgress(3)
> # Fill list box with output files
> #
> filedir = os.popen('ls','r')
> filename = filedir.readline()
> while filename:
> filename = string.rstrip(filename)
> if ((filename != 'pid') and (filename != 'sim_cfg') and (filename !=
> 'sim_log')
> and (filename != 'sim_core')
> and (string.find(filename,'.fig') == -1)
> and (string.find(filename,'.gp') == -1)):
> sim_view_win.simOutputListBox.insertItem(filename)
> filename = filedir.readline()
> os.chdir('..')
> wait_win.waitProgressBar.setProgress(5)
> wait_win.hide()
> sim_view_win.show()
>
> wait_win will show on the screen but not with it's progress bar. Can
> anyone help?
>
> Thanks,
>
> Michael
-- 
http://mail.python.org/mailman/listinfo/python-list


boa constructor & mysql

2005-01-28 Thread Michele
I've search a lot to found how visualize a mysql table in a gui (wxpython).
I think to use wxgrid to visualize this table...but I don't know how...
Anyone help me?
Thanks a lot for the patience.
Michele
--
http://mail.python.org/mailman/listinfo/python-list


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread John Hunter
> "drife" == drife  <[EMAIL PROTECTED]> writes:

drife> Hi David, I performed the above check, and sure enough,
drife> Numeric is --not-- linked to the ATLAS libraries.

drife> I followed each of your steps outlined above, and Numeric
drife> still is not linking to the ATLAS libraries.

drife> My setup.py file is attached below.

Are you sure that you 

 1) 'rm -rf build'   before rebuilding

 2) are using the python / Numeric that you think you are, eg, might
you have one python in /usr/bin and another in /usr/local.  root
paths can differ from user paths which may effect which python is
used at install time versus run time

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


Daylight savings and getmtime

2005-01-28 Thread Qvx
Hello,

I'we written a simple web deployment program which scans for the
changes made to local copy of web site. Changed files are than
packaged into a zip file and deployed to web server.

Now here's the catch. Changes are computed using (1) log file from the
last deployment and (2) local file system. Log file contains
datestamps (integers) returned from os.path.getmtime(f) function at
the time of last deployment. So i'm comparing two getmtime() values.
The problem is when Daylight saving kicks in: suddenly all local files
are reported as older than they were at the time of deployment.

How do I compensate for this?

Thanks,
Tvrtko



For those curious, here is the script. I apologize for Croatian
comments and literals and missing private libraries, but I think the
code is self-explanatory.
__

# -*- coding: windows-1250 -*- 

from os.path import getmtime, join
from os import walk, rename
from zipfile import ZipFile, ZIP_DEFLATED
from sets import Set
from StringIO import StringIO
from ftplib import FTP
from qvx.io import adapt_stdout, unadapt_stdout
from qvx.composite import Dot
from qvx.compositeutil import read_composite
import sys
import time

class DeploymentError(Exception):
pass

class Deployer:
def __init__ (self, cfg_file):
self.reset(cfg_file)

def reset (self, cfg_file):
self.read_cfg(cfg_file)
self.local_files  = []
self.remote_files = []
self.new_files= []
self.deleted_files= []
self.newer_files  = []
self.older_files  = []
self.www_all_time = None
self.old_deployed = False

def read_cfg (self, cfg_file):
tree = read_composite(cfg_file)
self.cfg = Dot(tree).DEPLOYMENT

def prepare_file_lists (self):
# Sastavi popis _datoteka_ u DIR direktoriju.
# Izostavi datoteke iz _notes direktorija
self.local_files = []
for root, dirs, files in walk(self.cfg.DIR):
filtered = [join(root, f).replace('\\', '/') for f in
files if f not in self.cfg.SKIP_FILES]
self.local_files.extend(filtered)
for skip_dir in self.cfg.SKIP_DIRS.split(','):
if skip_dir.strip() in dirs:
dirs.remove(skip_dir)

# Sastavi popis datoteka na serveru
# Koristi se sa informacijama od zadnjeg deploymenta
# Popis se nalazi u www_all.txt datoteci
self.remote_files = []
remote_stamps = {}
zip = ZipFile(self.cfg.FILE, 'r')
for line in zip.read('www_all.txt').split('\n'):
name, stamp = line.split('\t')
remote_stamps[name] = int(stamp)
self.remote_files.append(name)
self.www_all_time = zip.getinfo('www_all.txt').date_time

# Deployment nije obavljen ako nije zapisan log
self.old_deployed = 'deployment.log' in zip.namelist()
zip.close()

# Rastavi datoteke u tri kategorije: nove, obrisane i iste
lset = Set(self.local_files)
rset = Set(self.remote_files)
self.new_files = list(lset - rset)
self.deleted_files = list(rset - lset)
common_files   = list(lset & rset)

# Pogledaj što se promijenilo u zajedničkim datotekama
self.newer_files = []
self.older_files = []
for name in common_files:
remotetime = remote_stamps[name]
localtime  = getmtime(name) #+ 3600
# Ako je razlika unutar sekunde, zanemari
if abs(remotetime-localtime) > int(self.cfg.IGNORE_SEC):
if remotetime > localtime:
self.older_files.append(name)
elif localtime > remotetime:
self.newer_files.append(name)

def need_redeployment (self):
return not self.old_deployed

def check_changes (self):
# Ne bi trebalo biti starijih
if self.older_files:
raise DeploymentError('Ne smije biti starijih datoteka!')
if not (self.new_files or self.deleted_files or
self.newer_files):
raise DeploymentError('Nema promjena!')

def make_deployment_file (self):
# Uključi potrebne datoteke
deployment = ZipFile('new_'+self.cfg.FILE, 'w', ZIP_DEFLATED)
for name in self.new_files + self.newer_files:
deployment.write(name)

# Uključi popis svih datoteka
all_files = '\n'.join([f+'\t'+str(getmtime(f)) for f in
self.local_files])
deployment.writestr('www_all.txt', all_files)

# Uključi popis datoteka za obrisati
for_delete = '\n'.join(self.deleted_files)
if for_delete:
deployment.writestr('www_delete.txt', for_delete)
deployment.close()
print '\nNapravljena je nova deployment datoteka.'

# Preimenuj deployment datoteke
timestr = '%04d-%02d-%02d_%02d-%02d-%02d' % self.www_all_time
old_d

Re: example needed: sip + Qt

2005-01-28 Thread Uwe Mayer
Friday 28 January 2005 23:39 pm Uwe Mayer wrote:

> Friday 28 January 2005 23:18 pm Uwe Mayer wrote:
>> Traceback (most recent call last):
>>   File "", line 1, in ?
>> ImportError: ./hello.so: undefined symbol: _ZTV5Hello
>> 
>> $ c++filt _ZTV5Hello
>> vtable for Hello
>> 
>> The compilation did not give any warnings or error messages. Any ideas?
> 
> $ ldd -d hello.so
> libqt-mt.so.3 => /usr/lib/libqt-mt.so.3 (0x40057000)
> libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4190c000)
> libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4154e000)
> libpthread.so.0 => /lib/tls/libpthread.so.0 (0x41173000)
> libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40743000)
> libm.so.6 => /lib/tls/libm.so.6 (0x4114f000)
> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x407fd000)
> libc.so.6 => /lib/tls/libc.so.6 (0x41019000)
> libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x418d8000)
> libaudio.so.2 => /usr/lib/libaudio.so.2 (0x40807000)
> libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x4191c000)
> libpng12.so.0 => /usr/lib/libpng12.so.0 (0x4081c000)
> libz.so.1 => /usr/lib/libz.so.1 (0x41856000)
> libXrender.so.1 => /usr/lib/libXrender.so.1 (0x41749000)
> libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x40842000)
> libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x41734000)
> libXft.so.2 => /usr/lib/libXft.so.2 (0x416e1000)
> libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x42487000)
> libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x42583000)
> libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4256a000)
> libdl.so.2 => /lib/tls/libdl.so.2 (0x41184000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x8000)
> libexpat.so.1 => /usr/lib/libexpat.so.1 (0x40847000)
> undefined symbol: _ZTV5Hello(./hello.so)
> undefined symbol: _ZNK5Hello9classNameEv(./hello.so)
> undefined symbol: _ZN5Hello7qt_castEPKc (./hello.so)
> undefined symbol: _ZN5Hello9qt_invokeEiP8QUObject   (./hello.so)
> undefined symbol: _ZN5Hello7qt_emitEiP8QUObject (./hello.so)
> undefined symbol: _ZN5Hello11qt_propertyEiiP8QVariant   (./hello.so)
> undefined symbol: _ZTI5Hello(./hello.so)

> undefined symbol: _Py_NoneStruct(./hello.so)
> undefined symbol: PyCObject_Type(./hello.so)

Those last two can be removed if you link against libpython2.3.so and by
appending -lpython2.3 to the libs in the Makefile.

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


Re: Who should security issues be reported to?

2005-01-28 Thread Terry Reedy
OP:
>>I find this response a bit dissappointing frankly. Open Source people
>>make such a big deal about having lots of people being able to look at
>>source code and from that discover security problems, thus making it
>>somehow making it better than proprietary source code.

OP: Did you discover this supposed security hole from black-box observation 
of behavior or by being one of the 'lots of people being able to look at 
source code', thereby giving evidence to the point?

Everyone: I say 'supposed' because
a) The OP has provided no info about his/her claim.
b) The OP's original post is a classical troll: blast volunteer developers 
for not having anticipated and planned for a novel situation; argue against 
things not said, at least now here, not recently; imply that volunteers own 
him something.  Most people with the expertise to detect a security hole 
would know better.
c) The noise generated because of b) has alerted any malware writers 
monitering c.l.p for hints about exploitable security holes that there 
might be one in one of the few modules where such could reasonably be.

OP: If my doubts are wrong and you really do have something to quietly 
report to the 'authority', then do so, and quit making a noise about it.

Terry J. Reedy



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


Re: Elliptic Code

2005-01-28 Thread Paul Rubin
Nick Craig-Wood <[EMAIL PROTECTED]> writes:
> >  I understand the algorithm quite well but how to code the multiplication 
> >  stage most efficiently in python eludes me.
> 
> You might want to look at
> 
>   http://gmpy.sourceforge.net/
> 
> It has very fast multiplication up to any size you like!

I think he's talking about point multiplication on the elliptic curve
group, not integer multiplication.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread drife
Hi David,

I performed the above check, and sure enough, Numeric
is --not-- linked to the ATLAS libraries.

I followed each of your steps outlined above, and Numeric
still is not linking to the ATLAS libraries.

My setup.py file is attached below.

Thanks ,

Daran

--#!/usr/bin/env python
# To use:
#   python setup.py install
# or:
#   python setup.py bdist_rpm (you'll end up with RPMs in dist)
#
import os, sys, string, re
from glob import glob
if not hasattr(sys, 'version_info') or sys.version_info <
(2,0,0,'alpha',0):
raise SystemExit, "Python 2.0 or later required to build Numeric."
import distutils
from distutils.core import setup, Extension

# Get all version numbers
execfile(os.path.join('Lib','numeric_version.py'))
numeric_version = version

execfile(os.path.join('Packages', 'MA', 'Lib', 'MA_version.py'))
MA_version = version

headers = glob (os.path.join ("Include","Numeric","*.h"))
extra_compile_args = []  # You could put "-O4" etc. here.
mathlibs = ['m']
define_macros = [('HAVE_INVERSE_HYPERBOLIC',None)]
undef_macros = []
# You might need to add a case here for your system
if sys.platform in ['win32']:
mathlibs = []
define_macros = []
undef_macros = ['HAVE_INVERSE_HYPERBOLIC']
elif sys.platform in ['mac', 'beos5']:
mathlibs = []

# delete all but the first one in this list if using your own
LAPACK/BLAS
sourcelist = [os.path.join('Src', 'lapack_litemodule.c')]
# set these to use your own BLAS;

library_dirs_list = ['/d2/lib/atlas']
libraries_list = ['lapack', 'ptcblas', 'ptf77blas', 'atlas', 'g2c']

# set to true (1), if you also want BLAS optimized
matrixmultiply/dot/innerproduct
use_dotblas = 1
include_dirs = ['/d2/include']
# You may need to set this to find cblas.h
#  e.g. on UNIX using ATLAS this should be
['/usr/include/atlas']
extra_link_args = []

# for MacOS X to link against vecLib if present
VECLIB_PATH = '/System/Library/Frameworks/vecLib.framework'
if os.path.exists(VECLIB_PATH):
extra_link_args = ['-framework', 'vecLib']
include_dirs = [os.path.join(VECLIB_PATH, 'Headers')]

# The packages are split in this way to allow future optional inclusion
# Numeric package
packages = ['']
package_dir = {'': 'Lib'}
include_dirs.append('Include')
ext_modules = [
Extension('_numpy',
[os.path.join('Src', '_numpymodule.c'),
os.path.join('Src', 'arrayobject.c'),
os.path.join('Src', 'ufuncobject.c')],
extra_compile_args = extra_compile_args),
Extension('multiarray',
[os.path.join('Src', 'multiarraymodule.c')],
extra_compile_args = extra_compile_args),
Extension('umath',
[os.path.join('Src', 'umathmodule.c')],
libraries = mathlibs,
define_macros = define_macros,
undef_macros = undef_macros,
extra_compile_args = extra_compile_args),
Extension('arrayfns',
[os.path.join('Src', 'arrayfnsmodule.c')],
extra_compile_args = extra_compile_args),
Extension('ranlib',
[os.path.join('Src', 'ranlibmodule.c'),
os.path.join('Src', 'ranlib.c'),
os.path.join('Src', 'com.c'),
os.path.join('Src', 'linpack.c')],
extra_compile_args = extra_compile_args),
Extension('lapack_lite', sourcelist,
library_dirs = library_dirs_list,
libraries = libraries_list,
extra_link_args = extra_link_args,
extra_compile_args = extra_compile_args)
]

# add FFT package (optional)
packages.append('FFT')
package_dir['FFT'] = os.path.join('Packages','FFT','Lib')
include_dirs.append(os.path.join('Packages','FFT','Include'))
ext_modules.append(Extension('FFT.fftpack',
[os.path.join('Packages','FFT','Src',
'fftpackmodule.c'),
os.path.join('Packages', 'FFT', 'Src',
'fftpack.c')],
extra_compile_args = extra_compile_args))

# add MA package (optional)
packages.append('MA')
package_dir['MA'] = os.path.join('Packages', 'MA', 'Lib')

# add RNG package (optional)
packages.append('RNG')
packages.append('RNG')
package_dir['RNG'] = os.path.join('Packages', 'RNG', 'Lib')
include_dirs.append(os.path.join('Packages', 'RNG', 'Include'))
ext_modules.append(Extension('RNG.RNG',
[os.path.join('Packages', 'RNG', 'Src',
'RNGmodule.c'),
os.path.join('Packages', 'RNG', 'Src',
'ranf.c'),
os.path.join('Packages', 'RNG', 'Src',
'pmath_rng.c')],
extra_compile_args = extra_compile_args))
# add dotblas package (optional)
if use_dotblas:
packages.append('dotblas')
package_dir['dotblas'] = os.path.join('Packages', 'dotblas',
'dotblas')
ext_modules.append(Extension('_dotblas',
[os.path.join('Packages', 'dotblas',
'dotblas', '_dotblas.c')],
library_dirs = library_dirs_list,
libraries = libraries_list,

extra_compile_args=extra_compile_args))




long_description = """
Numerical Extension to Python with subpackages.

The authors and maintainers of the subpackages are:

FFTPACK-3.1
maintainer = "Numerical Python Developers"
maintainer_email = "[EMAIL PROTECTED]"
description = "Fast Fourier Transforms"
url = "http://numpy.sourceforge.net";

MA-%s
author = "Paul F. Dubois"
description = "Masked Array facility"
maintainer = "Paul F. Dubois"
maintainer_email = "[EMAIL PROTECTED]"
url = "http://sourceforge.net/projects/numpy";

RNG-3.1
author = "Lee Busby, Paul F. Dubois, Fred Fri

Re: Installing Numeric with ATLAS and LAPACK

2005-01-28 Thread drife
Hi John,

When I built Numeric with ATLAS and LAPACK, the eigenvalue
calculation took the same amount of time.

Per your suggestion, I will capture the output of the build and post
it to the Numpy discussion group.


Thanks,


Daran

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


Re: example needed: sip + Qt

2005-01-28 Thread Uwe Mayer
Friday 28 January 2005 23:18 pm Uwe Mayer wrote:
> Traceback (most recent call last):
>   File "", line 1, in ?
> ImportError: ./hello.so: undefined symbol: _ZTV5Hello
> 
> $ c++filt _ZTV5Hello
> vtable for Hello
> 
> The compilation did not give any warnings or error messages. Any ideas?

$ ldd -d hello.so
libqt-mt.so.3 => /usr/lib/libqt-mt.so.3 (0x40057000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4190c000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4154e000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x41173000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40743000)
libm.so.6 => /lib/tls/libm.so.6 (0x4114f000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x407fd000)
libc.so.6 => /lib/tls/libc.so.6 (0x41019000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x418d8000)
libaudio.so.2 => /usr/lib/libaudio.so.2 (0x40807000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x4191c000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x4081c000)
libz.so.1 => /usr/lib/libz.so.1 (0x41856000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x41749000)
libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x40842000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x41734000)
libXft.so.2 => /usr/lib/libXft.so.2 (0x416e1000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x42487000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x42583000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4256a000)
libdl.so.2 => /lib/tls/libdl.so.2 (0x41184000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x8000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0x40847000)
undefined symbol: _ZTV5Hello(./hello.so)
undefined symbol: _ZNK5Hello9classNameEv(./hello.so)
undefined symbol: _ZN5Hello7qt_castEPKc (./hello.so)
undefined symbol: _ZN5Hello9qt_invokeEiP8QUObject   (./hello.so)
undefined symbol: _ZN5Hello7qt_emitEiP8QUObject (./hello.so)
undefined symbol: _ZN5Hello11qt_propertyEiiP8QVariant   (./hello.so)
undefined symbol: _ZTI5Hello(./hello.so)
undefined symbol: _Py_NoneStruct(./hello.so)
undefined symbol: PyCObject_Type(./hello.so)

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


Re: Talking to the wind

2005-01-28 Thread David H Wild
In article <[EMAIL PROTECTED]>,
   Terry Reedy <[EMAIL PROTECTED]> wrote:
> > Xah Lee,
> >
> > Do you want to be taken seriously?
> > First, stop posting.
> > Second, learn perl.
> > Third, learn python.

> Hey all, I have seen no evidence that XL even reads the responses that
> have been directed thereto.  The above is like

> /dev/null,
> Why don't you ever answer the messages I keep sending to you?

He's been in my killfile for quite some time. If **everyone** ignored him,
this newsgroup would be a better place. :-))

-- 
 __  __  __  __  __ ___   _
|__||__)/ __/  \|\ ||_   |   / Acorn StrongArm Risc_PC
|  ||  \\__/\__/| \||__  |  /...Internet access for all Acorn RISC machines
___/ [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: example needed: sip + Qt

2005-01-28 Thread Uwe Mayer
On Friday 28 January 2005 14:24 pm, Craig Ringer wrote:
> Out of curiosity, would this be for an extension module used in an
> embedded Python interpreter, or for plain extension module for use with
> a standalone interpreter?

I am writing an application program using Python and PyQt:
https://savannah.nongnu.org/projects/lmc/

At one point I am using a QListView but need my items to be sorted 
numerically. There is no function to set the sort-criterea and the solution 
to this is subclassing QListViewItem and overwrite the comparison functions. 
However, doing so in Python was awfully slow for a greater number of items, 
so I want to rewrite this in C++ and wrap it back to python.

Ciao
Uwe
-- 
Kilroe hic erat!


pgp3PoEGtLKbc.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

An mysql-python tutorial?

2005-01-28 Thread Dfenestr8
Hi.

Been told by the admin of my (free!) server that he'd rather I should
learn to use mysql if I want to continue writing cgi scripts there.

Not even sure exactly what mysql is.

Is there a simple tutorial anywhere on the web about using python + mysql?  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: example needed: sip + Qt

2005-01-28 Thread Uwe Mayer
On Friday 28 January 2005 14:47 pm, Phil Thompson wrote:
> > The QLabel example in the SIP reference manual yields syntax errors for
> > me.
>
> What syntax errors? If there is a documentation bug then I'll fix it.

I'll come to that a little later, that happened in the simple c++ word 
example. 

I am currently fiddling around with the QLabel example. I copied the example 
and tried it out. First problem was that the generated makefile does not 
attempt to compile the original hello.cpp sources. 

So I wrote a configure script and a Makefile.am for that. 
It was not clear to me what type of archive or object was needed, so I first 
tried creating a normal object file, then libtool archives and then normal 
archives. It turned out I needed a normal archive an the library search path 
has to be extended to include the current directory (-L.), i.e. where the 
libhello.a lies.
My only way of doing so was edditing the Makefile generated by configure.py. 
Is there a way of telling that  to configure.py?

So now the hello.cpp example compiles. I fire up python:
>>> import hello
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: ./hello.so: undefined symbol: _ZTV5Hello

$ c++filt _ZTV5Hello
vtable for Hello

The compilation did not give any warnings or error messages. Any ideas?

Thanks
Uwe
-- 
It would seem that evil retreats when forcibly confronted.
  -- Yarnek of Excalbia, "The Savage Curtain", stardate 5906.5


pgprunF10Sowx.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-28 Thread Alan Kennedy
[Alan Kennedy]
>>However, I'm torn on whether to use ReST for textual content. On the one
>>hand, it's looks pretty comprehensive and solidly implemented. But OTOH,
>>I'm concerned about complexity: I don't want to commit to ReST if it's
>>going to become a lot of hard work or highly-inefficient when I really
>>need to use it "in anger".
>>
>>From what I've seen, pretty much every textual markup targetted for web
>>content, e.g. wiki markup, seems to have grown/evolved organically,
>>meaning that it is either underpowered or overpowered, full of special
>>cases, doesn't have a meaningful object model, etc.
[Aahz]
> My perception is that reST is a lot like Python itself: it's easy to hit
> the ground running, particularly if you restrict yourself to a specific
> subset of featuers.  It does give you a fair amount of power, and some
> things are difficult or impossible.
>
> Note that reST was/is *not* specifically aimed at web content.  Several
> people have used it for writing books; some people are using it instead
> of PowerPoint.
Thanks, Aahz, that's a key point that I'll continue on below.
[Alan Kennedy]
>>So, I'm hoping that the learned folks here might be able to give me some
>>pointers to a markup language that has the following characteristics
>>
>>1. Is straightforward for non-technical users to use, i.e. can be
>>(mostly) explained in a two to three page document which is
>>comprehensible to anyone who has ever used a simple word-processor or
>>text-editor.
>>
>>2. Allows a wide variety of content semantics to be represented, e.g.
>>headings, footnotes, sub/superscript, links, etc, etc.
[Aahz]
> These two criteria seem to be in opposition.  I certainly wouldn't
> expect a three-page document to explain all these features, not for
> non-technical users.  reST fits both these criteria, but only for a
> selected subset of featuers.
The point is well made.
When I wrote my requirements, I did have a specific limited feature set 
in mind: basically a print-oriented set of features with which anyone 
who reads books would be familiar. I'm trying to capture scientific 
abstracts, of the sort that you can see linked off this page.

http://www.paratuberculosis.org/proc7/
But I'm basically only interested in representation of the original 
input text. I'll be capturing a lot of metadata as well, but most of 
that will be captured outside the markup language, through a series of 
form inputs which ask specific metadata questions. So, for example, the 
relationships between authors and institutions, seen on the next page, 
will not be recorded in the markup.

http://www.paratuberculosis.org/proc7/abst5_p2.htm
I think that is where a lot of markup languages fall down, in that they 
end trying to develop a sophisticated metadata model that can capture 
that kind of information, and re-engineering the markup to support it. 
This co-evolution of the markup and model can go horribly awry, if the 
designers are inexperienced or don't know where they're headed.

Since ReST seems to do this stuff fairly well, I think I'll take a 
closer look at it. From what I've seen of it, e.g. PEPs, python module 
documentation (SQLObject, etc), it seems to be reasonably unobtrusive to 
the author.

regards,
--
alan kennedy
--
email alan:  http://xhaus.com/contact/alan
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to test that an exception is raised ?

2005-01-28 Thread Dan Perl

"StepH" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> So why the assertRaises function in unittest ?  My goal is to test if an 
> exception is well raised when a bad filename is passed to the mps2xml 
> function.

It is for functions in which the exception is raised and not caught.  You 
can use the exception mechanism to let the code invoking your function know 
that something "exceptional" has happened.  It means that you "throw" that 
exception to the invoking code which has to catch it.  Maybe the terminology 
is poorly chosen, but assertRaises does not check whether an exception is 
raised inside the function but only that an exception is raised (or 
"thrown", as described by other languages) from inside the function to 
outside.  A function does not "throw" an exception if the exception is 
caught inside the function.  Is that clearer now?

In java for instance, functions are actually declared to "throw" an 
exception if any operation inside the function may throw that exception and 
the exception is not caught inside the function.  If you implement a 
function A that invokes another function B and B throws an exception of type 
C, then you must catch the exception C in A or you have to declare A that it 
"throws C".

Hope this helps.

Dan 


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


Problems with PyQt

2005-01-28 Thread Michael McGarry
Hi,

I am having a problem making a widget appear. I have 5 widgets which
are windows with no parents. 3 of the widgets appear without a problem
the other 2 widgets will not appear when I invoke widget.show() from
within a handler for another widget. I am completely clueless as to why
these 2 widgets will not draw. One of them is simply a wait window I
want to appear while I am performing a time consuming task.

Here is a snippet of code:

def viewSimButton_pressed(self):
wait_win.waitProgressBar.setPercentageVisible(1)
wait_win.waitProgressBar.setTotalSteps(5)
wait_win.waitProgressBar.setProgress(0)
wait_win.show()
self.hide()
self.viewSimButton.setDown(0)
for loopIdx in range(self.simListBox.count()):
if self.simListBox.isSelected(loopIdx) == 1:
simIdx = loopIdx
simID = self.simListBox.item(simIdx).text().ascii()
# Clear list box
sim_view_win.simOutputListBox.clear()
if os.path.exists(simID) == 1:
os.chdir(simID)
wait_win.waitProgressBar.setProgress(1)
# Check process ID file
if os.path.exists('pid') == 1:
time.sleep(1) # wait 1 second, then check again
pidFile = open('pid','r')
pidStr = pidFile.readline()
if pidStr == 'done\n':
sim_view_win.simStatusLbl.setText('Completed')
else:
sim_view_win.simStatusLbl.setText('Running')
simData = sims[simID]
sim_view_win.simIDEdit.setText(simID)
sim_view_win.hostEdit.setText(simData['host'])
wait_win.waitProgressBar.setProgress(3)
# Fill list box with output files
#
filedir = os.popen('ls','r')
filename = filedir.readline()
while filename:
filename = string.rstrip(filename)
if ((filename != 'pid') and (filename != 'sim_cfg') and (filename !=
'sim_log')
and (filename != 'sim_core')
and (string.find(filename,'.fig') == -1)
and (string.find(filename,'.gp') == -1)):
sim_view_win.simOutputListBox.insertItem(filename)
filename = filedir.readline()
os.chdir('..')
wait_win.waitProgressBar.setProgress(5)
wait_win.hide()
sim_view_win.show()

wait_win will show on the screen but not with it's progress bar. Can
anyone help?

Thanks,

Michael

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


Re: debugging os.spawn*() calls

2005-01-28 Thread Skip Montanaro

Nick> If using 2.4 the subprocess module is a good solution too.  It
Nick> lets you catch stdout/stderr easily.

Yeah, thought of that already.  Currently not an option though.

Thx,

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


Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread David M. Cooke
"drife" <[EMAIL PROTECTED]> writes:

> Hello,
>
> I need to calculate the eigenvectors and eigenvalues for a 3600 X 3600
> covariance matrix.
>
> The LinearAlgebra package in Python is incredibly slow to perform the
> above calculations (about 1.5 hours). This in spite of the fact that
> I have installed Numeric with the full ATLAS and LAPACK libraries.
>
> Also note that my computer has dual Pentium IV (3.1 GHz) processors
> with 2Gb ram.
>
> Every Web discussion I have seen about such issues indicates that
> one can expect huge speed ups if one compiles and installs Numeric
> linked against the ATLAS and LAPACK libraries.

Are you *sure* that Numeric is linked against these?

> Even more perplexing is that the same calculation takes a mere 7 min
> in Matlab V6.5. Matlab uses both ATLAS and LAPACK.
>
> Moreover, the above calculation takes the same amount of time for
> Numeric to complete with --and-- without ATLAS and PACK. I am certain
> that I have done the install correctly.

This is good evidence that Numeric *isn't* linked to them.

If you're on a Linux system, you can check with ldd:
[EMAIL PROTECTED] ldd /usr/lib/python2.3/site-packages/Numeric/lapack_lite.so 
liblapack.so.3 => /usr/lib/atlas/liblapack.so.3 (0x002a95677000)
libblas.so.3 => /usr/lib/atlas/libblas.so.3 (0x002a95e55000)
libg2c.so.0 => /usr/lib/libg2c.so.0 (0x002a96721000)
libpthread.so.0 => /lib/libpthread.so.0 (0x002a96842000)
libc.so.6 => /lib/libc.so.6 (0x002a96957000)
libm.so.6 => /lib/libm.so.6 (0x002a96b96000)
/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 
(0x00552000)

You can see that lapack and blas (the Atlas versions) are linked to
the lapack_lite.so.

To install Numeric using Lapack:
- remove the build/ directory in your Numeric sources, so you don't
  any old binaries
- edit setup.py and follow the comments on using Lapack (you need to
  comment out a few lines, and set some directories)
  Also set use_dotblas to 1.
- do the 'python setup.py build', 'python setup.py install' dance.

-- 
|>|\/|<
/--\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Who should security issues be reported to?

2005-01-28 Thread Aahz
In article <[EMAIL PROTECTED]>,
Tim Peters  <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED]
>>
>> Who are the appropriate people to report security problems to
>> in respect of a module included with the Python distribution?
>> I don't feel it appropriate to be reporting it on general mailing
>> lists.
>
>The Python project has no non-public resources for this.  Filing a bug
>report on SourceForge is the usual approach.  If you must, you could
>send email directly to Guido .  He may or may
>not have time to follow up on it; public disclosure is the norm in
>this project.  Be forewarned that despite that he currently works for
>a security startup, his threshold for "security panic" is very high.

You mean s/despite/because/ don't you?  ;-)
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"19. A language that doesn't affect the way you think about programming,
is not worth knowing."  --Alan Perlis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py.dll for version 2.2.1 (Windows)

2005-01-28 Thread John Machin

mike wrote:
> Just recently, my virus checker detected what it called a Trojan
Horse
> in the py.dll file in the python22 folder.

Sorry to come on like the Inquisition, but this _might_ be something of
significance to the whole Windows Python community:

When was "just recently"? Which virus checker are you using? Did it say
which Trojan it had detected? Have you kept a copy of the "py.dll"
file? Have you kept a copy of the virus checker's report? Was that the
first time you have run that virus checker? If not when was the
previous run?

>  Installation is version
> 2.2.1 and I think that it came installed when I bought the PC in
> October 2002.
>
> Does anyone know where I can get a copy of the py.dll file from
version
> 2.2.1 for Windows (XP) ?
>
> I looked at www.python.org and do not see a py.dll file in the
> self-installation or .tgz versions of 2.2.1 that are posted.

That would be because there is no file named "py.dll" in a Windows
distribution of Python! You should have Python22.dll -- they all have
the major/minor version numbers in the name -- and its size should be
about 820Kb.

You may like to keep the evidence (if you still have it) -- move the
presumably bad file into a folder of its own and rename it to have some
extension other than dll -- because targetting a Python installation
would appear to be novel and someone may very well be interested in
inspecting your file.

If you have some good reason to stay with 2.2, then get the _latest_
version of that (2.2.3). Otherwise, install 2.4.

Regards,
John

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


Re: Where can I find sample "beginner" programs to study?

2005-01-28 Thread JanC
Todd_Calhoun schreef:

> I'm trying to learn Python (and programming), and I'm wondering if
> there are any places where I can find small, simple programs to study.

Try:



-- 
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] 20050127 traverse a dir

2005-01-28 Thread Abigail
Skip Montanaro ([EMAIL PROTECTED]) wrote on CLXVIII September MCMXCIII
in news:[EMAIL PROTECTED]>:
__  
__  abigail> @@  No. Second, learn Python. Third, learn Perl (optional). :)
__  
__  abigail> Just leave the third option out. Let him learn Python. We don't
__  abigail> want him. ;-)
__  
__  We don't want him either.  Perhaps we can persuade him to learn INTERCAL...


Please don't send stealth CCs. 


Abigail
-- 
perl -wle\$_=\<\http://mail.python.org/mailman/listinfo/python-list


Re: Installing Numeric with ATLAS and LAPACK

2005-01-28 Thread Fernando Perez
drife wrote:

> Thanks John. Those are the steps I followed, and to no avail.
> 
> Interestingly, I downloaded and installed SciPy, and ran the
> same eigenvector problem. SciPy greatly speeds up the
> calculation...was 1.5 hours using Numeric, now only 15 min
> with SciPy.
> 
> Unfortunately, SciPy only solves ordinary and generalized
> eigenvalue problems of a square matrix. They do not test
> to see if the matrix is symmetric, then call the appropriate
> routine from LAPACK.

Note that scipy exposes most of lapack, so you could make the call you need
directly:

In [3]: scipy.linalg.lapack.get_lapack_funcs?
Type:   function
Base Class: 
String Form:
Namespace:  Interactive
File:   /usr/lib/python2.3/site-packages/scipy/linalg/lapack.py
Definition: scipy.linalg.lapack.get_lapack_funcs(names, arrays=(), debug=0,
force_clapack=1)
Docstring:
Return available LAPACK function objects with names.
arrays are used to determine the optimal prefix of
LAPACK routines.
If force_clapack is True then available Atlas routine
is returned for column major storaged arrays with
rowmajor argument set to False.

Cheers,

f

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


Re: handling xls with pyuno

2005-01-28 Thread Guido Goldstein

Hi!

On Fri, 28 Jan 2005 12:59:11 -0600
  John Hunter <[EMAIL PROTECTED]> wrote:
> Does anyone have any example scripts using the OpenOffince
> python-bridge module pyuno to load xls, extract the data, and/or save
> to another format such as xsc or csv.

There is something called BlueDCS which can do that.
See here:
  http://cvs.bluedynamics.org/viewcvs/BlueDCS/

HIH
  Guido
-- 
Guido Goldstein
PGP Key: http://www.a-nugget.de/public-key.txt
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to test that an exception is raised ?

2005-01-28 Thread StepH
Antoon Pardon a écrit :
Op 2005-01-28, StepH schreef <[EMAIL PROTECTED]>:
Thanks for you answer.
I'm new to Python (coming from C/C++).
Do you say that it's not possible to test (using unittest) if an exception
is well raised if the tested code catch it ?
How to solve this paradoxe ?  How to automaticaly test such code ?

IMO you want something unittest are not designed for.
So why the assertRaises function in unittest ?  My goal is to test if an 
exception is well raised when a bad filename is passed to the mps2xml 
function.

Unittest are supposed to test for particular results, not for particular
behaviour within. If the expected behaviour is that calling code doesn't
see an exception raised, then the test passed if no exception was seen.
No (unless i don't well understand you), the expected behavior is to 
launch an exception if a bad filename is passed.  If no exception is 
raised, this is not normal.

You equally can't test which branch of an if statement was taken or
which parameter was given to a helper function in order to get to
the desired result.
I'm agree with out on this point, but not for the exception part...
That you internally raise an exception and catches it, is an
implementation detail, that normally is of no concern to
the tester.
I'll conclude this thred here...  In fact, I think I've to go-back to 
theory (at least about exception)...

Thanks at all fo trying to help me.  I'm new to Python, and i've not 
already embrass the "python way" completly.

See you later.
StepH.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Accessing Postgress from Windows

2005-01-28 Thread Robby Russell
On Fri, 2005-01-28 at 14:51 -0600, Greg Lindstrom wrote:
> Hello, All-
> 
> I am running Python 2.3 on a Windows XP box and would like to access a 
> postgres database running on a Linux fileserver.  I've googled for 
> Python and Postgres but most of the stuff I saw looked stale.  I would 
> like to use a secure connection (ssl) and a direct connection, if 
> possible.  What can you recommend for the task?
> 
> Thanks...and see you all at PyCon!
> --greg
> 

You could try this mxODBC from Windows.

http://www.egenix.com/files/python/mxODBC.html

Cheers,

Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now hosting PostgreSQL 8.0! ---
/

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


Pystone benchmark: Win vs. Linux (again)

2005-01-28 Thread Franco Fiorese
Hi all,
I am relatively new about Python benchmarks.
After some experiments I found that Python on my PC Windows XP has a 
relevant higher performance than on Linux. The simple test using 
pystone.py shows this:

 * Windows XP Pro:  16566.7 pystones/second
 * Linux (kernel 2.6.9 NPTL): 12346.2 pystones/second
I have repeated the test, on Linux, also with other distributions and 
kernel but a relevant difference still exists with Windows offering a 
better performance.

Is there any way, that you know, to get better performance under Linux?
regards
Franco
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] 20050127 traverse a dir

2005-01-28 Thread Skip Montanaro

abigail> @@  No. Second, learn Python. Third, learn Perl (optional). :)

abigail> Just leave the third option out. Let him learn Python. We don't
abigail> want him. ;-)

We don't want him either.  Perhaps we can persuade him to learn INTERCAL...

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


Accessing Postgress from Windows

2005-01-28 Thread Greg Lindstrom
Hello, All-
I am running Python 2.3 on a Windows XP box and would like to access a 
postgres database running on a Linux fileserver.  I've googled for 
Python and Postgres but most of the stuff I saw looked stale.  I would 
like to use a secure connection (ssl) and a direct connection, if 
possible.  What can you recommend for the task?

Thanks...and see you all at PyCon!
--greg
--
Greg Lindstrom   501 975.4859
Computer Programmer  [EMAIL PROTECTED]
NovaSys Health
Little Rock, Arkansas
"We are the music makers, and we are the dreamers of dreams."  W.W.
Confidentiality Notice
--
This email and any attachments to it are privileged and confidential and are 
intended solely for use of the individual or entity to which they are 
addressed. If the reader of this message is not the intended recipient, any 
use, distribution, or copying of this communication, or disclosure of all or 
any part of its content to any other person, is strictly prohibited. If you 
have received this communication in error, please notify the sender by replying 
to this message and destroy this message and delete any copies held in your 
electronic files. Thank you.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Where can I find sample "beginner" programs to study?

2005-01-28 Thread moma
Todd_Calhoun wrote:
I'm trying to learn Python (and programming), and I'm wondering if there are 
any places where I can find small, simple programs to study.

Thanks. 

Hello,
http://www.python.org  (docs -> tutorial)
http://www.python.org/doc/ !
http://www.diveintopython.org
http://www.byteofpython.info
Eggs are here. Bring some bacon.
http://www.python-eggs.org/links.html

Cross platform GUI-programs:
http://www.wxPython.org
Widgets documentation: http://www.wxPython.org

IDEs (programmers Python editors, if you want one):
Eric
http://www.die-offenbachs.de/detlev/eric3.html
Dr.Python
http://drpython.sourceforge.net/
?
// moma
   http://www.futuredesktop.org/OpenOffice.html
   http://www.futuredesktop.org/hpc_linux.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Where can I find sample "beginner" programs to study?

2005-01-28 Thread wes weston
Todd_Calhoun wrote:
I'm trying to learn Python (and programming), and I'm wondering if there are 
any places where I can find small, simple programs to study.

Thanks. 


Todd,
   Have you been here:
http://www.python.org/doc/
and tried the tutorial or beginners guide?
The tutorial has all the pieces you use most
often.
wes
--
http://mail.python.org/mailman/listinfo/python-list


Yet another Python commercial application

2005-01-28 Thread Philippe C. Martin
SnakeCard release SCF 1.0: a smart card simulation and Q&A platform
based on Python.


(I said I would :-) sorry but I'm walking on air

Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


RE: Best python postgres module?

2005-01-28 Thread Robert Brewer
Roland Heiber wrote:
> i recently migrated from mysql to postgresql and did use 
> severel python 
> postgres-modules. All do what they are designed for, so 
> which one would 
> you use? psycopg, pygresql, pypgsql? psycopg seems to be the best 
> solution for heavy traffic/multiple connections  i have no real 
> testing environment, so any advice which one to use for different 
> usecases would be nice.

If your "use cases" involve cross-platform development (i.e. Linux and
Windows), pypgsql seems to fit the bill nicely.


Robert Brewer
MIS
Amor Ministries
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Mac OS and MySQLdb

2005-01-28 Thread Skip Montanaro

Thomas> is there a MySQLdb-Version for the latest Mac OS (or can I use
Thomas> the Linux-tarball)?

I just built the latest version from source (1.1.7 or something).

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


Where can I find sample "beginner" programs to study?

2005-01-28 Thread Todd_Calhoun
I'm trying to learn Python (and programming), and I'm wondering if there are 
any places where I can find small, simple programs to study.

Thanks. 


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


Re: Proccess termination

2005-01-28 Thread George Yoshida
alexrait1 wrote:
I use popen.popen2 or popen.popen3 to start a new process and read from
it's stdout/ write to it's stdin.
But I need a way to know when a process terminates.

Do you know about a library that provides these tools other then the
standard os module... or should I use it otherwise?
popen2.Popen3, popen2.Popen4 and subprosess.Popen have poll/wait methods.
These will do what you're looking for.
--
George
--
http://mail.python.org/mailman/listinfo/python-list


Re: Best python postgres module?

2005-01-28 Thread Dave Brueck
Roland Heiber wrote:
i recently migrated from mysql to postgresql and did use severel python 
postgres-modules. All do what they are designed for, so which one would 
you use? psycopg, pygresql, pypgsql? psycopg seems to be the best 
solution for heavy traffic/multiple connections  i have no real 
testing environment, so any advice which one to use for different 
usecases would be nice.
Hi Roland,
We've been using psycopg (via Zope and straight Python programs) for about a 
year and haven't had any problems at all. We don't store much binary data so I 
don't know how well psycopg handles blobs and what-not, but performance and 
reliability has been fine.

I have no idea how psycopg stacks up against the others; in the end we chose it 
because the project appeared to be active, it was easy enough to set up, and a 
few test scripts we made all worked (how's that for rigorous evaluation? ;-) ).

HTH,
Dave
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to post news articles with NNTPlib

2005-01-28 Thread python

Do Re Mi chel La Si Do wrote:
> Hi !
>
>
> nntplib.NNTP(newsserver,port,user,passe)
> 
> 
> 
> -- 
> Michel Claveau

Thank you

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


Re: some kind of LFU dict...

2005-01-28 Thread Skip Montanaro

Joh> so i wondered if i can not use some kind of cache, i googled and
Joh> found information on LRU, LFU, and LFU interested me : keep only
Joh> most frequently used items inside dict (and memory) and writing
Joh> others on disk for a possible future reuse.

I have a Cache class that you might subclass to provide different behavior:

http://www.musi-cal.com/~skip/python/Cache.py

What it does now is throw out keys that match the desired criteria.  You
could subclass it to stuff those items in a DB file (probably using the
anydbm module) and read them from the DB file if an attempt to access a key
in the cache fails.

Skip

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


Re: Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
On Fri, 28 Jan 2005 14:41:16 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote:
> 
> "Kamilche" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >I see what you're attempting to do. However, your code, if it DID run,
> > would result in a method being added to the object, not the object's
> > class! Modify the class itself, not the object, as follows:
> >
> > |class Test:
> > |def __init__(self):
> > |self.method()
> > |
> > |def m(self):
> > |print self
> > |
> > |setattr(Test, 'method', m)
> 
> # this is a longwinded way to say
> Test.method = m

That is the blindingly simple method that I wanted. I didn't know
before that I wanted it, but I'm sure of it now. Thank you very much,
terry.

> 
> setattr is for when you do *not* know the attribute name at coding time but
> will have it in a string at run time, as in
> 
> methodname = 'method'
> ..# some time later
> setattr(Test, methodname, m)
> 
> Sometime Python makes things easier than people are initially willing to
> believe ;-)

I felt like there had to be a simpler solution.

Peace
Bill Mill
bill.mill at gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Installing Numeric with ATLAS and LAPACK

2005-01-28 Thread John Hunter
> "drife" == drife  <[EMAIL PROTECTED]> writes:

drife> Thanks John. Those are the steps I followed, and to no
drife> avail.  

Make sure you get a clean build by rm -rf ing the build dir before you
build again.  Then capture the output of your build to a file.  When
you say "to no avail" what do you mean -- that the calculation was
slower.  If you still have troubles, post again to the
numpy-discussion list listing what you did and the output of the build
process.

Good luck!
JDH
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Who should security issues be reported to?

2005-01-28 Thread Tim Peters
[EMAIL PROTECTED]
> Who are the appropriate people to report security problems to
> in respect of a module included with the Python distribution?
> I don't feel it appropriate to be reporting it on general mailing
> lists.

The Python project has no non-public resources for this.  Filing a bug
report on SourceForge is the usual approach.  If you must, you could
send email directly to Guido .  He may or may
not have time to follow up on it; public disclosure is the norm in
this project.  Be forewarned that despite that he currently works for
a security startup, his threshold for "security panic" is very high.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py.dll for version 2.2.1 (Windows)

2005-01-28 Thread Terry Reedy

"mike" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Just recently, my virus checker detected what it called a Trojan Horse
> in the py.dll file in the python22 folder.  Installation is version
> 2.2.1 and I think that it came installed when I bought the PC in
> October 2002.

My HP came with 2.2 also, but nothing caught by McAfee

> Does anyone know where I can get a copy of the py.dll file from version
> 2.2.1 for Windows (XP) ?
>
> I looked at www.python.org and do not see a py.dll file in the
> self-installation or .tgz versions of 2.2.1 that are posted.

If the installer is not a selectively extractable archive, delete and 
reinstall fresh might be easiest.

Terry J. Reedy



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


Re: Dynamic class methods misunderstanding

2005-01-28 Thread Terry Reedy

"Kamilche" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I see what you're attempting to do. However, your code, if it DID run,
> would result in a method being added to the object, not the object's
> class! Modify the class itself, not the object, as follows:
>
> |class Test:
> |def __init__(self):
> |self.method()
> |
> |def m(self):
> |print self
> |
> |setattr(Test, 'method', m)

# this is a longwinded way to say
Test.method = m

setattr is for when you do *not* know the attribute name at coding time but 
will have it in a string at run time, as in

methodname = 'method'
..# some time later
setattr(Test, methodname, m)

Sometime Python makes things easier than people are initially willing to 
believe ;-)

> |Test()

Terry J. Reedy



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


Re: Installing Numeric with ATLAS and LAPACK

2005-01-28 Thread drife
Thanks John. Those are the steps I followed, and to no avail.

Interestingly, I downloaded and installed SciPy, and ran the
same eigenvector problem. SciPy greatly speeds up the
calculation...was 1.5 hours using Numeric, now only 15 min
with SciPy.

Unfortunately, SciPy only solves ordinary and generalized
eigenvalue problems of a square matrix. They do not test
to see if the matrix is symmetric, then call the appropriate
routine from LAPACK. 


Daran

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


Re: Who should security issues be reported to?

2005-01-28 Thread Aahz
In article <[EMAIL PROTECTED]>,
 <[EMAIL PROTECTED]> wrote:
>Aahz wrote:
>> In article <[EMAIL PROTECTED]>,
>>  <[EMAIL PROTECTED]> wrote:
>>>
>>>Who are the appropriate people to report security problems to in
>>>respect of a module included with the Python distribution?  I don't
>>>feel it appropriate to be reporting it on general mailing lists.
>>
>> There is no generally appropriate non-public mechanism for reporting
>> security issues.  If you really think this needs to be handled
>> privately, do some research to find out which core developer is most
>> likely to be familiar with it.  Even before you do that, check
>> SourceForge to find out whether anyone else has reported it as a bug.
>
>I find this response a bit dissappointing frankly. Open Source people
>make such a big deal about having lots of people being able to look at
>source code and from that discover security problems, thus making it
>somehow making it better than proprietary source code.

That's generally true, but not universally.  The key point you seem to
have missed in my response is "non-public mechanism".  Historically,
Python security issues have been thrashed out in public; the Python
project does not have a release cycle that makes it possible to quickly
address security concerns, so keeping it private has little point.

Your decision to take the private route makes it your responsibility to
search for an appropriate mechanism.

>I'm sorry, but this isn't really good enough. If Open Source wants to
>say that they are better than these proprietary companies, they need
>to deal with these sorts of things more professionally and establish
>decent channels of communications for dealing with it.

As other people said, sounds like you want to volunteer for this.  Which
would be fine -- but there's still not much point until/unless we get
enough volunteers to manage quicker release cycles.  Then there's still
the problem of getting people to update their local copies of Python.
This is a complex issue.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"19. A language that doesn't affect the way you think about programming,
is not worth knowing."  --Alan Perlis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: threading and internet explorer com

2005-01-28 Thread James
thak you Roger :)
thank you so much :)
best regards,
James
Roger Upole wrote:
You'll need to call pythoncom.CoInitialize() in each thread.
  Roger
"James" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

hi,
i'm using python 2.4 with pywin32...
I've tried to use internet explorer control with a class.
it was fine until i decided to inherit thread for the class...
class domain01(threading.Thread):
def __init__(self):
#blabla
threading.Thread.__init__(self)
def run(self):
self.ie = win32com.client.Dispatch('InternetExplorer.Application.1') #this 
line gives error if i use .start(), but if i use .run.. no error...
self.ie.Visibble = 1
print "running"


xyz = domain()
xyz.start()
===
this is what i get:
Exception in thread Thread-23:
Traceback (most recent call last):
 File "C:\Python24\lib\threading.py", line 442, in __bootstrap
   self.run()
 File "C:\python2exe\domain01.py", line 41, in run
   self.dologin()
 File "C:\python2exe\domain01.py", line 56, in dologin
   self.ie=win32com.client.Dispatch('InternetExplorer.Application.1')
 File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 
95, in Dispatch
   dispatch, userName = 
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
 File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 
91, in _GetGoodDispatchAndUserName
   return (_GetGoodDispatch(IDispatch, clsctx), userName)
 File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 
79, in _GetGoodDispatch
   IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, 
pythoncom.IID_IDispatch)
com_error: (-2147221008, 'CoInitialize has not been called.', None, None)


=
but if i run:
xyz = domain()
xyz.run()
##no error! it's weird
anyone know how to solve this problem?
thank you :)
best regards,
James 


== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet 
News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 
Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
--
http://mail.python.org/mailman/listinfo/python-list


handling xls with pyuno

2005-01-28 Thread John Hunter

Does anyone have any example scripts using the OpenOffince
python-bridge module pyuno to load xls, extract the data, and/or save
to another format such as xsc or csv.

Thanks,
JDH
-- 
http://mail.python.org/mailman/listinfo/python-list


installing tkiner

2005-01-28 Thread Robert
I am trying to use tkinter on macos 10.2.6. 

I am not having any luck.  I have tried this.

python
python2.4 after downloading
downloaded TclTkAquaBI-8.4.6.1-Jaguar.dmg and installed
python2.4 could not find tkiniter

downloaded macpython 2.3.3 macphyton find tkinter but got an application 
exception.

I was under the impression that macpython included tkinter, so I 
manually deleted TclTkAquaBI the best I could.

macpython could not find tkinter.  

In the packages section of macpython, I saw...
('no', '_tkinter-2.3-binary', 'Enables Tkinter GUI building with 
Python.')

Please advise.  

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


  1   2   3   >