ANN: PyDev 0.9.6 released

2005-07-21 Thread Fabio Zadrozny
Hi All,

PyDev - Python IDE (Python Development Enviroment for Eclipse) version 
0.9.6 has just been released.

This is to be considered a stable release for all features but the 
debugger, as there are still some integration issues for it to work with 
Eclipse 3.1, so, if you are using PyDev because of its debugger support, 
you should stick to version 3.0.x until those issues are fixed.

Check the homepage (http://pydev.sourceforge.net/) for more details.

The major release highlights is that it Eclipse 3.1 is now supported. 
Older versions of Eclipse are no longer supported.

Regards,

-- 
Fabio Zadrozny
--
Software Developer

ESSS - Engineering Simulation and Scientific Software
www.esss.com.br

PyDev - Python Development Enviroment for Eclipse
pydev.sf.net
pydev.blogspot.com


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

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


ANN: SPE 0.7.4.a Python IDE

2005-07-21 Thread s_t_a_n_i
Quick release for wxPython2.6, use at your own risk

Major bugfix release for wxPython 2.6+ and Mac Os X (This version
doesn't work for sure with wxPython versions lower than 2.5.4.1) Bug
reports which are related to wxPython 2.6- will be ignored.

SPE has a new website: http://www.stani.be/python/blog Update your
bookmarks!

-

:Contribute:

- packagers for Linux and Mac Os X
- patches
- doc writers and translators
- SVN development
- donations

-

:New Features:


- editor:   call-tips for classes
- preferences:  configurable shortcuts (see shortcuts/__init__.py)
- preferences:  word characters for autocompletion and calltips
- sidebar:  improved browser with filters
- sidebar:  realtime updating now works

---

:Bug fixes:

- major bugfix for wxpython 2.6+
- major bugfix for Mac OS X
- notebooksizer deprecations
- blender:  support only exposed if run inside blender
- editor:   autocompletion (case sensitive)
- editor:   correctly scrolling to lines
- editor:   encoding
- editor:   improved call tips for classes
- editor:   no sash, no crash
- editor:   save checks if file exists
- editor:   scrollbars (no invisible source anymore)
- editor:   source gets focus properly
- editor:   find dialog gets focus if already opened
- editor:   shortcut for dedent is now Shift+Tab
- preferences:  added word characters
- sdi:  Tool pane has no toolbar
- shell:pressing Tab no longer inserts a tab in the editor
- sidebar:  realtime updating
- tool: find now also executes on enter
- tool: find doesn't use notebooksizer anymore
- tool: find now also executes on enter (Yoyong Hernan)
- tool: browser add new folder starts from current folder
(Yoyong Hernan)

-

:Requirements:

- full python 2.3+
- wxpython 2.6+
- optional blender 2.35

--

:Donations:

- Howard Jones (75 euro, thanks!)
- J P Dowd (8 euro)
- Mickey Hadick (5.00)

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

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


Dr. Dobb's Python-URL! - weekly Python news and links (Jul 20)

2005-07-21 Thread Simon Brunning
QOTW: Discussing goto statements and Microsoft together is like mixing
dynamite and gasoline. - DH

'Spaghetti doesn't quite describe it. I've settled on Lovecraftian:
reading the code, you can't help but get the impression of writhing
tentacles and impossible angles.' - Robert Kern


Highlight of the week; Jython 2.2a1:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/9c3b6b2e10d8a490

Nearly-highlight of the week; Simon Willison introduces Django, the
web framework for perfectionists with deadlines:
http://simon.incutio.com/archive/2005/07/17/django

But Jeff Shell remains more impressed with Subway:
http://griddlenoise.blogspot.com/2005/07/python-off-rails.html

CherryPy-2.1.0-beta released:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/18f2e97ab515891

With all this web framework activity, what are people using?

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/63bdf6b93e1704d3

Bob Ippolito wonders; what happened to YAML?
http://bob.pythonmac.org/archives/2005/07/19/what-happened-to-yaml/

MKoool (!) is looking for the simplest way of stripping non-printable
characters from text:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/23d6fdc3c9148725

Discovering WSGI and XSLT as middleware

http://www.decafbad.com/blog/2005/07/18/discovering_wsgi_and_xslt_as_middleware

Is there any worthwhile Python certification available? Is there any
worthwhile certification at all?

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/49dc79507ca4567d

Microsoft's very own Python scripts:

http://www.microsoft.com/technet/scriptcenter/scripts/python/pyindex.mspx

Another notable release; python-dateutil 1.0:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/7d0f044f1a3c8959



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance. 
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Cetus collects Python hyperlinks.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a collaborative effort to capture useful and
interesting recipes.

Re: About undisclosed recipient

2005-07-21 Thread Bartek Ryłko
Hi!
Thanks for Your info!! It was very usefull for me! :-)
Thanks once again!

On 7/9/05, Jeff Epler [EMAIL PROTECTED] wrote:
 You provided far too little information for us to be able to help.
 
 If you are using smtplib, it doesn't even look at message's headers to
 find the recipient list; you must use the rcpt() method to specify each
 one.  If you are using the sendmail method, the to_addrs list has no
 relationship to the headers of the actual message---it simply calls
 rcpt() once for each address in to_addrs.  The example in the docstring
 doesn't even *have* a To: header in the message!
 
 Jeff
 
 

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


Re: Dose someone have installed python on IRIX ?

2005-07-21 Thread hugonz
Hi,

No I have not done it before, but no one is able to help you if you do
not post what kind of errors you are getting. Basically if it compiled
and linked ok, maybe you specified something in the ./configure script
that the plattform does not support...

Hugo

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


How to limit the uploading file size in python?

2005-07-21 Thread praba kar
Dear All,

   In Php we can limit the uploading file size
by php.ini configuration file. But In python what
way we can limit the file uploading size.
kindly let me know.

regards
Prabahar



__
How much free photo storage do you get? Store your friends 'n family snaps for 
FREE with Yahoo! Photos http://in.photos.yahoo.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Peter Hansen
Jp Calderone wrote:
 In the particular case of wxWidgets, it turns out that the *GUI* blocks 
 for long periods of time, preventing the *network* from getting 
 attention.  But I agree with your position for other toolkits, such as 
 Gtk, Qt, or Tk.

Are you simply showing that there are two points of view here, that one 
can look at the wx main loop as being blocking, waiting for I/O, even 
though it is simply doing asynchronous event-driven processing the same 
as Twisted?  Or am I missing something?  Allowing for the fact that wx 
blocks, not just for long periods of time, but *indefinitely* (as long 
as no events are arriving) I still don't see how that makes it different 
from Twisted or from any other typical GUI framework, which do exactly 
the same thing.  (And since there is even a wxPython main loop 
integrated with and provided in Twisted, surely you aren't arguing that 
what wx does is somehow unusual or bad.)

Or are you simply saying that parts of wx are slow and take a while to 
complete operations?  If that's all, I haven't seen such behaviour... 
what areas are of concern?

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


Python Game Programming Challenge update

2005-07-21 Thread pyweek1
There's only one week to go before registration opens for the first Python 
Game Programming Challenge (also known as PyWeek). That means there's only 
(checks website) 37 days to go before the challenge starts! If you have a 
Python-based graphics, sound, music or game library that you'd like to use or 
promote in the challenge, then you've only got 7 days to make it public. 
Write some simple API docs and submit it to http://www.python.org/pypi. 
Couldn't be easier!

For those who came in late, the PyWeek challenge:
1. Invites all Python programmers to write a game in one week from
   scratch either as an individual or in a team,
2. Must be challenging and fun,
3. Entries must be developed during the competition, and must incorporate
   some theme decided at the start of the competition,
4. Will hopefully increase the public body of python game tools, code
   and expertise,
5. Will let a lot of people actually finish a game, and
6. May inspire new projects (with ready made teams!)


---
Visit the PyWeek website:
  http://www.mechanicalcat.net/tech/PyWeek/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: mod_python Apache/2.0.52 (Win32) Python 2.4

2005-07-21 Thread Dieter Raber
Thanks everybody,

I followed the link Waldemar had provided and there I found what I was looking 
for.

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


Re: Using SHFileOperation

2005-07-21 Thread avishay
Thanks.

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


Re: Ann: Tkinter drag and drop module

2005-07-21 Thread [EMAIL PROTECTED]
yup. that's exactly what i did, on win2k...

somehow, i was surprised that it would work - the filepath + file name
from the binary i'd dragged and dropped onto the .exe file was properly
passed to the frozen python script as an arg...

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


Re: How to limit the uploading file size in python?

2005-07-21 Thread Fuzzyman
Hello Prabahar,

It entirely depends on the mechanism you are using to receive the file
(there is no generic solution).

Is it within a CGI ? The normal way would be to check the file sized
and discard if it's too big. You'll have to do it within your code -
but it's probably a one line check !

Best Regards,

Fuzzy
http://www.voidspace.org.uk/python

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


Re: Generating images with text in them

2005-07-21 Thread Terry Hancock
On Wednesday 20 July 2005 11:59 pm, phil hunt wrote:
 I am trying to generate some images (gifs or pngs) with text in 
 them. I can use the Python Imaging Library, but it only has access 
 to the default, rather crappy, font.

On the fly, or just during development?

In any case, you should be aware of the Skencil vector graphic
program which is written in Python (with some C extensions),
and which is also, of course, a python vector-graphics library.

Unfortunately, getting it to work in a server environment might
not be too pretty (requires GTK, etc, even if you don't actually
use it).  I tried to make a stripped down version that didn't
require the desktop stuff, but it hasn't worked out so well yet.

 Alternately, is there a good source of PIL font files (.pil files)
 somewhere?

I believe there is a utility for converting other types of fonts, you
might have to go through a couple of different conversions from
the font files you have.

 If the writers of the Python Imaging Library are reading this, may I 
 suggest that they add more fonts to it. Yes, that would increase 
 the size, but these days disk space is cheap and programmer time
 expensive.

While bitmap font files are not copyrightable, there are license issues
with most of the nicer fonts you are probably talking about. That
complicates bundling them with the software. The PIL site does
actually have some additional fonts for download, though, IIRC.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

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


RE: Lots of pdf files

2005-07-21 Thread Tim Golden
[Greg Lindstrom]

| There does not appear to be a simple way to merge many pdf's 
| into one.

I'm currently using ghostscript (on Win32) to merge multiple 
postscript files into one PDF (by specifying multiple inputs
to the gswin32c command). I imagine it can do the same for
multiple PDF inputs on Linux.

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

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


Web-Forms

2005-07-21 Thread Mathias Waack
Hi, 

I need to access some information from a web site which are only accessible
through a form. Thus for each bucket of data you have to fill out the form,
submit it and wait for an answer. Very easy - if you don't have to check
some hundred times. Of course this site requires cookies, it is not
directly accessible by URL and so on. All that nice stuff used to make a
web site more professional;)

But now the question: how can this be solved by using Python?

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


Re: I just wanna know about os.path module..

2005-07-21 Thread Peter Otten
kimes wrote:

 You said 'At first os - module, or package, it doesn't matter here - is
 imported.'

With a file mop.py in your path

import mop

creates a module instance and executes mop.py to fill it with content --
classes, functions, whatever python objects you can think of -- and puts
that module instance into the sys.modules cache. With a file
mop/__init__.py, the process is the same except that the code to fill the
module is taken from the __init__.py file. Differences only appear when you
try to import submodules.

 I'm still confused about that..
 When I just call import os.path without calling import os..
 In that case, you mean 'import os' is called implicitly?

Yes. Try it yourself with a package/submodule where __init__.py and
submodule.py just contain a print statement. I find such an experimental
approach often more convenient than haunting the docs.

 Why? and How?

Because it's a sensible assumption that a submodule depends on its parent
package? Because it makes access of submodules as easy as attribute access
for any other object? Because it makes conditional imports easy (see
Terry's post)? Because it's the simplest approach that just works?

 how python knows it should call import when we call import os?
 Please make me clear.. :)

Conceptually, when you have a module alpha.beta.gamma you need just a bit of
string processing. alpha.beta.gamma.split() -- aah, I have to import
alpha, then alpha.beta, then alpha.beta.gamma... read the source for the
strategy that is actually taken if you really care.

Peter

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


Re: How to use octave in python

2005-07-21 Thread travlr
And or numarray :)

http://www.stsci.edu/resources/software_hardware/numarray

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


Couple quick questions from a Python Noob

2005-07-21 Thread digitalsubjunctive
Hey, I just started on Python and have a few questions I couldn't find
answers to on the Python site or it's tutorial.

1. I notice a few compiled python files (indicated by reddish snake
icons), I thought Python didn't need to be compiled? This is my first
venture into programming, but if it doesn't need to be compiled why
compile it?

2. What is a .pwy file?

3. I want to save my first few programs as .exe files so I can show
them off to all my leet friends. Okay, so the only program I've made
takes your birthday and tells you what you're astrological sign is, but
I'm in rural Nebraska and we don't have all that much to do :)

Thanks for any help you guys!

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


spurious syntax error when updating to 2.4 ?

2005-07-21 Thread Simon Dahlbacka
Hi,

I'm doing some preparation for a hopefully upcoming transition to
python 2.4 (from 2.3.4) on winxp platform

However, I'm getting SyntaxErrors in files that worked fine in 2.3, it
tells me that e.g.

newLanguage.language =
languageElement[0].firstChild.data.encode(ascii)

this line is broken

However, if I modify my file just for the heck of it and comment that
particular line, I still might get syntax error on that particular
line, or if I insert a line before that particular line I might get
away with it?

Has anyone seen anything similar, or even better knows what causes
this?

/Simon

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


Re: Copying attributes

2005-07-21 Thread red
Terry Hancock wrote:
 I'm not sure either, yet, but can you indicate which line in your
 listing is 102 in the source file?  That might be helpful.

101: ## f1.normal = copy.deepcopy(f.normal)
102:f1.normal = NMesh.Vert(f.normal[0], f.normal[1], f.normal[2])

I've tried with deepcopy, but the result is exactly same.

-- 
_red  _   __ _
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: returning list of strings from Python COM to Visual basic 6

2005-07-21 Thread Stefan Schukat
You have to wrap the python object with a COM object: 

def Get_Obj(self):
return win32com.server.util.wrap(an_object)


Stefan

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of
 Philippe C. Martin
 Sent: Thursday, July 21, 2005 1:42 AM
 To: python-list@python.org
 Subject: Re: returning list of strings from Python COM to 
 Visual basic 6
 
 
 I can now pass and return quite a few types except object 
 instances: my
 python code gets to the point where I do:
 
 
 def Get_Obj(self):
 .
 return an_object
 
 My VB code looks like
 
 Dim obj as Variant
 
 obj = acom.Get_Obj()
 
 
 I get an unexpected Python error . Objects of type 
 'instance' can not
 be converted to a COM VARIANT
 
 Is there a way out ?
 
 Thanks,
 
 Philippe
 
 
 
 
 
 
 Philippe C. Martin wrote:
 
  Hi,
  
  Is it possible ?
  
  ex: return ['1','2']
  
  If so which type should I use in VB ?
  
  dim res as ???
  
  Set testObj = CreateObject()
  
  res = testObj.AMethodThatReturnsAListOfStrings()
  
  
  Thanks,
  
  Philippe
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 

The Leading Manufacturing Test Company of the Year 2005
http://www.dspace.de/goto?f_s_award
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is this pythonic?

2005-07-21 Thread Thomas Lotze
Mage wrote:

 Or is there better way?
 
 for (i, url) in [(i,links[i]) for i in range(len(links))]:
   ...
 
 links is a list.

for i, url in enumerate(links):

-- 
Thomas

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


Re: Couple quick questions from a Python Noob

2005-07-21 Thread bruno modulix
[EMAIL PROTECTED] wrote:

 Hey, I just started on Python and have a few questions I couldn't find
 answers to on the Python site or it's tutorial.
 
 1. I notice a few compiled python files (indicated by reddish snake
 icons), I thought Python didn't need to be compiled? This is my first
 venture into programming, but if it doesn't need to be compiled why
 compile it?

Just like Java, the Python interpreter runs python byte-code. The Python
compiler compile Python source code into Python byte-code. Now the
difference with Java is that you don't have to manually call the
compiler - the interpreter will do it for you if and when needed.

If you don't know what 'byte-code' is, it's just like a machine language
(op-codes and the like) for a processor that doesn't exists - in fact
this 'processor' is the interpreter (or 'Virtual Machine') itself.

The main purpose is to have something that execute faster than purely
interpreted languages (since parsing is already done), and is still
portable between platforms (which is not that much important with
Python, since we usually distribute the source files...).

 2. What is a .pwy file?

(isn't that .pyw ?)
It's a Windows-only stuff that avoid the DOS shell window to be opened
when executing the script.

 3. I want to save my first few programs as .exe files so I can show
 them off to all my leet friends. 

'.exe' files are Windows-specific. Python doesn't handle this out of the
box. But there are programs like py2exe (and others, don't remember
their name) that 'freeze' your script, the interpreter and all needed
librairies in a .exe.

HTH
-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File Table List in Plone

2005-07-21 Thread bruno modulix
[EMAIL PROTECTED] wrote:
 All,
 
 Is there is a Plone type or product for generating a file list on a
 plone page, eg: a list of downloadable files in a table?  An example of
 what I want can be found at
 http://www.zope.org/Members/MacGregor/ExtFile under Available
 Releases where a list of files resides.
 
 Is this a manually generated table or is there a way I can drop a Plone
 type into a page to generate such a list?
 
I think you'll get better answers on a plone mailing-list.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE

2005-07-21 Thread linuxfreak
ok will give it a shot.
I had tried the 0.7.2 version with wxPython 2.6 and the moment i place
the cursor in a class name and pressed the space or the enter
key.booom there it went crashing without a trace. But i did like
what little i saw of it (apart from the crashes, of course) and the UML
diagram feature was just great. Lemme use this version and then i can
give some feedback. One more thingI'm trying to use the
wxStyledTextCtrl in one of my programsany pointers to where I can
find a good tutorialTried yellowbrain.com but it just has the docs
and not a tutorial. Thanks a ton and keep up the good work

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


Re: Lots of pdf files

2005-07-21 Thread Ralf Muschall
Greg Lindstrom wrote:
 Hello-
 I'm running Python 2.3 on a Linux system and have lots (about 2000)
 files in pdf format to print each day.  If I just wind up and fire all
 the files at the printer at once (as 2000 separate print jobs), the
 print server throws a fit and our system admin comes down and slaps me
 around for a few minutes (which, I guess, is fair).

Are your sure it is the number (and not the sum of the sizes) of
the jobs your admin is worrying about?

What about

#!/bin/sh
for i in *.pdf; do
  lpr $i
  sleep 10
done

(maybe adding something that waits until the queue is empty instead
of sleep)?

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


Re: Need to interrupt to check for mouse movement

2005-07-21 Thread stringy
Cheers for the replies people, but I got it sorted by just whacking in
wx.YieldIfNeeded() in the code before it communicates over the socket.
It's kind of jerky, but it works, where as before I'd click and drag,
and the 3d view wouldn't move for about 20 seconds.

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


newbie - mode for directory

2005-07-21 Thread wcc
Hello,

When using os.mkdir, what are the numeric numbers for different modes?
I could only find mode=0777 means read-only.  Thanks, - wcc

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


Re: newbie - mode for directory

2005-07-21 Thread Sybren Stuvel
wcc enlightened us with:
 When using os.mkdir, what are the numeric numbers for different
 modes?

man chmod

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


wxPythin installation woes

2005-07-21 Thread linuxfreak
Hi all,

Was working with python 2.3 in a fedora core 3 machine. I upgraded it
to Fedora Core 4 with a clean install. So now I have python 2.4
installed. But when I try to install wxPython for python 2.4 using an
rpm file i downloaded from the wxpython web site i get dependencies
errors. Turns out that  libstdc++.so.5 is needed but I checked and i
see that libstdc++.so.6 is installed on my system. Help needed guys and
needed pronto. Thanks a ton once again :)

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


Python Path Setting

2005-07-21 Thread Neil Benn
Hello,

  I'm trying to find some detailed documentation about 
PYTHONPATH, paths.pth, lib/site-packages, sitecustomise and so on.  I 
know what they do but I'd like some detailed documentation about what 
gets loaded where and when.  However I can't find the documentation on 
this. 

Googling for 'python PYTHONPATH' give me a bunch of stuff about 
setting the pythonpath for a specific app or about pythonpath itself but 
not the whole range of options as detailed above.

However, I'd like more documentation about search paths, module 
loading and the like - does anyone know where I can find this?

Cheers,

Neil

-- 

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 47
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : [EMAIL PROTECTED]
Cenix Website : http://www.cenix-bioscience.com

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


wxPythin installation woes

2005-07-21 Thread linuxfreak
Hi all,

Was working with python 2.3 in a fedora core 3 machine. I upgraded it
to Fedora Core 4 with a clean install. So now I have python 2.4
installed. But when I try to install wxPython for python 2.4 using an
rpm file i downloaded from the wxpython web site i get dependencies
errors. Turns out that  libstdc++.so.5 is needed but I checked and i
see that libstdc++.so.6 is installed on my system. Help needed guys and
needed pronto. Thanks a ton once again :)

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


Re: Web-Forms

2005-07-21 Thread Simon Brunning
On 7/21/05, Mathias Waack [EMAIL PROTECTED] wrote: 
 I need to access some information from a web site which are only accessible
 through a form. Thus for each bucket of data you have to fill out the form,
 submit it and wait for an answer. Very easy - if you don't have to check
 some hundred times. Of course this site requires cookies, it is not
 directly accessible by URL and so on. All that nice stuff used to make a
 web site more professional;)
 
 But now the question: how can this be solved by using Python?

Mechanize?

http://wwwsearch.sourceforge.net/mechanize/

-- 
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lots of pdf files

2005-07-21 Thread Duncan Booth
Greg Lindstrom wrote:

 I'm running Python 2.3 on a Linux system and have lots (about 2000) 
 files in pdf format to print each day.  If I just wind up and fire all 
 the files at the printer at once (as 2000 separate print jobs), the 
 print server throws a fit and our system admin comes down and slaps me 
 around for a few minutes (which, I guess, is fair).
 
 There does not appear to be a simple way to merge many pdf's into one.  
 I could, for example, merge all of the files for a particular provider 
 into one pdf for that provider and then print it (or, better 
 yet...encrypt it and ship it!), but I do not see a way.
 

A quick Google search turns up lots of program which claim to merge PDFs 
files. e.g. http://www.verypdf.com/pdfpg/index.html (for a mere $29.90, 
except it is GPL'd so I'm not sure what the money is for).

Or perhaps PDCAT, http://www.pdf-tools.com/asp/products.asp?name=CLE for 
$150, or $250 if you want to be able to encrypt the output and ship it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is a file open ?

2005-07-21 Thread luis
John Machin wrote:
 Daniel Dittmar wrote:
 
 luis wrote:

 for root, dirs, files in os.walk(path):
for file in files:
   # ¿ is opened ?



 On Linux and some other Unixes, you can probably read the /proc 
 filesystem.

 On Windows, you'll probably get the quickest result by running 
 handle.exe (http://www.sysinternals.com/Utilities/Handle.html).

 Either way, the information you'll get is restricted by your permissions.

 Either information will get stale really fast, so it's not suitable if 
 your task is something like 'can I backup this directory or is someone 
 writing to a file?'
 
 
 If that's what the OP had in mind, the question might have been better 
 phrased as given the path to a file, how can I tell if it is currently 
 opened by another process/thread, and better directed to OS-specifc 
 newsgroup(s).
 
there is a specific python function ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is a file open ?

2005-07-21 Thread luis
John Machin wrote:
 Daniel Dittmar wrote:
 
 luis wrote:

 for root, dirs, files in os.walk(path):
for file in files:
   # ¿ is opened ?



 On Linux and some other Unixes, you can probably read the /proc 
 filesystem.

 On Windows, you'll probably get the quickest result by running 
 handle.exe (http://www.sysinternals.com/Utilities/Handle.html).

 Either way, the information you'll get is restricted by your permissions.

 Either information will get stale really fast, so it's not suitable if 
 your task is something like 'can I backup this directory or is someone 
 writing to a file?'
 
 
 If that's what the OP had in mind, the question might have been better 
 phrased as given the path to a file, how can I tell if it is currently 
 opened by another process/thread, and better directed to OS-specifc 
 newsgroup(s).
 
there is a specific python function ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Couple quick questions from a Python Noob

2005-07-21 Thread stringy
For compiling Python, http://effbot.org/zone/python-compile.htm appears
to have some information, although I've never done it myself, so I
wouldn't know any more on the matter.

Also http://starship.python.net/crew/theller/py2exe/ appears to have
something on Python- .exe

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


Re: Generating images with text in them

2005-07-21 Thread Daren Russell
phil hunt wrote:
 I am trying to generate some images (gifs or pngs) with text in 
 them. I can use the Python Imaging Library, but it only has access 
 to the default, rather crappy, font. 
 
 Ideally I'd like to use one of the nicer fonts that come with my X 
 Windows installation. Using Tkinter I can draw these fonts on the 
 screen; is there any way to get these fonts into a bitmapped image?
 For example, can I draw some text on a canvas and then grab that 
 canvas as a bitmap into PIL, and then save it as a file?
 
 Alternately, is there a good source of PIL font files (.pil files)
 somewhere?
 
 If the writers of the Python Imaging Library are reading this, may I 
 suggest that they add more fonts to it. Yes, that would increase 
 the size, but these days disk space is cheap and programmer time
 expensive.
 

I've just been playing around with this.  You can use truetype fonts with:

font = ImageFont.truetype(/path/to/font.ttf, 12)

from version 1.1.4

http://www.pythonware.com/library/pil/handbook/imagefont.htm for more
details

HTH
Daren

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


Re: Generating images with text in them

2005-07-21 Thread John Abel
Have you downloaded the pilfonts.zip from effbot.org?

J

phil hunt wrote:

I am trying to generate some images (gifs or pngs) with text in 
them. I can use the Python Imaging Library, but it only has access 
to the default, rather crappy, font. 

Ideally I'd like to use one of the nicer fonts that come with my X 
Windows installation. Using Tkinter I can draw these fonts on the 
screen; is there any way to get these fonts into a bitmapped image?
For example, can I draw some text on a canvas and then grab that 
canvas as a bitmap into PIL, and then save it as a file?

Alternately, is there a good source of PIL font files (.pil files)
somewhere?

If the writers of the Python Imaging Library are reading this, may I 
suggest that they add more fonts to it. Yes, that would increase 
the size, but these days disk space is cheap and programmer time
expensive.

  


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


Re: returning list of strings from Python COM to Visual basic 6

2005-07-21 Thread Philippe C. Martin
Thanks a bunch,

I'll try this, This raises two questions:
1) How do I declare the receiving VB variable ?
2) Then, can I use the returned object as a COM object: call its public 
methods (that would be hot)?


Dim newobj as ?
newobj = acom.Get_Obj()

newobj.A_Public()


Regards,

Philippe





On Thursday 21 July 2005 09:55 am, Stefan Schukat wrote:
 You have to wrap the python object with a COM object:

 def Get_Obj(self):
   return win32com.server.util.wrap(an_object)


   Stefan

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of
  Philippe C. Martin
  Sent: Thursday, July 21, 2005 1:42 AM
  To: python-list@python.org
  Subject: Re: returning list of strings from Python COM to
  Visual basic 6
 
 
  I can now pass and return quite a few types except object
  instances: my
  python code gets to the point where I do:
 
 
  def Get_Obj(self):
  .
  return an_object
 
  My VB code looks like
 
  Dim obj as Variant
 
  obj = acom.Get_Obj()
 
 
  I get an unexpected Python error . Objects of type
  'instance' can not
  be converted to a COM VARIANT
 
  Is there a way out ?
 
  Thanks,
 
  Philippe
 
  Philippe C. Martin wrote:
   Hi,
  
   Is it possible ?
  
   ex: return ['1','2']
  
   If so which type should I use in VB ?
  
   dim res as ???
  
   Set testObj = CreateObject()
  
   res = testObj.AMethodThatReturnsAListOfStrings()
  
  
   Thanks,
  
   Philippe
 
  --
  http://mail.python.org/mailman/listinfo/python-list

 The Leading Manufacturing Test Company of the Year 2005
 http://www.dspace.de/goto?f_s_award

-- 
*
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*
-- 
http://mail.python.org/mailman/listinfo/python-list


UPDATE: SPE 0.7.4.d Python Editor released

2005-07-21 Thread Stani
Something which prevented SPE 0.7.4.a to start is fixed

Stani

PS http://www.stani.be/python/spe/blog

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


Re: gdb python C API

2005-07-21 Thread fraca7
derrick a écrit :

 are there any tools / methods that others have used to get what line of
 the python script is being executed while running in gdb? or if it would
 actually show me the source python script (instead of the the python c
 source) that would help.

I don't think so, but when having a memory problem I usually find 
valgrind very useful.

http://valgrind.org/

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


A sad story about a real Python

2005-07-21 Thread Marco Aschwanden

http://www.snopes.com/photos/animals/fencesnake.asp

Cheers,
Marco


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


Re: wxPythin installation woes

2005-07-21 Thread Sybren Stuvel
linuxfreak enlightened us with:
 Turns out that  libstdc++.so.5 is needed but I checked and i see
 that libstdc++.so.6 is installed on my system.

On my system (Ubuntu, based on Debian), I can have multiple versions
of libstdc++ installed at the same time.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is a file open ?

2005-07-21 Thread John Machin
luis wrote:
 John Machin wrote:
 
 Daniel Dittmar wrote:

 luis wrote:

 for root, dirs, files in os.walk(path):
for file in files:
   # ¿ is opened ?




 On Linux and some other Unixes, you can probably read the /proc 
 filesystem.

 On Windows, you'll probably get the quickest result by running 
 handle.exe (http://www.sysinternals.com/Utilities/Handle.html).

 Either way, the information you'll get is restricted by your 
 permissions.

 Either information will get stale really fast, so it's not suitable 
 if your task is something like 'can I backup this directory or is 
 someone writing to a file?'



 If that's what the OP had in mind, the question might have been better 
 phrased as given the path to a file, how can I tell if it is 
 currently opened by another process/thread, and better directed to 
 OS-specifc newsgroup(s).

 there is a specific python function ?

If you mean is there a Python function that given a filename, returns 
an indication of whether that file has been opened by another 
process/thread, portably across different operating systems? then the 
answer is NO. This is what I meant by the question might have been ... 
better directed to OS-specifc newsgroup(s). That is what you should 
have inferred from Daniel's reply On Linux ... probably ... On Windows 
... probably

If you mean something else, you might like to try rephrasing your question.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: spurious syntax error when updating to 2.4 ?

2005-07-21 Thread Simon Dahlbacka
Replying to self,

it seems to be related to
https://sourceforge.net/tracker/index.php?func=detailaid=1163244group_id=5470atid=105470
(Syntax error on large file with MBCS encoding)
even though my files had # -*- coding: ascii -*-
However, if I removed this explicit ascii encoding then I did not get
any syntax error.

/Simon

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


Re: gdb python C API

2005-07-21 Thread skip

fraca7 derrick a écrit :
 are there any tools / methods that others have used to get what line
 of the python script is being executed while running in gdb? or if it
 would actually show me the source python script (instead of the the
 python c source) that would help.

fraca7 I don't think so, but when having a memory problem I usually
fraca7 find valgrind very useful.

Actually, take a look in the distribution at Misc/gdbinit.  In particular,
check out the pystack command.

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


Re: UPDATE: SPE 0.7.4.d Python Editor released

2005-07-21 Thread travlr
I just dloaded 0.7.4.b an hour ago... your quik. Ha...lol. :-)

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


Re: gdb python C API

2005-07-21 Thread fraca7
[EMAIL PROTECTED] a écrit :

 Actually, take a look in the distribution at Misc/gdbinit.  In particular,
 check out the pystack command.

Wow, nice! This will be put to good use, thanks :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Path Setting

2005-07-21 Thread Chris Curvey
http://www.python.org/doc/2.4.1/inst/search-path.html#SECTION00041

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


Re: Lots of pdf files

2005-07-21 Thread nick
Paul Rubin http://[EMAIL PROTECTED] wrote:
 Greg Lindstrom [EMAIL PROTECTED] writes:
  There does not appear to be a simple way to merge many pdf's into one.

 There's probably some way to do it with pstops or some related program
 or set of programs.

Google for multivalent tools - a collection of Java applications
for PDF manipulation...


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


print pdf file to network printer using python

2005-07-21 Thread scrimp
Well, Ive been searching through google groups and Ive seen a lot about
printing a pdf file, but I havent seen a definite answer. I tried this
code:

f = open(printer_path, 'w')
f.write(pdffile_path)
f.close()

Basically it doesnt work and what it prints out is the value of
pdffile_path variable. If anyone can offer some help, Id appreaciate it
thanks!

--Barry

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


Re: returning list of strings from Python COM to Visual basic 6

2005-07-21 Thread Philippe C. Martin
I guess that also means (which makes sense) that the returned object has to
be registered as a COM object.

However, in my case, I just needed that object to pass it to yet another
object, I did not need to use it from VB

Regards,

Philippe



Philippe C. Martin wrote:

 Thanks a bunch,
 
 I'll try this, This raises two questions:
 1) How do I declare the receiving VB variable ?
 2) Then, can I use the returned object as a COM object: call its public
 methods (that would be hot)?
 
 
 Dim newobj as ?
 newobj = acom.Get_Obj()
 
 newobj.A_Public()
 
 
 Regards,
 
 Philippe
 
 
 
 
 
 On Thursday 21 July 2005 09:55 am, Stefan Schukat wrote:
 You have to wrap the python object with a COM object:

 def Get_Obj(self):
 return win32com.server.util.wrap(an_object)


 Stefan

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of
  Philippe C. Martin
  Sent: Thursday, July 21, 2005 1:42 AM
  To: python-list@python.org
  Subject: Re: returning list of strings from Python COM to
  Visual basic 6
 
 
  I can now pass and return quite a few types except object
  instances: my
  python code gets to the point where I do:
 
 
  def Get_Obj(self):
  .
  return an_object
 
  My VB code looks like
 
  Dim obj as Variant
 
  obj = acom.Get_Obj()
 
 
  I get an unexpected Python error . Objects of type
  'instance' can not
  be converted to a COM VARIANT
 
  Is there a way out ?
 
  Thanks,
 
  Philippe
 
  Philippe C. Martin wrote:
   Hi,
  
   Is it possible ?
  
   ex: return ['1','2']
  
   If so which type should I use in VB ?
  
   dim res as ???
  
   Set testObj = CreateObject()
  
   res = testObj.AMethodThatReturnsAListOfStrings()
  
  
   Thanks,
  
   Philippe
 
  --
  http://mail.python.org/mailman/listinfo/python-list

 The Leading Manufacturing Test Company of the Year 2005
 http://www.dspace.de/goto?f_s_award
 

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


Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 00:51:45 -0400, Christopher Subich [EMAIL PROTECTED] 
wrote:
Jp Calderone wrote:

 In the particular case of wxWidgets, it turns out that the *GUI* blocks
 for long periods of time, preventing the *network* from getting
 attention.  But I agree with your position for other toolkits, such as
 Gtk, Qt, or Tk.

Wow, I'm not familiar with wxWidgets; how's that work?

wxWidgets' event loop doesn't differentiate between two unrelated (but similar 
sounding) concepts: blocking arbitrary input from the user (as in the case of 
modal dialogs) and blocking execution of code.

When you pop up a modal dialog, your code will not get another chance to run 
until the user dismisses it.  Similarly, as long as a menu is open, your code 
will not get to run.

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


Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On 20 Jul 2005 22:06:31 -0700, Paul Rubin http://phr.cx@nospam.invalid 
wrote:
Christopher Subich [EMAIL PROTECTED] writes:
  In the particular case of wxWidgets, it turns out that the *GUI*
  blocks for long periods of time, preventing the *network* from
  getting attention.  But I agree with your position for other
  toolkits, such as Gtk, Qt, or Tk.

 Wow, I'm not familiar with wxWidgets; how's that work?

Huh?  It's pretty normal, the gui blocks while waiting for events
from the window system.  I expect that Qt and Tk work the same way.

But not Gtk? :)  I meant what I said: wxWidgets behaves differently in this 
regard than Gtk, Qt, and Tk.

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


Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 05:42:32 -, Donn Cave [EMAIL PROTECTED] wrote:
Quoth Paul Rubin http://[EMAIL PROTECTED]:
| Christopher Subich [EMAIL PROTECTED] writes:
|   In the particular case of wxWidgets, it turns out that the *GUI*
|   blocks for long periods of time, preventing the *network* from
|   getting attention.  But I agree with your position for other
|   toolkits, such as Gtk, Qt, or Tk.
| 
|  Wow, I'm not familiar with wxWidgets; how's that work?
|
| Huh?  It's pretty normal, the gui blocks while waiting for events
| from the window system.  I expect that Qt and Tk work the same way.

In fact anything works that way, that being the nature of I/O.
But usually there's a way to add your own I/O source to be
dispatched along with the UI events -- the toolkit will for
example use select() to wait for X11 socket I/O, so it can also
respond to incoming data on another socket, provided along with a
callback function by the application.

Am I hearing that wxWindows or other popular toolkits don't provide
any such feature, and need multiple threads for this reason?


Other popular toolkits do.  wxWindows doesn't.

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


Re: popen2 usage

2005-07-21 Thread jb
Actually, -test1 is a text argument that testme.exe should receive
from standard input. For example,
Executing testme.exe generates the following output,
Please select one of the following options:
1) test1
2) test2
3) exit
Please enter your option here:-test1 -This -test1 is what user would
type

Thanks,
-JB


Steven Bethard wrote:
 jb wrote:
  Hi there:
 
  I need help with popen2 usage.  I am coding on Windows 2000 environment
  and I am basically trying to run command line executable program that
  accepts command line arguments from user. I want to be able to provide
  these arguments through input pipe so that executable does not require
  any intervention from the user.  The way I am doing this is as below:
 
  out1, in1 = popen2.popen2(testme.exe  abc.txt)
  in1.write('-test1')
  in1.flush()
  in1.close()
 
  But this does not seem to be working, when I open abc.txt file it does
  not show '-test1' argument that was supplied via in1.write method. This
  causing executable to wait forever unless user manually kills the
  process.

 I'm confused; is -test1 a command line argument to testme.exe?  Or is
 it the text that testme.exe should receive from standard input?

 Either way, I would suggest using subprocess instead of popen*.

 To pass -test1 as a command line argument, do something like:

 import subprocess as sp
 p = sp.Popen([testme.exe, -test1], stdout=sp.PIPE)
 out1 = sp.stdout.read()

 To pass -test1 through standard input, do something like:

 import subprocess as sp
 p = sp.Popen([testme.exe], stdout=sp.PIPE)
 p.stdin.write(-test1)
 p.stdin.flush()
 p.stdin.close()
 out1 = p.stdout
 
 HTH,
 
 STeVe

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


Buffering problem using subprocess module

2005-07-21 Thread Dr. Who
I am using the subprocess module in 2.4.  Here's the fragment:

bufcaller.py:
import sys, subprocess
proc = subprocess.Popen('python bufcallee.py', bufsize=0, shell=True,
stdout=subprocess.PIPE)
for line in proc.stdout:
sys.stdout.write(line)

bufcallee.py:
import time
print 'START'
time.sleep(10)
print 'STOP'

Although the documentation says that the output should be unbuffered
(bufsize=0) the program (bufcaller) pauses for 10 seconds and then
prints START immediately followed by 'STOP' rather than pausing 10
seconds in between them.  Note that I made bufcallee a Python script
for ease of the example but in the real-world problem I am trying to
solve it is simply an executable.

Any ideas?
Jeff

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


Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 02:33:05 -0400, Peter Hansen [EMAIL PROTECTED] wrote:
Jp Calderone wrote:
 In the particular case of wxWidgets, it turns out that the *GUI* blocks
 for long periods of time, preventing the *network* from getting
 attention.  But I agree with your position for other toolkits, such as
 Gtk, Qt, or Tk.

Are you simply showing that there are two points of view here, that one
can look at the wx main loop as being blocking, waiting for I/O, even
though it is simply doing asynchronous event-driven processing the same
as Twisted?  Or am I missing something?  Allowing for the fact that wx
blocks, not just for long periods of time, but *indefinitely* (as long
as no events are arriving) I still don't see how that makes it different
from Twisted or from any other typical GUI framework, which do exactly
the same thing.  (And since there is even a wxPython main loop
integrated with and provided in Twisted, surely you aren't arguing that
what wx does is somehow unusual or bad.)

Providing wx support in Twisted has been orders of magnitude more difficult 
than providing Tk, Qt, or Gtk support has been.  And wxsupport and wxreactor 
are each broken in slightly different ways, so I wouldn't say we've been 
successful, either.

Blocking inside the mainloop while waiting for events is fine.  It's blocking 
elsewhere that is problematic.

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


Listing Processes Running on Remote Machines

2005-07-21 Thread yoda
Hello Hackers,
I'm developing a large scale distributed service and part of the
requirement is that I be able to monitor clients in a very granular
way.

To this end, I'd like to know if there is any way to get a list of all
the processes running on a remote client\machine.  I need to be able to
do this on demand. (i.e on user demand)

Please note that the clients run heterogeneous operating systems mainly
Linux and Windows2000\XP

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


Re: Buffering problem using subprocess module

2005-07-21 Thread Jp Calderone
On 21 Jul 2005 06:14:25 -0700, Dr. Who [EMAIL PROTECTED] wrote:
I am using the subprocess module in 2.4.  Here's the fragment:

bufcaller.py:
   import sys, subprocess
   proc = subprocess.Popen('python bufcallee.py', bufsize=0, shell=True,
stdout=subprocess.PIPE)
   for line in proc.stdout:
   sys.stdout.write(line)

bufcallee.py:
   import time
   print 'START'
   time.sleep(10)
   print 'STOP'

Although the documentation says that the output should be unbuffered
(bufsize=0) the program (bufcaller) pauses for 10 seconds and then
prints START immediately followed by 'STOP' rather than pausing 10
seconds in between them.  Note that I made bufcallee a Python script
for ease of the example but in the real-world problem I am trying to
solve it is simply an executable.

Any ideas?

There are a few places buffering can come into play.  The bufsize parameter to 
Popen() controls buffering on the reading side, but it has no effect on 
buffering on the writing side.  If you add a sys.stdout.flush() after the 
prints in the child process, you should see the bytes show up immediately.  
Another possibility is to start Python in unbuffered mode (pass the -u flag, or 
set PYTHONUNBUFFERED in the environment), but obviously this only applies to 
Python programs.  Still another possibility (generally the nicest) is to use a 
PTY instead of a pipe: when the C library sees stdout is a pipe, it generally 
decides to put output into a different buffering mode than when it sees stdout 
is a pty.  I'm not sure how you use ptys with the subprocess module.

Hope this helps,

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


RE: Listing Processes Running on Remote Machines

2005-07-21 Thread George Flaherty
Look into STAF http://staf.sourceforge.net/index.php

-g

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of yoda
Sent: Thursday, July 21, 2005 9:23 AM
To: python-list@python.org
Subject: Listing Processes Running on Remote Machines

Hello Hackers,
I'm developing a large scale distributed service and part of the requirement is 
that I be able to monitor clients in a very granular way.

To this end, I'd like to know if there is any way to get a list of all the 
processes running on a remote client\machine.  I need to be able to do this on 
demand. (i.e on user demand)

Please note that the clients run heterogeneous operating systems mainly Linux 
and Windows2000\XP

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


Re: wxPythin installation woes

2005-07-21 Thread linuxfreak
Does anyone know if the same can be done in fedora distributions???



Sybren Stuvel wrote:
 linuxfreak enlightened us with:
  Turns out that  libstdc++.so.5 is needed but I checked and i see
  that libstdc++.so.6 is installed on my system.

 On my system (Ubuntu, based on Debian), I can have multiple versions
 of libstdc++ installed at the same time.

 Sybren
 --
 The problem with the world is stupidity. Not saying there should be a
 capital punishment for stupidity, but why don't we just take the
 safety labels off of everything and let the problem solve itself?
  Frank Zappa

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


Re: Filling up commands.getstatusoutput's buffer

2005-07-21 Thread Jeff Epler
On Wed, Jul 20, 2005 at 03:10:49PM -0700, [EMAIL PROTECTED] wrote:
 Hey,
 
 Has anyone ever had commands.getstatusoutput's buffer fill up when
 executing a verbose command? [...]

How much output are you talking about?  I tried outputs as large as
about 260 megabytes without any problem. (RedHat 9, Python 2.2)

 len(commands.getoutput(dd if=/dev/zero bs=512 count=512000 2/dev/null))
262144000
 512 * 512000
262144000

Jeff


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

Re: is this pythonic?

2005-07-21 Thread Steven D'Aprano
On Wed, 20 Jul 2005 16:30:10 -0400, Bill Mill wrote:

 On 7/20/05, Simon Brunning [EMAIL PROTECTED] wrote:
 On 7/20/05, Mage [EMAIL PROTECTED] wrote:
  Or is there better way?
 
  for (i, url) in [(i,links[i]) for i in range(len(links))]:
 
 for i, url in enumerate(links):
 
 
 +2 for creating seeing a need and crafting a reasonable solution, but
 -1 for not reading the section on builtins to see if it existed
 already.

To see if *what* existed already?

It is well and good to say RTFM, but there are 697 subsections to the
Python Library reference, and if you don't know what you are looking for,
and beginners rarely are, it isn't obvious which is the right section to
read. And the Library Reference isn't even the manual: there is also the
global module reference and language reference.

If you already know what you are looking for, reading the manual is great
advice. Browsing the manual looking for interesting tidbits can even be
fun for a certain mindset. But if you don't know enough to know what to
look for, where in the 2000-odd sections of the Python references will
you find it?



 (As for its pythonicity, I would have recommended isolating it into a
 function and making it a generator:

It is easy to take this to extremes. It isn't necessary to isolate
everything into its own object, or class, or module. Too much
encapsulation is just as bad as too little.


 def my_enumerate(enumerable):
 i = 0
 for elt in enumerable:
 yield (i, elt)
 i += 1
 
 for i, url in my_enumerate(links):
 
 but it's not too bad as it is. Also, my function is completely
 untested - it's close to right though.)

What is the advantage of your function my_enumerate over the Python
built-in enumerate?


-- 
Steven.

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


Re: goto

2005-07-21 Thread Rocco Moretti

 My favorite infinte loop with while is:
 
i = 0
while i  20:
  do_process(i)
 
 Note the prominent *lack* of any change to i here?
 
 Oh, for:
 
 from i = 0
 invariant 0 = i = 20
 variant 21 - i
 until i  19
 loop
 do_process(i)
 
 which throws an exception at the beginning of the second loop.

What language is that from?

I take it the exception is from the 21-i not changing as it goes 
around the loop, right? (But why can't variant i work just as well?)
-- 
http://mail.python.org/mailman/listinfo/python-list


Dr. Dobb's Python-URL! - weekly Python news and links (Jul 20)

2005-07-21 Thread Simon Brunning
QOTW: Discussing goto statements and Microsoft together is like mixing
dynamite and gasoline. - DH

'Spaghetti doesn't quite describe it. I've settled on Lovecraftian:
reading the code, you can't help but get the impression of writhing
tentacles and impossible angles.' - Robert Kern


Highlight of the week; Jython 2.2a1:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/9c3b6b2e10d8a490

Nearly-highlight of the week; Simon Willison introduces Django, the
web framework for perfectionists with deadlines:
http://simon.incutio.com/archive/2005/07/17/django

But Jeff Shell remains more impressed with Subway:
http://griddlenoise.blogspot.com/2005/07/python-off-rails.html

CherryPy-2.1.0-beta released:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/18f2e97ab515891

With all this web framework activity, what are people using?

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/63bdf6b93e1704d3

Bob Ippolito wonders; what happened to YAML?
http://bob.pythonmac.org/archives/2005/07/19/what-happened-to-yaml/

MKoool (!) is looking for the simplest way of stripping non-printable
characters from text:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/23d6fdc3c9148725

Discovering WSGI and XSLT as middleware

http://www.decafbad.com/blog/2005/07/18/discovering_wsgi_and_xslt_as_middleware

Is there any worthwhile Python certification available? Is there any
worthwhile certification at all?

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/49dc79507ca4567d

Microsoft's very own Python scripts:

http://www.microsoft.com/technet/scriptcenter/scripts/python/pyindex.mspx

Another notable release; python-dateutil 1.0:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/7d0f044f1a3c8959



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance. 
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Cetus collects Python hyperlinks.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a collaborative effort to capture useful and
interesting recipes.

Re: is this pythonic?

2005-07-21 Thread Bill Mill
On 7/21/05, Steven D'Aprano [EMAIL PROTECTED] wrote:
 On Wed, 20 Jul 2005 16:30:10 -0400, Bill Mill wrote:
 
  On 7/20/05, Simon Brunning [EMAIL PROTECTED] wrote:
  On 7/20/05, Mage [EMAIL PROTECTED] wrote:
   Or is there better way?
  
   for (i, url) in [(i,links[i]) for i in range(len(links))]:
 
  for i, url in enumerate(links):
 
 
  +2 for creating seeing a need and crafting a reasonable solution, but
  -1 for not reading the section on builtins to see if it existed
  already.
 
 To see if *what* existed already?
 
 It is well and good to say RTFM, but there are 697 subsections to the
 Python Library reference, and if you don't know what you are looking for,
 and beginners rarely are, it isn't obvious which is the right section to
 read. And the Library Reference isn't even the manual: there is also the
 global module reference and language reference.
 
 If you already know what you are looking for, reading the manual is great
 advice. Browsing the manual looking for interesting tidbits can even be
 fun for a certain mindset. But if you don't know enough to know what to
 look for, where in the 2000-odd sections of the Python references will
 you find it?
 

I said the *builtins* section. I think you learn pretty quick that
figuring out what functions are builtins is pretty important in every
language. There's a fair number of people out there giving the advice
to read chapter 2 of the library reference cover-to-cover for a good
starter on python.

Furthermore, I wasn't being hard on the guy, he still added up to +1.
Lighten up, I was joking.

 
 
  (As for its pythonicity, I would have recommended isolating it into a
  function and making it a generator:
 
 It is easy to take this to extremes. It isn't necessary to isolate
 everything into its own object, or class, or module. Too much
 encapsulation is just as bad as too little.
 

agreed; his listcomp just looks awkward inside the for loop statement;
if it were my code, I would put it into a function. He asked if his
code was pythonic, and I think the (non-extreme) pythonic thing to do
would be to put his listcomp into a function.

 
  def my_enumerate(enumerable):
  i = 0
  for elt in enumerable:
  yield (i, elt)
  i += 1
 
  for i, url in my_enumerate(links):
 
  but it's not too bad as it is. Also, my function is completely
  untested - it's close to right though.)
 
 What is the advantage of your function my_enumerate over the Python
 built-in enumerate?
 
 

absolutely none; I just was saying how I would encapsulate it into a function.

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


Python session handling

2005-07-21 Thread mohammad babaei
Hi,
What is th best way for session tracking in python ?

regards,
mo
-- 
http://mail.python.org/mailman/listinfo/python-list

Stupid question: Making scripts python-scripts

2005-07-21 Thread Jan Danielsson
Hello all,

   How do I make a python script actually a _python_ in unix:ish
environments?

I know about adding:
#!/bin/sh

   ..as the first row in a shell script, but when I installed python on
a NetBSD system, I didn't get a python executable; only a python2.4
executable.

   Adding #!/usr/pkg/bin/python2.4 as the first row in the script
would probably work, but that would be too specific for the system I'm
using, imho.

   I saw someone using #!/usr/bin/env python, but that failed on the
system I'm using, so I assume that's something specific too (or is the
installation broken?).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 16:34:30 +0200, Jan Danielsson [EMAIL PROTECTED] wrote:
Hello all,

   How do I make a python script actually a _python_ in unix:ish
environments?

 [snip]

Put #!/usr/bin/python.  Install the program using distutils: if necessary, 
distutils will rewrite the #! line to fit the configuration of the system the 
program is being installed on.

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


Overriding a built-in exception handler

2005-07-21 Thread callmebill
I'm having a tough time figuring this one out:


class MyKBInterrupt( . ):
   print Are you sure you want to do that?

if __name__ == __main__:
   while 1:
   print Still here...


So this thing keeps printing Still here... until the user hits ctl-c,
at which time the exception is passed to MyKBInterrupt to handle the
exception, rather than to whatever the built-in handler would be.

I've Read-TFM, but I only see good info on how to create my own class
of exception;  I don't see anything on how to override an existing
exception handler.

Thanks in advance for any help.

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


Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread callmebill
On your system, do:
which python2.4

That will give you the full path to the python2.4 binary (let's call it
path/to/py24).

Then add:
#!/path/to/py24

...to the top of your script.

And make sure the file is chmod'd +x

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


Re: Overriding a built-in exception handler

2005-07-21 Thread Jp Calderone
On 21 Jul 2005 07:39:10 -0700, [EMAIL PROTECTED] wrote:
I'm having a tough time figuring this one out:


class MyKBInterrupt( . ):
   print Are you sure you want to do that?

if __name__ == __main__:
   while 1:
   print Still here...


So this thing keeps printing Still here... until the user hits ctl-c,
at which time the exception is passed to MyKBInterrupt to handle the
exception, rather than to whatever the built-in handler would be.

I've Read-TFM, but I only see good info on how to create my own class
of exception;  I don't see anything on how to override an existing
exception handler.

Thanks in advance for any help.

See excepthook in the sys module documentation: 

  http://python.org/doc/lib/module-sys.html

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


Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread Bill Mill
On 7/21/05, Jan Danielsson [EMAIL PROTECTED] wrote:
 Hello all,
 
How do I make a python script actually a _python_ in unix:ish
 environments?
 
 I know about adding:
 #!/bin/sh
 
..as the first row in a shell script, but when I installed python on
 a NetBSD system, I didn't get a python executable; only a python2.4
 executable.
 
Adding #!/usr/pkg/bin/python2.4 as the first row in the script
 would probably work, but that would be too specific for the system I'm
 using, imho.
 
I saw someone using #!/usr/bin/env python, but that failed on the
 system I'm using, so I assume that's something specific too (or is the
 installation broken?).

The env program [1], which usually exists at least on a linux system,
executes the program given as its argument. Thus, /usr/bin/env
python tries to executes python, which bash will then use to run the
python script. As long as env exists, and python is somewhere in the
PATH, this is a fairly portable way to run python scripts.

Does BSD really not come with the env program? I bet there's an
equivalent you could symlink to it. Unfortunately, I've never BSDed,
so I can't help you find it. To get a workable subset of the normal
env functionality, you could try (assuming you use bash):

/home/llimllib $ echo $@  /usr/bin/env
/home/llimllib $ chmod a+x /usr/bin/env

Peace
Bill Mill
bill.mill at gmail.com

[1]: http://rootr.net/man/man/env/1
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overriding a built-in exception handler

2005-07-21 Thread Jaime Wyant
You can't override an exception.  You can only catch whatever
exception is thrown.

For your case, you would want to wrap that while loop up in a
try/catch block like this:

try:
while 1:
print Yay for me!
except KeyboardInterrupt:
print CTRL-C caught

Someone had mentioned possibly overriding sys.excepthook, but that
doesn't really override an exception handler.  That function is
called when an unhandled exception occurs.  That little hook is really
nice if you want to display information back to the user and possibly
report the info back to a server somewhere.

jw

On 21 Jul 2005 07:39:10 -0700, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I'm having a tough time figuring this one out:
 
 
 class MyKBInterrupt( . ):
print Are you sure you want to do that?
 
 if __name__ == __main__:
while 1:
print Still here...
 
 
 So this thing keeps printing Still here... until the user hits ctl-c,
 at which time the exception is passed to MyKBInterrupt to handle the
 exception, rather than to whatever the built-in handler would be.
 
 I've Read-TFM, but I only see good info on how to create my own class
 of exception;  I don't see anything on how to override an existing
 exception handler.
 
 Thanks in advance for any help.
 
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread Bill Mill
On 7/21/05, Bill Mill [EMAIL PROTECTED] wrote:
 On 7/21/05, Jan Danielsson [EMAIL PROTECTED] wrote:
  Hello all,
 
 How do I make a python script actually a _python_ in unix:ish
  environments?
 
  I know about adding:
  #!/bin/sh
 
 ..as the first row in a shell script, but when I installed python on
  a NetBSD system, I didn't get a python executable; only a python2.4
  executable.
 
 Adding #!/usr/pkg/bin/python2.4 as the first row in the script
  would probably work, but that would be too specific for the system I'm
  using, imho.
 
 I saw someone using #!/usr/bin/env python, but that failed on the
  system I'm using, so I assume that's something specific too (or is the
  installation broken?).
 
 The env program [1], which usually exists at least on a linux system,
 executes the program given as its argument. Thus, /usr/bin/env
 python tries to executes python, which bash will then use to run the
 python script. As long as env exists, and python is somewhere in the
 PATH, this is a fairly portable way to run python scripts.
 
 Does BSD really not come with the env program? I bet there's an
 equivalent you could symlink to it. Unfortunately, I've never BSDed,
 so I can't help you find it. To get a workable subset of the normal
 env functionality, you could try (assuming you use bash):
 
 /home/llimllib $ echo $@  /usr/bin/env
 /home/llimllib $ chmod a+x /usr/bin/env
 

ahhh, that should be:

/home/llimllib $ echo \$@  /usr/bin/env

otherwise bash tries to substitute into the string. Sorry bout that.

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


difficulty connecting to networked oracle database

2005-07-21 Thread yahibble
Now, I am no Python expert but I have dabbled and I have spent a
couple of days with another engineer unsuccessfully installing oracle
drivers for MS ODBC on the win XP machine.

It looked to me like ODBC was the best way to get a (free) python
module to upload data to an oracle database table. Aside from
installing oracle clients to ODBC being a pain, I would like to
consider other ways to connect.

Has anyone had experiences with Python connecting to oracle from Win
XP? I have searched the 'net for various modules and discussions but
have no success thus far.

Thanks, Graeme.


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


Re: difficulty connecting to networked oracle database

2005-07-21 Thread Paul McNett
yahibble wrote:
 Now, I am no Python expert but I have dabbled and I have spent a
 couple of days with another engineer unsuccessfully installing oracle
 drivers for MS ODBC on the win XP machine.
 
 It looked to me like ODBC was the best way to get a (free) python
 module to upload data to an oracle database table. Aside from
 installing oracle clients to ODBC being a pain, I would like to
 consider other ways to connect.
 
 Has anyone had experiences with Python connecting to oracle from Win
 XP? I have searched the 'net for various modules and discussions but
 have no success thus far.

I don't have specific experience with Oracle and Python, but I do know 
that using Python's DB-API is usually the best way to go. For Oracle, 
everyone seems to be using cx_oracle, a Python package freely 
downloadable from:

http://www.computronix.com/utilities.shtml

ODBC isn't really the best solution for Python programs.

-- 
Paul McNett
http://paulmcnett.com

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


Re: difficulty connecting to networked oracle database

2005-07-21 Thread Martin Franklin
yahibble wrote:
 Now, I am no Python expert but I have dabbled and I have spent a
 couple of days with another engineer unsuccessfully installing oracle
 drivers for MS ODBC on the win XP machine.
 
 It looked to me like ODBC was the best way to get a (free) python
 module to upload data to an oracle database table. Aside from
 installing oracle clients to ODBC being a pain, I would like to
 consider other ways to connect.
 
 Has anyone had experiences with Python connecting to oracle from Win
 XP? I have searched the 'net for various modules and discussions but
 have no success thus far.
 
 Thanks, Graeme.
 
 


not used it on Windows XP (just 2000) but cx_Oracle worked for me

http://sourceforge.net/projects/cx-oracle/

Martin

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


Re: What does :: mean?

2005-07-21 Thread Michael Hoffman
Robert Kern wrote:
 Rob Williscroft wrote:
 
 import sys

 live = 'live'

 print live[ sys.maxint  :  : -1 ]
 print live[ len(live)-1 :  : -1 ]

 print live[ len(live)-1 : -len(live)-1 : -1 ]
 print live[ len(live)-1 : -sys.maxint  : -1 ]
 print live[ sys.maxint  : -sys.maxint  : -1 ]
 print live[ -1  : -len(live)-1 : -1 ]

 Of course there is only one obvious way to do it, but alas
 as I'm not Dutch I can't tell which it is.
 
 Well, that part's easy at least:
 
   live[::-1]
 
 :-)  And so the circle is complete ...

What about reversed(live)? Or if you want a list instead of an iterator, 
list(reversed(live))?
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


PEP on path module for standard library

2005-07-21 Thread Michael Hoffman
Many of you are familiar with Jason Orendorff's path module 
http://www.jorendorff.com/articles/python/path/, which is frequently 
recommended here on c.l.p. I submitted an RFE to add it to the Python 
standard library, and Reinhold Birkenfeld started a discussion on it in 
python-dev 
http://mail.python.org/pipermail/python-dev/2005-June/054438.html.

The upshot of the discussion was that many python-dev'ers wanted path 
added to the stdlib, but Guido was not convinced and said it must have a 
PEP. So Reinhold and I are going to work on one. Reinhold has already 
made some changes to the module to fit the python-dev discussion and put 
it in CPython CVS at nondist/sandbox/path.

For the PEP, do any of you have arguments for or against including path? 
Code samples that are much easier or more difficult with this class 
would also be most helpful.

I use path in more of my modules and scripts than any other third-party 
module, and I know it will be very helpful when I no longer have to 
worry about deploying it.

Thanks in advance,
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Hash functions

2005-07-21 Thread Steven D'Aprano
Do people often use hash() on built-in types? What do you find it useful
for?

How about on custom classes? Can anyone give me some good tips or hints
for writing and using hash functions in Python?

Thank you,


-- 
Steven.

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


Re: goto

2005-07-21 Thread Michael Hudson
[EMAIL PROTECTED] writes:

  what is the equivalent of C languages' goto  statement in python?
 
  You really shouldn't use goto.
  Fortunately you can't.
 
 Steven Of course you can :-)
 
 Steven You can write your own Python interpreter, in Python, and add a
 Steven goto to it.
 
 Maybe easier would be to write a Python assembler (there's probably already
 one out there) and just write to Python's virtual machine...

The blockstack gets in the way.

Really, I think Richie's goto module is about as good as it can get
without vm surgery (apart from the performance, I'd guess).

Cheers,
mwh

-- 
  Reading Slashdot can [...] often be worse than useless, especially
  to young and budding programmers: it can give you exactly the wrong
  idea about the technical issues it raises.
 -- http://www.cs.washington.edu/homes/klee/misc/slashdot.html#reasons
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread callmebill
oops... I missed the too specific comment.  Sorry =)

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


Re: is this pythonic?

2005-07-21 Thread Michael Hoffman
Steven D'Aprano wrote:

 The great thing about Usenet and the Internet is that we can pick each
 other's brains for answers, instead of flailing around blindly in manuals
 that don't understand the simplest natural language query. And isn't that
 why we're here?

Personally, I feel my time is better served by answering questions that 
would not be easy to find without assistance. I can't expect everyone to 
know about or expect enumerate() from the beginning, so I don't have any 
objections to it being asked here.

If people were to ask what the function signature for enumerate() was 
when that is easy to Google, then I would think they were wasting 
everyone's time.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Christopher Subich
Paul Rubin wrote:
 Huh?  It's pretty normal, the gui blocks while waiting for events
 from the window system.  I expect that Qt and Tk work the same way.

Which is why I recommended Twisted for the networking; it integrates 
with the toolkit event loops so it automagically works: 
http://twistedmatrix.com/projects/core/documentation/howto/choosing-reactor.html#auto15

I agree, though, that basic socket programming in the same thread as the 
gui's probably a bad idea.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread callmebill
You could also set your python environment variable on the system...
set it to be /path/to/python2.4.  Then use the #!/usr/bin/env
python trick.  Just make sure that env is working for you, first.

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


Re: print pdf file to network printer using python

2005-07-21 Thread Grant Edwards
On 2005-07-21, scrimp [EMAIL PROTECTED] wrote:
 Well, Ive been searching through google groups and Ive seen a lot about
 printing a pdf file, but I havent seen a definite answer. I tried this
 code:

 f = open(printer_path, 'w')
 f.write(pdffile_path)
 f.close()

 Basically it doesnt work and what it prints out is the value of
 pdffile_path variable. If anyone can offer some help, Id appreaciate it
 thanks!

You forgot to read the data from the pdf file.

f = open(printer_path, 'w')
f.write(open(pdffile_path,'rb').read())
f.close()

-- 
Grant Edwards   grante Yow!  Yow! It's a hole
  at   all the way to downtown
   visi.comBurbank!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is this pythonic?

2005-07-21 Thread Steven D'Aprano
On Thu, 21 Jul 2005 16:43:00 +0100, Michael Hoffman wrote:

 Personally, I feel my time is better served by answering questions that 
 would not be easy to find without assistance. I can't expect everyone to 
 know about or expect enumerate() from the beginning, so I don't have any 
 objections to it being asked here.
 
 If people were to ask what the function signature for enumerate() was 
 when that is easy to Google, then I would think they were wasting 
 everyone's time.

And on that, I think we can agree!


-- 
Steven.

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


Re: Filling up commands.getstatusoutput's buffer

2005-07-21 Thread travislspencer
Jeff Epler wrote:
 On Wed, Jul 20, 2005 at 03:10:49PM -0700, [EMAIL PROTECTED] wrote:
 How much output are you talking about?

Honestly, I don't know.  I came on to a project were they said they
were hitting up against some limit, and had a hack to work around it.
I just wondered if others had hit some limit too and found diffrent
workarounds.

 I tried outputs as large as
 about 260 megabytes without any problem. (RedHat 9, Python 2.2)

  len(commands.getoutput(dd if=/dev/zero bs=512 count=512000 2/dev/null))
 262144000
  512 * 512000
 262144000

I tried the same tests on CentOS, Python 2.3.4 and on Solaris 9 w/
Python 2.3.3.  No problems.  

--

Regards,

Travis Spencer

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


Re: Overriding a built-in exception handler

2005-07-21 Thread Michael Hoffman
[EMAIL PROTECTED] wrote:

 I've Read-TFM, but I only see good info on how to create my own class
 of exception;  I don't see anything on how to override an existing
 exception handler.

You need to read the tutorial on handling exceptions:

http://docs.python.org/tut/node10.html
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is this pythonic?

2005-07-21 Thread Steven D'Aprano
On Thu, 21 Jul 2005 10:27:24 -0400, Bill Mill wrote:

[snip]

 I said the *builtins* section. I think you learn pretty quick that
 figuring out what functions are builtins is pretty important in every
 language. There's a fair number of people out there giving the advice
 to read chapter 2 of the library reference cover-to-cover for a good
 starter on python.

Sure. But for a beginner to start learning the language by reading the
language manual is a bit much to ask. Some people can do it, but most
learn best by doing, not by reading dry, abstract descriptions of what
various functions do. In my experience, iterators and generators don't
even make sense until you've spent some time playing with them.

 Furthermore, I wasn't being hard on the guy, he still added up to +1.
 Lighten up, I was joking.

There is no need to get defensive, I was merely commenting on the need to
understand that inexperienced programmers often don't know enough about
the language to know where to start looking for the answer.

In fact, it isn't just inexperienced programmers, but experienced
programmers too. I'm sure Guido doesn't need to look up enumerate in the
reference manual; but if he wanted to write a program to calculate the
positions of the anti-nodes of vibratory modes of the bound-state of a
muon and a proton/neutron pair, the odds are pretty good he wouldn't even
know where to start looking either :-)

The great thing about Usenet and the Internet is that we can pick each
other's brains for answers, instead of flailing around blindly in manuals
that don't understand the simplest natural language query. And isn't that
why we're here?



Regards,



-- 
Steven.

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


Re: Hash functions

2005-07-21 Thread Michael Hudson
Steven D'Aprano [EMAIL PROTECTED] writes:

 Do people often use hash() on built-in types? 

Only implicitly.

 What do you find it useful for?

Dictionaries :)

 How about on custom classes?

Same here.

 Can anyone give me some good tips or hints for writing and using
 hash functions in Python?

Well, the usual tip for writing them is, don't, unless you need to.

If implement __eq__, then you need to, so it's fairly common to just
hash a tuple containing the things that are considered by the __eq__
method.  Something like:

class C(object):
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def __eq__(self, other):
return self.a == other.a and self.b == other.b
def __hash__(self):
return hash((self.a, self.b))

Cheers,
mwh

-- 
  I'm a keen cyclist and I stop at red lights.  Those who don't need
  hitting with a great big slapping machine.
   -- Colin Davidson, cam.misc
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does :: mean?

2005-07-21 Thread Robert Kern
Michael Hoffman wrote:
 Robert Kern wrote:

Well, that part's easy at least:

  live[::-1]

:-)  And so the circle is complete ...
 
 What about reversed(live)? Or if you want a list instead of an iterator, 
 list(reversed(live))?

That's fine if you want to iterate over it. Often, especially with 
strings, you just want an object of the same type back again.

-- 
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: difficulty connecting to networked oracle database

2005-07-21 Thread Grig Gheorghiu
As the other posters already mentioned, cx_Oracle is the way to go. I'm
using it to connect to Oracle not only on Windows, but also on Solaris,
Linux and AIX.

Grig

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


Re: PEP on path module for standard library

2005-07-21 Thread Peter Hansen
Michael Hoffman wrote:
 For the PEP, do any of you have arguments for or against including path? 
 Code samples that are much easier or more difficult with this class 
 would also be most helpful.

I believe the strongest argument for path can be made for how it 
integrates functionality which, although closely related conceptually, 
is currently distributed across a half dozen or more different modules 
in the standard library.  Especially for newbies (I can only imagine, at 
this stage) it would make working with files much easier in a many ways.

Easier or more difficult is a subjective thing, of course, but one 
can't argue with the fact that path can sometimes do through a single 
object what would otherwise require several imports and a bunch of calls 
into things like open(), os.path, grep, and shutil.

Examples showing effective uses of path that simplify those cases would 
probably merit the label easier even in Guido's mind, though 
unfortunately that's not certain.  Easier in some minds might simply 
translate to many lines less code, and while path can sometimes do 
that, aside from the ease of splitting and joining stuff without 
multiple calls to os.path.this-and-that, it really doesn't often reduce 
code size _that_ much, in my experience.  (Postings to c.l.p showing a 
50% reduction in code size for contrived examples notwithstanding.)

A related thoughts: since paths are objects, they have attributes or 
properties, and having things like .basename and .parent readily 
available without having to do obscure things like 
os.path.split(somepath)[0] makes things much easier to read (therefore 
more maintainable).  In fact, I'd propose that as another strong 
argument in path's favour: it makes code much more readable, even if not 
easier to write.

Hmm... does easier or more difficult apply to the writing of the 
code or the reading of it?  I find it self-evident that code written 
using path is much easier to read, not necessarily much easier to 
write (for non-newbies).

I'd summarize this by saying that the integration of path in the 
stdlib would make it easier for newbies to write code (that might not be 
obvious to a non-newbie... shall we ask some to help?), and easier for 
everyone to read code (self-evident, no?), and if that's not a 
sufficient condition for inclusion I don't know what is.

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


Re: Generating images with text in them

2005-07-21 Thread phil hunt
On Thu, 21 Jul 2005 11:23:46 +0100, Daren Russell [EMAIL PROTECTED] wrote:
phil hunt wrote:
 I am trying to generate some images (gifs or pngs) with text in 
 them. I can use the Python Imaging Library, but it only has access 
 to the default, rather crappy, font. 
 
 Ideally I'd like to use one of the nicer fonts that come with my X 
 Windows installation. Using Tkinter I can draw these fonts on the 
 screen; is there any way to get these fonts into a bitmapped image?
 For example, can I draw some text on a canvas and then grab that 
 canvas as a bitmap into PIL, and then save it as a file?
 
 Alternately, is there a good source of PIL font files (.pil files)
 somewhere?
 
 If the writers of the Python Imaging Library are reading this, may I 
 suggest that they add more fonts to it. Yes, that would increase 
 the size, but these days disk space is cheap and programmer time
 expensive.
 

I've just been playing around with this.  You can use truetype fonts with:

font = ImageFont.truetype(/path/to/font.ttf, 12)

Thanks! it's working now!

-- 
Email: zen19725 at zen dot co dot uk


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


Re: PEP on path module for standard library

2005-07-21 Thread Fernando Perez
Peter Hansen wrote:

 Michael Hoffman wrote:
 For the PEP, do any of you have arguments for or against including path?
 Code samples that are much easier or more difficult with this class
 would also be most helpful.
 
 I believe the strongest argument for path can be made for how it
 integrates functionality which, although closely related conceptually,
 is currently distributed across a half dozen or more different modules
 in the standard library.  Especially for newbies (I can only imagine, at
 this stage) it would make working with files much easier in a many ways.

+10

One of the few things that annoys me about the stdlib is what one could call
performing 'shell-scripting-like' tasks, and precisely because of the problem
you point out.  A number of conceptually related and common tasks are
scattered all over, and every time I need to write this kind of code, I find
myself paging over the docs for multiple modules, with no real intuition as to
where I could even guess where to find things.  This is very unusual for
python, where in most cases things are so well organized, that blind guessing
tends to work remarkably well.  

Personally I like the path module _a lot_, though I'm sure a thorough once-over
from c.l.py and python-dev, via a PEP, can only make it better and smooth out
hidden rough edges and corner cases.  But I'll be very happy if it does go
into the stdlib in the future.

Just my .02.

Best,

f

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


Re: socket programming

2005-07-21 Thread Helge Aksdal

* gry@ll.mit.edu gry@ll.mit.edu [2005/07/20 15:26]:

 What I have done in similar circumstances is put in a random sleep
 between connections to fool the server's load manager.  Something like:
 
 .import time
 .min_pause,max_pause = (5.0, 10.0) #seconds
 .while True:
 .   time.sleep(random.uniform(min_pause, max_pause))
 .   do_connection_and_query_stuff()
 
 It works for me.  Just play with the pause parameters until it fails
 and add a little.

thanks, this worked for me too. slows down the program, but at least
it works. :)

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


  1   2   >