what are some good python modules?

2010-06-14 Thread Robin
What are some good python modules that can be downloaded for any
purpose that is recomended?
-Robin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: math.erfc OverflowError

2010-06-14 Thread geremy condra
On Sun, Jun 13, 2010 at 10:36 PM, Ben Finney  wrote:
> geremy condra  writes:
>
>> You know, I've never been a part of a community in which the URL
>> format was the most contentious part of filing a bug report.
>
> Heck no, the bug report is already filed, and contentions about the bug
> report should presumably be going into that report. This issue isn't
> about the bug report at all.
>
> The contentious issue here is how to *refer to* a bug report by URL in a
> plain-text natural-language medium :-)
>
> --
>  \         “How wonderful that we have met with a paradox. Now we have |
>  `\                        some hope of making progress.” —Niels Bohr |
> _o__)                                                                  |
> Ben Finney

I love this quote, and have added it to my list of potential future tattoos.

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


Re: Community (A Modest Proposal)

2010-06-14 Thread rantingrick
On Jun 13, 12:45 pm, Terry Reedy  wrote:
> On 6/13/2010 12:14 PM, rantingrick wrote:
>
> > I have documented time and again the poor state of IDLE. The only
> > responses i ever get are...
>
> >   "Nobody uses IDLE"
> >   "Only a dumbass would use IDLE"
> >   "I have never used IDLE but i *know* nothing is wrong with it"
>
> Perhaps you are listening selectively. I have said more than once on
> this list that I use IDLE, I like using it, it works for me, AND I would
> like it improved. When a student proposed that as part of a Google
> Summer of Code project, I (and others) encouraged him to go ahead, which
> he did. Any concrete effort you make to improve IDLE would be
> appreciated by me. There are issues on the tracker already.
>
> Terry Jan Reedy

Sorry Terry -- with all the noise here the very few "quality" signals
just seem to be lost on my "auditory cortex".

 We are at once lucky to have a built in editor and at the same time
cursed by the very static development cycles of this module. IDLE is a
mess and i think the only way to fix this mess is strip it stark
naked, expose it's ugly to the world, and slowly add the layers back
to it in a more intelligent way all the while creating a more elegant
IDLE in the process.

Some peeves:
 The tabs in the shell and four spaces in the editor is just complete
nonsense! The fact that the shell does not insert a "... "
continuation is a real nuance! The constant "zombie" processes
requiring explicit kills via task manager are quite annoying (albeit
not topping my list of concerns at this time). Not to mention the fact
that a file dialog, replace dialog, or find dialog can lose focus and
drop to the bottom of the window stack faster than Obama's approval
ratings after BP takes a leak!

 One feature i would like to create is an ability to redo the last
command. Pressing an F* key should return you to the last block for
editing. Why have a traceback clutter up the output when you made a
simple little mistake? I hate to have a shell just cluttered with
exceptions. Also the ability to clear the buffer and maybe also remove
*all* exceptions might be an added bonus for our "tidy" minded
friends.

 But digging a bit deeper... not only is the UI awful, but the code
itself is just awful. That may be the reason why i start to fix it,
get frustrated, and then shortly after quit. IDLE has not been
properly maintained since Guido left us the house keys. Too many frat
parties and booze fests have left IDLE in a state of disrepair.

 Although I think IDLE is *so* very important to... of course i am not
speaking to the emacs guys or "that other editor" crowd. *you* people
would not be caught dead using IDLE... *to* the new users of Python
(and like in Terry and my exception) some tried and true Pythonistas!

 Hopefully i'll get the motivation for that re-write real soon. So far
i have only corrected a few small but very annoying facets of the UI
in between my other various up-and-coming projects. However it would
be nice to get all the "IDLE-heads" together and do a complete
rewrite. The nice thing about a group is the motivation factor.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on Android Mobile?

2010-06-14 Thread geremy condra
On Mon, Jun 14, 2010 at 1:55 AM, Shashwat Anand
 wrote:
> Well, AFAIK Nokia N900 supports python fully.

Yup, my code has to run on these before it passes build tests. I
almost never have to
do anything crazy to it.

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


Re: what are some good python modules?

2010-06-14 Thread Ben Finney
Robin  writes:

> What are some good python modules that can be downloaded for any
> purpose that is recomended?

You will want to start at the Python Package Index,
http://pypi.python.org/>.

For more specific advice, you'll need to tell us more about what your
specific purpose is. Recommended for what purpose?

-- 
 \   “During the Middle Ages, probably one of the biggest mistakes |
  `\   was not putting on your armor because you were ‘just going down |
_o__)to the corner.’” —Jack Handey |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: file handling

2010-06-14 Thread Cameron Simpson
Please don't top post; post below and trim the content.
Also, please do a reply-to-all to keep the discussion on the list.

Further content is below...

On 14Jun2010 11:44, madhuri vio  wrote:
| On Mon, Jun 14, 2010 at 11:39 AM, Cameron Simpson  wrote:
| > ODT files are _not_ text files. If I recall they are ZIP files containing
| > XML, but I've never checked. There is more info here:
| >  http://en.wikipedia.org/wiki/OpenDocument
| 
| i have renamed the odt file to human and read it in the
| "rb" modestill i get the same reply
| 
| a = open("human","rb")
| print a.readlines()

Renaming a file in no way changes its content. So of course you get the
same result.

You also write:
| when i did it thru a text editor...i am able to read it and

It might help if you said _what_ text editor you used. Some GUI text
editors like TextEdit on a Mac can understand word processor files.
"Plain" text editors will show you binary stuff like your python program
did.

| unable to do the same thru a word document...

I have no idea what this sentence means, however.
-- 
Cameron Simpson  DoD#743
http://www.cskk.ezoshosting.com/cs/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: a +b ?

2010-06-14 Thread Steven D'Aprano
On Mon, 14 Jun 2010 12:24:59 +1000, Ben Finney wrote:

> With ‘reduce’ gone in Python 3 [0]
...
> [0] http://docs.python.org/py3k/library/functions.html>


It's not gone, it's just resting.

http://docs.python.org/py3k/library/functools.html#functools.reduce


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


Re: what are some good python modules?

2010-06-14 Thread James Mills
On Mon, Jun 14, 2010 at 5:02 PM, Robin  wrote:
> What are some good python modules that can be downloaded for any
> purpose that is recomended?

That's a rather vauge question Robin.

There are tonnes of packages on PyPi (1).

cheers
James

1. http://pypi.python.org/


--
-- "Problems are solved by method"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Community (A Modest Proposal)

2010-06-14 Thread geremy condra
On Mon, Jun 14, 2010 at 3:07 AM, rantingrick  wrote:



>  Hopefully i'll get the motivation for that re-write real soon. So far
> i have only corrected a few small but very annoying facets of the UI
> in between my other various up-and-coming projects. However it would
> be nice to get all the "IDLE-heads" together and do a complete
> rewrite. The nice thing about a group is the motivation factor.

And now we come to the crux of the matter- you cheerlead and do
nothing because you need to have people patting you on the back
to know you're going the right direction.

Hint: everybody who has ever started anything really different and
new and worth doing has looked over their shoulder and thought
"maybe I should be back there with those guys", and a lot of
great things have never happened because of it. But either way
you'll eventually have to learn to live without the pats on the back.

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


Re: Which is the best implementation of LISP family of languages for real world programming ?

2010-06-14 Thread Jean-Michel Pichavant

Andrew Philpot wrote:

On 06/11/10 08:48, Elena wrote:

On 10 Giu, 23:33, bolega  wrote:

I mean ordinary people, who may want to do things with their computers
for scripting, tasks that python can do...


Lisp is not for ordinary people, Python is.


Python is for ordinary people.
Lisp is for extraordinary people.
I believe nearly all people have the potential to be extraordinary, 
but most choose to remain merely ordinary.

Sigh.

Some people believe they can fly and touch the skyyy

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


Re: Community (A Modest Proposal)

2010-06-14 Thread rantingrick
On Jun 14, 2:32 am, geremy condra  wrote:

> And now we come to the crux of the matter- you cheerlead and do
> nothing because you need to have people patting you on the back
> to know you're going the right direction.

...yes and if i ever need a swift kick in the grapes well then i know
who to call.


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


how to build with 2.4 having 2.6 as main python

2010-06-14 Thread Alexzive
Hello there,

my Mandriva has the 2.6.4 python pre-installed (in /usr/lib64/
python2.6/)
I need to install numpy 1.4 for python 2.4.3 (I installed it
separately from source on/usr/local/lib/python2.4/ )

but still typing "python" I get:
Python 2.6.4 (r264:75706, Jan  8 2010, 18:59:59)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

what to change in order to get "python" calling python 2.4.3 instead
of 2.6.4 (at least during python setup.py build)?

I suppose I need something like changing the link to /usr/local/bin/
python..
but I fear to do something bad by myself..
please help!


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


Re: Good solutions for passing around large numbers of arguments in a layered architecture?

2010-06-14 Thread Jean-Michel Pichavant

Nathan Rice wrote:

I've been running into a problem lately where I have an architecture like so:

Main class -> facade/configuration class -> low level logic class.

The main class is what the user interacts with.

The facade/config class is responsible for loading and managing the
lower level classes and providing a consistent interface to the main
class.  It can be hot swapped in/out to drastically change the
functionality of the main class.

The low level logic classes are responsible for dealing with domain primitives.


The issue I'm having is that I want advanced users to be able to pass
extra configuration information to the facade and low level classes if
need be, without the signature drastically changing with different
facade classes.  Currently, I explicitly state parameters as much as
possible at each level.  To deal with low level logic classes that
have a large number of possible options I allow the caller to pass a
dictionary of options for that class.  This leaves me with signatures
that are upwards of 15 arguments long in some cases, the majority of
them repeated in classes called from the main class.

I've tried using args/kwargs, however I found it difficult to avoid
having arguments in my signature re-ordered, and it is also a source
of bugs.

Has anyone come up with a good solution for dealing with arguments in
situations like this where you'd like to encapsulate lower level stuff
for neophyte users but make it easily available to advanced users?
  

Use objects.

def foo(a,b,c,d, moreOptions=None):
   return

class MoreOptions:
   """Write the documentation about all the available options"""
   def __init__(self):
  self.opt1=None
  self.opt2=None


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


Re: how to build with 2.4 having 2.6 as main python

2010-06-14 Thread Shashwat Anand
You can try a package : python_select

On Mon, Jun 14, 2010 at 2:00 PM, Alexzive  wrote:

> Hello there,
>
> my Mandriva has the 2.6.4 python pre-installed (in /usr/lib64/
> python2.6/)
> I need to install numpy 1.4 for python 2.4.3 (I installed it
> separately from source on/usr/local/lib/python2.4/ )
>
> but still typing "python" I get:
> Python 2.6.4 (r264:75706, Jan  8 2010, 18:59:59)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
>
> what to change in order to get "python" calling python 2.4.3 instead
> of 2.6.4 (at least during python setup.py build)?
>
> I suppose I need something like changing the link to /usr/local/bin/
> python..
> but I fear to do something bad by myself..
> please help!
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to build with 2.4 having 2.6 as main python

2010-06-14 Thread James Mills
On Mon, Jun 14, 2010 at 6:30 PM, Alexzive  wrote:
> what to change in order to get "python" calling python 2.4.3 instead
> of 2.6.4 (at least during python setup.py build)?
>
> I suppose I need something like changing the link to /usr/local/bin/
> python..
> but I fear to do something bad by myself..
> please help!

Just run the python-2.4 binary.

There will likely be a /usr/bin/python-2.4 or similar.

cheers
James

-- 
--
-- "Problems are solved by method"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mark built-in module as deprecated

2010-06-14 Thread Thomas Jollans
On 06/14/2010 02:30 AM, moerchendiser2k3 wrote:
> PyErr_WarnEx(PyExc_DeprecationWarning, "foo deprecated. use fuzz",
> 1);
> 
> But where can I write this? With Py_InitModule4 I can just
> pass a list of functions but no real execution part which
> is executed when a module is imported.

This is Python 2.x, right? I'm only familiar with Python 3 extension
writing, but there shouldn't have been that much change...

Where do you call the Py_InitModule4? I would have expected you call it
in your initfoo function - which is also a good place to issue a
warning. - the initfoo (or PyInit_foo) function is called when the
module is first imported.

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


Re: how to build with 2.4 having 2.6 as main python

2010-06-14 Thread Steven D'Aprano
On Mon, 14 Jun 2010 01:30:09 -0700, Alexzive wrote:

> what to change in order to get "python" calling python 2.4.3 instead of
> 2.6.4 (at least during python setup.py build)?

That will do bad things to your system, which will be expecting the 
system Python to be 2.6 and instead will be 2.4. You will probably find 
system tools will start to fail.

> I suppose I need something like changing the link to /usr/local/bin/
> python..
> but I fear to do something bad by myself.. please help!

Yes, that will do it, but if you do, you will probably break things. Best 
to just call the python2.4 binary directly.

If you call 

python2.4

from the command line, what happens?



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


Re: Tkinter Toplevel sizing issue (using a grid)

2010-06-14 Thread eb303
On Jun 12, 1:40 am, random joe  wrote:
> Hello all,
>
> Hi this i my first post here. I would like to create a tkinter
> toplevel window with a custom resize action based on a grid. From the
> Tk docs it say you can do this but for the life of me i cannot figure
> out how? In my app i wish for the main window to only resize in 20
> pixel "jumps" (if you will). I have tried using the toplevel.grid()
> and setgrid option and no luck!
>
> ## here is the tk doc page about 
> setGridhttp://www.tcl.tk/man/tcl/TkLib/SetGrid.htm
>
> ## here is the Tkinter method from wm class
>     def wm_grid(self,
>          baseWidth=None, baseHeight=None,
>          widthInc=None, heightInc=None):
>         """Instruct the window manager that this widget shall only be
>         resized on grid boundaries. WIDTHINC and HEIGHTINC are the
> width and
>         height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are
> the
>         number of grid units requested in Tk_GeometryRequest."""
>         return self._getints(self.tk.call(
>             'wm', 'grid', self._w,
>             baseWidth, baseHeight, widthInc, heightInc))
>     grid = wm_grid
>
> ## Here is my code.
>
> from Tkinter import *
>
> class TopWin(Tk):
>     def __init__(self):
>         Tk.__init__(self)#, setgrid=1)
>         #self.maxsize(width=50, height=50)
>         #self.minsize(width=1, height=1)
>         self.grid(10, 10, 20, 20)
>
> topwin = TopWin()
> topwin.mainloop()
>
> Please help. I am going nuts trying to make this work for three hours
> already :(

Works for me on Linux with WindowMaker, but not on the Mac. What is
your platform, and your window manager if applicable? Seems tk just
passes the options to the window manager, so if the wm decides to
ignore them, you're stuck, I'd say.

By the way, you should use more drastic values for your tests. I tried
with self.grid(10, 10, 20, 20) and I hardly saw that it worked. Using
self.grid(0, 0, 100, 100) made it obvious.

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


Re: how to build with 2.4 having 2.6 as main python

2010-06-14 Thread Alexzive
thanks guys,

the solution for me was

python2.4 setup.py install --prefix=/usr/local

cheers, AZ

On Jun 14, 11:00 am, Steven D'Aprano  wrote:
> On Mon, 14 Jun 2010 01:30:09 -0700, Alexzive wrote:
> > what to change in order to get "python" calling python 2.4.3 instead of
> > 2.6.4 (at least during python setup.py build)?
>
> That will do bad things to your system, which will be expecting the
> system Python to be 2.6 and instead will be 2.4. You will probably find
> system tools will start to fail.
>
> > I suppose I need something like changing the link to /usr/local/bin/
> > python..
> > but I fear to do something bad by myself.. please help!
>
> Yes, that will do it, but if you do, you will probably break things. Best
> to just call the python2.4 binary directly.
>
> If you call
>
> python2.4
>
> from the command line, what happens?
>
> --
> Steven

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


Re: C interpreter in Lisp/scheme/python

2010-06-14 Thread Albert van der Horst
In article ,
bolega   wrote:
>I am trying to compare LISP/Scheme/Python for their expressiveness.
>
>For this, I propose a vanilla C interpreter. I have seen a book which
>writes C interpreter in C.
>
>The criteria would be the small size and high readability of the code.
>
>Are there already answers anywhere ?
>
>How would a gury approach such a project ?

He would have his 10 year LISP sink in, meditate for 10 days and
start from scratch with a typical LISP approach.

He would have his 10 year Algol68 sink in, meditate for 10 days and
start from scratch with a typical Algol68 approach.
(Scheme is not different enough from LISP, to make this interesting.
Hey Scheme *is* a dialect of LISP.)

He would have his 10 year Python sink in, meditate for 10 days and
start from scratch with a typical Python approach.

Maybe he would code "one to throw away".

The outcome would be extremely interesting, but ...

>
>Bolega

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
alb...@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

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


configuration setting for python server

2010-06-14 Thread shanti bhushan
I want to update the configuration file for python server ,but i am
not able to locate the python configuration file.
Please guide me in this respect.

I am using a python web server
This is the code for it

---
import string,cgi,time
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
#import pri
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
try:
if self.path.endswith(".html"):
f = open(curdir + sep + self.path) #self.path has /
test.html
#note that this potentially makes every file on your computer readable
by the internet
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(f.read())
f.close()
return
if self.path.endswith(".esp"):   #our dynamic content
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write("hey, today is the" +
str(time.localtime()[7]))
self.wfile.write(" day in the year " +
str(time.localtime()[0]))
return

return

except IOError:
self.send_error(404,'File Not Found: %s' % self.path)

def do_POST(self):
global rootnode
try:
ctype, pdict =
cgi.parse_header(self.headers.getheader('content-type'))
if ctype == 'multipart/form-data':
query=cgi.parse_multipart(self.rfile, pdict)
self.send_response(301)

self.end_headers()
upfilecontent = query.get('upfile')
print "filecontent", upfilecontent[0]
self.wfile.write("POST OK.");
self.wfile.write(upfilecontent[0]);

except :
pass
def main():
try:
server = HTTPServer(('', 80), MyHandler)
print 'started httpserver...'
server.serve_forever()
except KeyboardInterrupt:
print '^C received, shutting down server'
server.socket.close()
if __name__ == '__main__':
main()


sample Configuration file for Apache server


ServerAdmin webmas...@localhost
DocumentRoot /var/www/

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default
start page
# in /apache2-default/, but still have / go to the
right place
#RedirectMatch ^/$ /apache2-default/


I want to update the configuration file for python server ,but i am
not able to locate the python configuration file.
Please guide me in this respect.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: a +b ?

2010-06-14 Thread Mark Leander
(pytyhon 2.x code):
print input('Enter expression: ')



Example uses:
Enter expression: 3+4
7
Enter expression: 1+2+3+4+5
15
Enter expression: 7*18
126
Enter expression: 2**19-1
524287

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


Re: a +b ?

2010-06-14 Thread cristeto1981



alex23 wrote:
> 
> [email protected] wrote:
>> Fore!
>>
>>     print(sum(map(int, input('enter two numbers: ').split(
> 
> Well, I _was_ trying to stick to Steven's more simple map-less form :)
> 
> (Although I have to say, I have little sympathy for Steven's
> hypothetical "new programmer who isn't familiar with map and reduce".
> Python isn't PHP, its built-ins are nowhere near as exhaustive,
> something like 80ish vs 2000+ functions? Not exactly a huge lookup
> burden.)
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
> 
Whoa. This forum is kinda confusing. Where do i ask questions about phytons?
Great threab by the way. :)

-
[url=http://crosspromotion.wizard4u.com/]joint ventures[/url]

-- 
View this message in context: 
http://old.nabble.com/a-%2Bb---tp28855796p28878155.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Convert .doc to .pdf

2010-06-14 Thread Thales
Good morning,

I need to convert some files from .doc to .pdf. I've googled it a
little bit and all the solutions I've found used the OpenOffice API,
but I can't use it.

Anybody knows a library that I can use to do it?

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


Re: C interpreter in Lisp/scheme/python

2010-06-14 Thread Bruno Desthuilliers




On Sun, Jun 13, 2010 at 4:07 PM, bolega  wrote:

I am trying to compare LISP/Scheme/Python for their expressiveness.


Scheme is actually a lisp, isn't it ?


For this, I propose a vanilla C interpreter. I have seen a book which
writes C interpreter in C. 
The criteria would be the small size and high readability of the code.




Readability is partly function of the reader, so I fail to see how you 
define any objective metrics here.


Also, "small size" and "high readability" can easily conflict with each 
other. I pretty often rewrite (my own) one-liners to as many lines as 
necessary to make the code more readable / maintainable.



How would a gury approach such a project ?


Can't tell. Maybe you should ask one ?

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


Re: a +b ?

2010-06-14 Thread Mark Dickinson
On Jun 13, 5:46 pm, [email protected] wrote:
> On 04:25 pm, [email protected] wrote:
>
>
>
> >Steven D'Aprano  wrote:
> >>No, I think your code is very simple. You can save a few lines by
> >>writing
> >>it like this:
>
> >>s = input('enter two numbers: ')
> >>t = s.split()
> >>print(int(t[0]) + int(t[1]))  # no need for temporary variables a and
> >>b
>
> >Not that we're playing a round of code golf here, but this is a
> >slightly nicer take on your version:
>
> >one, two = input('enter two numbers: ').split()
> >print(int(one) + int(two))
>
> >I like names over subscripts, but that's just me :)
>
> Fore!
>
>     print(sum(map(int, input('enter two numbers: ').split(
>
> Jean-Paul

58 characters.  You could remove the space after 'int' to make it 57.
Here's an evil 56-character version...

print(eval(input('enter two numbers: ').replace(*' +')))

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


Re: efficiently create and fill array.array from C code?

2010-06-14 Thread Hrvoje Niksic
Thomas Jollans  writes:

> 1. allocate a buffer of a certain size
> 2. fill it
> 3. return it as an array.

The fastest and more robust approach (I'm aware of) is to use the
array.array('typecode', [0]) * size idiom to efficiently preallocate the
array, and then to get hold of the pointer pointing into array data
using the buffer interface.

Please send a message to [email protected], a SIG specializing in the
Python/C API, if you need more help with implementing this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: efficiently create and fill array.array from C code?

2010-06-14 Thread Thomas Jollans
On 06/14/2010 01:18 PM, Hrvoje Niksic wrote:
> Thomas Jollans  writes:
> 
>> 1. allocate a buffer of a certain size
>> 2. fill it
>> 3. return it as an array.
> 
> The fastest and more robust approach (I'm aware of) is to use the
> array.array('typecode', [0]) * size idiom to efficiently preallocate the
> array, and then to get hold of the pointer pointing into array data
> using the buffer interface.

Ah, create a single-element array, and multiply that. That's not a bad
approach, the overhead is probably equivalent to what I have now:
currently, I create an uninitialized(!) bytes of the correct size, fill
it myself, and initialize an array from that. Both approaches have the
overhead of creating one extra Python object (bytes/single-element
array) and either copying one element over and over, or memcpy'ing the
whole buffer.

> 
> Please send a message to [email protected], a SIG specializing in the
> Python/C API, if you need more help with implementing this.

I'll probably subscribe to that list, thanks for the hint.

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


Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Vincent Davis
On Sun, Jun 13, 2010 at 6:24 PM, Irmen de Jong  wrote:
> On 14-6-2010 1:19, Vincent Davis wrote:
>>
>> I just installed 2.6 and 3.1 from current maintenance source on Mac
>> OSx. When I am running as an interactive terminal session the up arrow
>> does not scroll thought the history of the py commands I have entered
>> I just get ^[[A. When I install from a compiled source it works fine.
>> Whats the fix for this?
>>
>> Thanks
>> Vincent
>
> I'm guessing you don't have the readline module.
>
> Compile and install GNU Readline, then type 'make' again in your Python
> source tree. It should now no longer report a missing 'readline' module.

What exactly do you mean by "'make' again in your Python source tree."

Thanks
Vincent

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


Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Thomas Jollans
On 06/14/2010 02:37 PM, Vincent Davis wrote:
> On Sun, Jun 13, 2010 at 6:24 PM, Irmen de Jong  
> wrote:
>> On 14-6-2010 1:19, Vincent Davis wrote:
>>>
>>> I just installed 2.6 and 3.1 from current maintenance source on Mac
>>> OSx. When I am running as an interactive terminal session the up arrow
>>> does not scroll thought the history of the py commands I have entered
>>> I just get ^[[A. When I install from a compiled source it works fine.
>>> Whats the fix for this?
>>>
>>> Thanks
>>> Vincent
>>
>> I'm guessing you don't have the readline module.
>>
>> Compile and install GNU Readline, then type 'make' again in your Python
>> source tree. It should now no longer report a missing 'readline' module.
> 
> What exactly do you mean by "'make' again in your Python source tree."

You installed Python from source didn't you? At some point you'll have
to invoke make, unless some tool did that for you.

Anyway, make sure readline is installed, and then recompile Python.

> 
> Thanks
> Vincent
> 
>>
>> -irmen
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>

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


Re: WebBrowserProgramming [was: GUIs - A Modest Proposal]

2010-06-14 Thread lkcl
On Jun 13, 4:52 pm, [email protected] (Aahz) wrote:
> In article ,
>
> lkcl   wrote:
>
> > i'm recording all of these, and any other web browser manipulation
> >technology that i've ever encountered, here:
>
> >http://wiki.python.org/moin/WebBrowserProgramming
>
> Neat!  Why aren't you including Selenium/Windmill?

 .  cos i'd nver not in a miiillion squillion years heard of
it.  until now.  loovelyy.  ok.  added selenium - now to look up
windmill.

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


biopython

2010-06-14 Thread madhuri vio
i cudnt run this!!

and this was the error occured

for seq_record in SeqIO.parse("ls_MTbH37Rv.fasta","fasta"):
... print seq_record.id
... print repr(seq_record.seq)
... print len(seq_record)
...
Traceback (most recent call last):
  File "", line 1, in 
  File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 342,
in parse
raise TypeError("Need a file handle, not a string (i.e. not a
filename)")
TypeError: Need a file handle, not a string (i.e. not a filename)


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


Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Vincent Davis
On Mon, Jun 14, 2010 at 6:49 AM, Thomas Jollans  wrote:
> On 06/14/2010 02:37 PM, Vincent Davis wrote:
>> On Sun, Jun 13, 2010 at 6:24 PM, Irmen de Jong  
>> wrote:
>>> On 14-6-2010 1:19, Vincent Davis wrote:

 I just installed 2.6 and 3.1 from current maintenance source on Mac
 OSx. When I am running as an interactive terminal session the up arrow
 does not scroll thought the history of the py commands I have entered
 I just get ^[[A. When I install from a compiled source it works fine.
 Whats the fix for this?

 Thanks
 Vincent
>>>
>>> I'm guessing you don't have the readline module.
>>>
>>> Compile and install GNU Readline, then type 'make' again in your Python
>>> source tree. It should now no longer report a missing 'readline' module.
>>
>> What exactly do you mean by "'make' again in your Python source tree."
>
> You installed Python from source didn't you? At some point you'll have
> to invoke make, unless some tool did that for you.
>
> Anyway, make sure readline is installed, and then recompile Python.

So I should run
./configure
make install
again?
Will this overwrite other py packages I have installed?

Vincent



>
>>
>> Thanks
>> Vincent
>>
>>>
>>> -irmen
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: biopython

2010-06-14 Thread Thomas Jollans
On 06/14/2010 02:59 PM, madhuri vio wrote:
> i cudnt run this!!

Take a deep breath, and read the error message. It's very informative,
and tells you exactly what the problem is, and how to fix it, if you'd
just try to understand it.

It would be much appreciated if you had a look at
http://www.catb.org/~esr/faqs/smart-questions.html
specifically the section "Before you ask", ideally the whole article.

> 
> and this was the error occured
> 
> for seq_record in SeqIO.parse("ls_MTbH37Rv.fasta","fasta"):
> ... print seq_record.id 
> ... print repr(seq_record.seq)
> ... print len(seq_record)
> ...
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line
> 342, in parse
> raise TypeError("Need a file handle, not a string (i.e. not a
> filename)")
> TypeError: Need a file handle, not a string (i.e. not a filename)

I think this is a fabulous error message. The programmer of this module
actually anticipated the mistake you were going to make. Good for you.

> 
> 
> -- 
> madhuri :)
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C interpreter in Lisp/scheme/python

2010-06-14 Thread fortunatus
On Jun 13, 7:07 pm, bolega  wrote:
> I am trying to compare LISP/Scheme/Python for their expressiveness.
>
> For this, I propose a vanilla C interpreter. I have seen a book which
> writes C interpreter in C.
>
> The criteria would be the small size and high readability of the code.
>
> Are there already answers anywhere ?
>
> How would a gury approach such a project ?
>
> Bolega

Holy cow has this gone off topic!  To OP - start writing a C context
free grammar of a subset of C (arithmetic expressions IMHO are the
historical root of C and a good place to start in any case), start
writing a parser of a subset of your subset grammar (in a lisp of your
chioce - Scheme and CL for instance are going to be pretty much
equivalent in this task), and really the rest will be obvious...

I'd go that far before posting on the topic again...
-- 
http://mail.python.org/mailman/listinfo/python-list


subprocess.Popen()/call() and appending file

2010-06-14 Thread hiral
Hi,

Do we have any facility to append file from Popen()/call(); see below
example...

1 import subprocess
2 f=open('log', 'w')
3 ...# writing some log-into into log file
4 p = subprocess.Popen(cmd, stdout=f, stderr=f) # (Q)
5 ...# do remaining stuff

Q: At line# 4, the output of the 'cmd' will wipe-out everything in
'log' file. So to avoid this do we have any mechanism to append into
the existing file from subprocess.

Currently I am doing following...
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
o, e = p.communicate()
print >> log, o
print >> log, e

Pleaese let me know if there is any better mechanism.

Thank you in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


subprocess.Popen()/call() and appending file

2010-06-14 Thread hiral
Hi,

Do we have any facility to append file from Popen()/call(); see below
example...

1 import subprocess
2 f=open('log', 'w')
3 ...# writing some log-into into log file
4 p = subprocess.Popen(cmd, stdout=f, stderr=f) # (Q)
5 ...# do remaining stuff

Q: At line# 4, the output of the 'cmd' will wipe-out everything in
'log' file. So to avoid this do we have any mechanism to append into
the existing file from subprocess.

Currently I am doing following...
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
o, e = p.communicate()
print >> log, o
print >> log, e

Pleaese let me know if there is any better mechanism.

Thank you in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


pyqt4 vs pygtk2 vs pyjamas (was: GUIs - A Modest Proposal)

2010-06-14 Thread lkcl
On Jun 13, 3:43 pm, Michael Torrie  wrote:
> On 06/13/2010 05:29 AM, lkcl wrote:
>
> >  really?  drat.  i could have done with knowing that at the time.
> > hmmm, perhaps i will return to the pyqt4 port after all.
>
> We're now wandering well off-topic here, but then again this thread was
> never really on any particular topic.

 :)

> I have to say I'm really confused as to your issues with GTK and Qt.

 yeahh... it's kinda necessary to have done complex HTML/CSS-based
layouts (or better yet, an equivalent, e.g. using declarative python-
driven widget-enhanced DOM programming) to appreciate the perspective
i'm coming from.

 the "rules" for table layouts in browsers are (aside from their
technical limitations) incredibly powerful, flexible and ultimately
very very forgiving of users' lack of knowledge and experience.

 use of - reliance upon - these rules results in quite a bit less code
(both for the pyjamas ui widget developers to have to write, and also
for the users/developers of the pyjamas widget set).

 so my expectations were that i should be able to do the same sort of
thing with GTK or QT, and... it just wasn't happening.

 to highlight this further, i should point out that i looked up paul
bonser's browser-written-in-python, called pybrowser:
   http://git.paulbonser.com/

 in it, you can find some pseudo-code for table/div which he's
obviously looked up somewhere, presumably in W3C DOM specifications.
he's already successfully implemented  rules, but the 
rules he left for another time.

 i tried implementing them: i cannot make head nor tail of the
algorithm/pseudocode :)  it's _that_ complex a recursive interaction,
between block-based and flowing layout objects.

 i mention this because to even _remotely_ attempt to accurately re-
create pyjamas desktop using Qt4 or Gtk2, it would be necessary,
ultimately, to implement the same browser-based recursive layout
algorithm that is already in existing web browsers.

 by doing that, effectively i would actually be creating the vast
majority of the functionality of a web browser... in python!

 and rather than do that from scratch, i would actually be better off
either helping (or waiting for) paul to work on pybrowser, or recover
and work on grailbrowser (which i've begun doing - it now runs under
python 2.4 and just needs all its regular expressions converted from
regex to sre in order to run under python2.5+) 
http://github.com/lkcl/grailbrowser
...

 ... and then using _that_ as the basis for another pyjamas port, by
adding and using W3C DOM functions (which don't exist in grailbrowser
sadly).  paul bonser's work is actually the better underlying
framework: he's already added the W3C DOM TR1 through to TR3
properties and functions, such as getElementById(), appendChild(),
offsetWidth and so on, but grailbrowser is the better _actual_ browser
on account of it actually... working! :)

 in a delicious piece of irony, which brings us back full circle to
the original discussion, python/tk-haters will howwl with fury to
learn that grailbrowser is a fully-functioning 35,000-line python/tk
application :)


> I've seen and done all kinds of fancy widget layouts in Qt and have
> *never* had to subclass layout.  If you think you need to subclass
> QLayout, most of the time you're doing it wrong.  You are familiar with
> how the vertical and horizontal layouts and spacers work in Qt, aren't
> you?

 yes.

> Sometimes you need a grid for a table or the specialized form
> grid.   But other than that you want a dynamically-sizing layouts most
> of the time.  And Qt's Vertical and Horizontal layouts do that.

 sadly, not to the kind of recursive / child _and_ parent inter-
dependent level as browser layouts that would make it a simple viable
alternative.


> I'm also confused by your claim that GTK lacks the layout widgets you
> need as well.  GTK has the GtkHBox layout class which acts much like
> your  tag.  Anything to pack in the hbox is automatically layed
> out in a dynamicially-resizing way.

 i did map pyjamas UI HorizontalPanel directly onto GtkHBox, and so
on: i got a long long way, very very quickly by doing that.

 perhaps... perhaps if you have time, if you could take a look at the
pyjd-gtk2 and/or the pyjd-qt4 ports, you might be able to point out
where i'm going wrong.  they're both here:

 http://github.com/lkcl/pyjamas-desktop

 they're a bit old, but are functional (install python-gtkhtml2 even
to get the pyjd-qt4 port to run, there's some code still accidentally
left in) and you run them with "hello_loader.py" by hacking in the
appropriate class - you'll see what i mean.

> >  excellent!  that actually makes it worthwhile carrying on.  the only
> > other thing that needs solving is that RichText is forced to have its
> > width and height set.  but it mayyy be possible to create an
> > appropriate QLayout derivative: i'll have to see.
>
> Again I'm confused here.  I just created a little Window in Qt Designer
> and was able to get my RichText

biopython

2010-06-14 Thread madhuri vio
i have tried this still unable to get an output

from Bio import Seq
from Bio import SeqIO
from Bio import SeqRecord

for seq_record in SeqIO.read("ls_MTbH37Rv.fasta", "fasta"):
print seq_record.id
print repr(seq_record.seq)
print len(seq_record)

python bio.py
Traceback (most recent call last):
  File "bio.py", line 10, in 
for seq_record in SeqIO.read("ls_MTbH37Rv.fasta", "fasta"):
  File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 433,
in read
iterator = parse(handle, format, alphabet)
  File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 342,
in parse
raise TypeError("Need a file handle, not a string (i.e. not a
filename)")
TypeError: Need a file handle, not a string (i.e. not a filename)
-- 
madhuri :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Convert .doc to .pdf

2010-06-14 Thread Marco Nawijn
On 14 jun, 13:19, Thales  wrote:
> Good morning,
>
> I need to convert some files from .doc to .pdf. I've googled it a
> little bit and all the solutions I've found used the OpenOffice API,
> but I can't use it.
>
> Anybody knows a library that I can use to do it?
>
> Thanks

What about using the win32 API and use the free  PDFCreator (http://
sourceforge.net/projects/pdfcreator/) PDF printer?

This should be very simple (code untested, but should be roughly OK):
- Instantiate MS/Word application
  >> from win32com.client import Dispatch
  >> app = Dispatch('Word.Application')
- Open your document
  >> doc = app.Documents.Open("demo.doc")
- Print to PDF
  >> app.ActivePrinter = "PDFCreator"
  >> app.PrintOut()

The PrintOut call is a little tricky. I normally try to decode and
guess the Python call from the corresponding VisualBasic code I record
with the macro recording facility. I know there are more sophisticated
methods out there, but I never tried them.

Regards,

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


Re: Python OpenSSL library

2010-06-14 Thread Antoine Pitrou
On Sun, 13 Jun 2010 14:13:32 -0700
geremy condra  wrote:
> On Sun, Jun 13, 2010 at 1:29 PM, astral
>  wrote:
> > I am looking for Python OpenSSL library, for Python version 2.5.4 (on
> > Windows)
> > Which does not require to install Cygwin package. Need just to decrypt file,
> > then uninstall library.
> 
> Evpy[1] is designed to be a very easy-to-use interface to OpenSSL,
> although it is by design limited to doing things the right way, so it
> may not meet your needs.

How about contributing to the standard hashlib and ssl modules? Is
there anything there that goes in the way, e.g. design-wise?

Regards

Antoine.


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


Re: subprocess.Popen()/call() and appending file

2010-06-14 Thread Kushal Kumaran
On Mon, Jun 14, 2010 at 7:01 PM, hiral  wrote:
> Hi,
>
> Do we have any facility to append file from Popen()/call(); see below
> example...
>
> 1 import subprocess
> 2 f=open('log', 'w')
> 3 ...# writing some log-into into log file
> 4 p = subprocess.Popen(cmd, stdout=f, stderr=f) # (Q)
> 5 ...# do remaining stuff
>
> Q: At line# 4, the output of the 'cmd' will wipe-out everything in
> 'log' file. So to avoid this do we have any mechanism to append into
> the existing file from subprocess.
>
> Currently I am doing following...
> p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
> o, e = p.communicate()
> print >> log, o
> print >> log, e
>
> Pleaese let me know if there is any better mechanism.
>

It is not actually wiping out the old contents.  You might be running
into buffering issues.  Explicitly flushing should help when switching
between the high level IO functions provided by file objects and the
low level IO that subprocess uses.  Do a f.flush() before your
subprocess.Popen call.

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


Re: biopython

2010-06-14 Thread Mark Lawrence

On 14/06/2010 15:02, madhuri vio wrote:

i have tried this still unable to get an output

from Bio import Seq
from Bio import SeqIO
from Bio import SeqRecord

for seq_record in SeqIO.read("ls_MTbH37Rv.fasta", "fasta"):
 print seq_record.id
 print repr(seq_record.seq)
 print len(seq_record)

python bio.py
Traceback (most recent call last):
   File "bio.py", line 10, in
 for seq_record in SeqIO.read("ls_MTbH37Rv.fasta", "fasta"):
   File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 433,
in read
 iterator = parse(handle, format, alphabet)
   File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 342,
in parse
 raise TypeError("Need a file handle, not a string (i.e. not a
filename)")
TypeError: Need a file handle, not a string (i.e. not a filename)


Please read this, it'll show you your mistake.

http://www.biopython.org/wiki/SeqIO#Sequence_Input

Regards.

Mark Lawrence.

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


Re: GUIs - A Modest Proposal

2010-06-14 Thread lkcl
On Jun 13, 2:34 pm, Stephen Hansen  wrote:
> On 6/13/10 4:29 AM, lkcl wrote:
>
> >  it's in fact how the entire pyjamas UI widget set is created, by
> > doing nothing more than direct manipulation of bits of DOM and direct
> > manipulation of the style properties.  really really simple.
>
> Did you just call DOM manipulation simple with a straight face? I don't
> think I've ever seen that before.

 *lol* - wait for it: see below.  summary: once you start using high-
level widgets: yes.  without such, yeah you're damn right.

> HTML+CSS have some very strong advantages. Simplicity is not one of
> them. Precision web design these days is a dark art. (Go center an image
> vertically and horizontally in an arbitrary sized field!)

 stephen, _thank_ you - that was _exactly_ why i decided i flat-out
was NEVER going to do "plain" HTML/CSS programming _ever_ again.  i
spent twwoo weeks trying to do exactly this (well, it was 7
boxes, not an image) - and i failed.

 i succeeded on firefox to get the boxes centred, but with IE, when
you resized the screen, the bloody boxes went off the top!  they were
so "centred" that they went off the top of the screen!  and the bloody
idiotic IE team forgot that you can't scroll _up_ off the top of the
screen :)

 in desperation, i blindly wandered into pyjamas, and went "ye" -
and within 50 minutes i had converted my site to do exactly this.

 you can see the results here: http://lkcl.net and the main code is
here:
http://lkcl.net/site_code/index.py

 the relevant (crucial) function is the onWindowResized function which
gets called because of this: Window.addWindowResizeListener(self)


   def onWindowResized(self, width, height):

self.toprow.removeFromParent()
self.middlerow.removeFromParent()
self.bottomrow.removeFromParent()
self.html.removeFromParent()
self.ads.removeFromParent()

self.create_layout()

 the create_layout function basically does this:

width = Window.getClientWidth()

if width > 800:

toprow = HorizontalPanel()
middlerow = HorizontalPanel()
bottomrow = HorizontalPanel()

elif width > 640:

# different types of layout panels

else:

# utterly skinny vertical-only panels

 those three panels are added into another panel which has 100% width
and 100% height, and has "centre" properties attached to its cells;
voila, the boxes always sit in the middle of the screen.  when the
screen is too big for the 100% height outer panel, the boxes "push"
against the constraints of their outer panel, thus forcing the screen
to become bigger and thus automatically a vertical scroll-bar is
added.  for some browsers this results in another onWindowResize
notification and for some it doesn't (eurgh) - but that's another
story :)

 this is what i was referring to in another message... rats, can't
find it now: it was the one asking about why qt4 and gtk2 layouts
don't cut it, and i explained about the recursive complex child-parent
interaction rules between DOM objects.


 but - allow me to write a quick app which does what you ask:

 from pyjamas.ui.Image import Image
 from pyjamaas.ui.AbsolutePanel import AbsolutePanel
 from pyjamaas.ui import RootPanel
 from pyjamas import Window

 class Thingy:
def __init__(self):
   self.panel = AbsolutePanel(Width="100%", Height="100%")
   self.image = Image("http://python.org/python.png";)
   self.panel.add(image, 0, 0) # add in top-left just for now

   # make a "fake" initial window resize notification
   self.onWindowResized(Window.getClientWidth(),
Window.getClientHeight())
   Window.addResizeListener(self)

def onWindowResized(self, width, height):
   """ ok - ignore the image's width and height
   because you have to wait for it to load, first,
   and that means doing an onImageLoad async notification
   and this is supposed to be a short demo!
"""
   self.panel.setWidgetPosition(self.image, width/2, height/2)

  RootPanel.add(Thingy())


and... yes, honest to god, that's a web application.  _really_ a web
application.  not an HTML/CSS one, but it's still a web application -
and not a single line of javascript or even DOM manipulation in sight.

if you had to do that as javascript, it would be... eurgh - 300 lines
of unreadable crap?  if you had to do that *without the pyjamas ui
widget set* it would be ... ergh... 150 lines of barely tolerable
crap.  but with the AbsolutePanel class, and the Image widget, and the
neat "wrapping" of event handling?  pffh - complete doddle.

i think... this is what's making pyjamas so hard for people to grasp.
it sits literally in the middle between _both_ technologies: web
browsers which have a reputation for being utterly utterly useless and
"hard to program" because any real programmer wouldn't _dream_ of
calling HTML an actual programming language; and on the other side
there's p

File descriptor to file object

2010-06-14 Thread Nathan Huesken
Hi,

tempfile.mkstemp returns a file name and a file descriptor (as returned
by os.open). Can I somehow convert this descriptor to a file object?

Thanks!
Nathan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File descriptor to file object

2010-06-14 Thread Thomas Jollans
On 06/14/2010 04:57 PM, Nathan Huesken wrote:
> Hi,
> 
> tempfile.mkstemp returns a file name and a file descriptor (as returned
> by os.open). Can I somehow convert this descriptor to a file object?

the builtin open function should work.

http://docs.python.org/py3k/library/functions.html#open

Also, it's probably better to just use a tempfile.TemporaryFile or
tempfile.NamedTemporaryFile instead of directly using mkstemp.

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


Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Benjamin Kaplan
On Mon, Jun 14, 2010 at 6:09 AM, Vincent Davis  wrote:
> On Mon, Jun 14, 2010 at 6:49 AM, Thomas Jollans  wrote:
>> On 06/14/2010 02:37 PM, Vincent Davis wrote:
>>> On Sun, Jun 13, 2010 at 6:24 PM, Irmen de Jong  
>>> wrote:
 On 14-6-2010 1:19, Vincent Davis wrote:
>
> I just installed 2.6 and 3.1 from current maintenance source on Mac
> OSx. When I am running as an interactive terminal session the up arrow
> does not scroll thought the history of the py commands I have entered
> I just get ^[[A. When I install from a compiled source it works fine.
> Whats the fix for this?
>
> Thanks
> Vincent

 I'm guessing you don't have the readline module.

 Compile and install GNU Readline, then type 'make' again in your Python
 source tree. It should now no longer report a missing 'readline' module.
>>>
>>> What exactly do you mean by "'make' again in your Python source tree."
>>
>> You installed Python from source didn't you? At some point you'll have
>> to invoke make, unless some tool did that for you.
>>
>> Anyway, make sure readline is installed, and then recompile Python.
>
> So I should run
> ./configure
> make install
> again?
> Will this overwrite other py packages I have installed?
>
> Vincent
>

That should be
./configure
make
make install

You missed a rather important step. I don't think it will overwrite
anything except for the files that are part of Python itself, but I'm
not completely sure.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Thomas Jollans
On 06/14/2010 03:09 PM, Vincent Davis wrote:
> On Mon, Jun 14, 2010 at 6:49 AM, Thomas Jollans  wrote:
>> On 06/14/2010 02:37 PM, Vincent Davis wrote:
>>> On Sun, Jun 13, 2010 at 6:24 PM, Irmen de Jong  
>>> wrote:
 On 14-6-2010 1:19, Vincent Davis wrote:
>
> I just installed 2.6 and 3.1 from current maintenance source on Mac
> OSx. When I am running as an interactive terminal session the up arrow
> does not scroll thought the history of the py commands I have entered
> I just get ^[[A. When I install from a compiled source it works fine.
> Whats the fix for this?
>
> Thanks
> Vincent

 I'm guessing you don't have the readline module.

 Compile and install GNU Readline, then type 'make' again in your Python
 source tree. It should now no longer report a missing 'readline' module.
>>>
>>> What exactly do you mean by "'make' again in your Python source tree."
>>
>> You installed Python from source didn't you? At some point you'll have
>> to invoke make, unless some tool did that for you.
>>
>> Anyway, make sure readline is installed, and then recompile Python.
> 
> So I should run
> ./configure
> make install
> again?
> Will this overwrite other py packages I have installed?

It'll do exactly the same thing as it did the last time.
It won't overwrite anything not part of Python itself.

> 
> Vincent
> 
> 
> 
>>
>>>
>>> Thanks
>>> Vincent
>>>

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

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

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


Re: how to build with 2.4 having 2.6 as main python

2010-06-14 Thread Benjamin Kaplan
On Mon, Jun 14, 2010 at 3:09 AM, Alexzive  wrote:
> thanks guys,
>
> the solution for me was
>
> python2.4 setup.py install --prefix=/usr/local
>
> cheers, AZ
>

Don't do that! Like Steven said, you'll kill your system that way.
Lots of programs in Linux use Python and those programs expect
/usr/bin/env python to map to python2.6. Other versions of Python
should be referenced by the version: so python2.4 for Python 2.4,
python3 or python3.1 if you decide to install Python 3.1.

> On Jun 14, 11:00 am, Steven D'Aprano  cybersource.com.au> wrote:
>> On Mon, 14 Jun 2010 01:30:09 -0700, Alexzive wrote:
>> > what to change in order to get "python" calling python 2.4.3 instead of
>> > 2.6.4 (at least during python setup.py build)?
>>
>> That will do bad things to your system, which will be expecting the
>> system Python to be 2.6 and instead will be 2.4. You will probably find
>> system tools will start to fail.
>>
>> > I suppose I need something like changing the link to /usr/local/bin/
>> > python..
>> > but I fear to do something bad by myself.. please help!
>>
>> Yes, that will do it, but if you do, you will probably break things. Best
>> to just call the python2.4 binary directly.
>>
>> If you call
>>
>> python2.4
>>
>> from the command line, what happens?
>>
>> --
>> Steven
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Thomas Jollans
>>> Anyway, make sure readline is installed, and then recompile Python.
>>
>> So I should run
>> ./configure
>> make install
>> again?
>> Will this overwrite other py packages I have installed?
>>
>> Vincent
>>
> 
> That should be
> ./configure
> make
> make install
>
> You missed a rather important step.


Makefiles being dependency based means that, strictly speaking, "make"
isn't necessary, as it's (almost always) implied by "make install"

However, you should usually work like this:

$ ./configure
$ make
$ sudo make install

run configure and make as user, and ONLY make install as root, as only
installing, not configuring and building, require administrative
privileges. I'm not sure OSX handles these things, but I doubt they'd
have removed the UNIX multi-user-ness.

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


How to print via python on windows

2010-06-14 Thread loial
What is the easiest way to send a text file to a networked printer
from a python script running on windows?

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


biopython

2010-06-14 Thread madhuri vio
i am still waiting for some help.
-- 
madhuri :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Will and Abe's "Guide to Pyjamas"

2010-06-14 Thread lkcl
>  oh look - there's a common theme, there: "web technology equals
> useless" :)

this is getting sufficiently ridiculous, i thought it best to
summarise the discussions of the past few days, from the perspective
of four-year-olds:

http://pyjs.org/will_and_abe_guide_to_pyjamas.html

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


Re: How to print via python on windows

2010-06-14 Thread Tim Golden

On 14/06/2010 16:31, loial wrote:

What is the easiest way to send a text file to a networked printer
from a python script running on windows?


  http://timgolden.me.uk/python/win32_how_do_i/print.html

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


Re: biopython

2010-06-14 Thread Benjamin Kaplan
On Mon, Jun 14, 2010 at 8:45 AM, madhuri vio  wrote:
>
> i am still waiting for some help.
> --
> madhuri :)
>

You already have your help-  the traceback tells you everything you
need to know. If you don't understand what the traceback is saying,
come back here and specifically ask about the part you have trouble
with. But we do expect that you will at least attempt to solve this on
your own before coming here.

>Traceback (most recent call last):
>  File "bio.py", line 10, in 
>for seq_record in SeqIO.read("ls_MTbH37Rv.fasta", "fasta"):
>  File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 433, in 
> read
>iterator = parse(handle, format, alphabet)
>  File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 342, in 
> parse
>raise TypeError("Need a file handle, not a string (i.e. not a filename)")
>TypeError: Need a file handle, not a string (i.e. not a filename)

Now, what does the traceback say you are doing wrong? What are you
handing the function and what should you be handing the function?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Convert .doc to .pdf

2010-06-14 Thread Thales
On 14 jun, 11:01, Marco Nawijn  wrote:
> On 14 jun, 13:19, Thales  wrote:
>
> > Good morning,
>
> > I need to convert some files from .doc to .pdf. I've googled it a
> > little bit and all the solutions I've found used the OpenOffice API,
> > but I can't use it.
>
> > Anybody knows a library that I can use to do it?
>
> > Thanks
>
> What about using the win32 API and use the free  PDFCreator (http://
> sourceforge.net/projects/pdfcreator/) PDF printer?
>
> This should be very simple (code untested, but should be roughly OK):
> - Instantiate MS/Word application
>   >> from win32com.client import Dispatch
>   >> app = Dispatch('Word.Application')
> - Open your document
>   >> doc = app.Documents.Open("demo.doc")
> - Print to PDF
>   >> app.ActivePrinter = "PDFCreator"
>   >> app.PrintOut()
>
> The PrintOut call is a little tricky. I normally try to decode and
> guess the Python call from the corresponding VisualBasic code I record
> with the macro recording facility. I know there are more sophisticated
> methods out there, but I never tried them.
>
> Regards,
>
> Marco

Thanks for your help Marco, but it has to work on linux, not on
windows. Is possible to import this win32com on linux systems? How?

Thank you!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will and Abe's "Guide to Pyjamas"

2010-06-14 Thread lkcl
On Jun 14, 3:53 pm, lkcl  wrote:

> this is getting sufficiently ridiculous, i thought it best to
> summarise the discussions of the past few days, from the perspective
> of four-year-olds:

 not, of course, to imply in _any way_, that anyone but myself on
comp.lang.python is juvenile and/or delinquent, and not of course, to
imply that any four-year-old is in any way juvenile and/or
delinquent.  bring on the political correctness...

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


Re: GUIs - A Modest Proposal

2010-06-14 Thread Stephen Hansen
On 6/14/10 7:15 AM, lkcl wrote:
> On Jun 13, 2:34 pm, Stephen Hansen  wrote:
>> On 6/13/10 4:29 AM, lkcl wrote:
>>
>>>  it's in fact how the entire pyjamas UI widget set is created, by
>>> doing nothing more than direct manipulation of bits of DOM and direct
>>> manipulation of the style properties.  really really simple.
>>
>> Did you just call DOM manipulation simple with a straight face? I don't
>> think I've ever seen that before.
> 
>  *lol* - wait for it: see below.  summary: once you start using high-
> level widgets: yes.  without such, yeah you're damn right.


See, the thing is, my background is a little bit mixed. I've produced
complex yet approachable and dynamic interfaces for both traditional
client applications, and similar level user interfaces for the web. In
the latter case, I don't do HTML/CSS programming anymore as you describe
it, but JavaScript-based building out of the application.

And the recursive flow of the DOM is powerful (and in some cases,
superbly suited to a task), but I maintain fully: at no point is it
easy, simple, or even entirely comprehensible to most average geeks.
Traditional GUI models vs the web layout model are just alien to one
another, and the latter is -extremely- convoluted.

The virtue of the web model is that it is very easy to get "Something"
out which looks and behaves almost like what you expect or want with
minimal fuss.

Then you try to tweak it to get it exactly how you want, and suddenly it
can devour your soul in a hysterical haze of element style interactions
along the DOM. And just when you think you have it: somehow the entire
thing collapses and nothing works. :P

Eventually you start to -understand- the DOM, and thinking in DOM, and
you're clinically a little bit insane, but suddenly it all sort of makes
sense.

I think you've gone down this path and are slightly lost to the dark
forces of the DOM and are no longer seeing that its nutty, cuz
internally nutty is now natural :) I can usually do real-life interfaces
in traditional GUI models which are far simpler and use less code then
equivalent DOM based interfaces, /except/ in cases where I have a
content flow situation. Where large amounts of 'unknown' are inserted
into an interface and I want everything to go with it well.

That's not to say I think you're actually crazy. I just think you either
think naturally in the twisting and recursive mode of DOM or have taught
yourself to. Its a mental model that not all will ever grasp. :)

> 
>> HTML+CSS have some very strong advantages. Simplicity is not one of
>> them. Precision web design these days is a dark art. (Go center an image
>> vertically and horizontally in an arbitrary sized field!)
> 
>  stephen, _thank_ you - that was _exactly_ why i decided i flat-out
> was NEVER going to do "plain" HTML/CSS programming _ever_ again.  i
> spent twwoo weeks trying to do exactly this (well, it was 7
> boxes, not an image) - and i failed.
> 
>  i succeeded on firefox to get the boxes centred, but with IE, when
> you resized the screen, the bloody boxes went off the top!  they were
> so "centred" that they went off the top of the screen!  and the bloody
> idiotic IE team forgot that you can't scroll _up_ off the top of the
> screen :)
> 
>  in desperation, i blindly wandered into pyjamas, and went "ye" -
> and within 50 minutes i had converted my site to do exactly this.
> 
>  you can see the results here: http://lkcl.net and the main code is
> here:
> http://lkcl.net/site_code/index.py
> 
>  the relevant (crucial) function is the onWindowResized function which
> gets called because of this: Window.addWindowResizeListener(self)

[snip implementation]

See, even in *python*, this is all rediculiously complicated. It should
be one, or at most, two lines of code to do something like "uh, center
please" :-)

>  those three panels are added into another panel which has 100% width
> and 100% height, and has "centre" properties attached to its cells;
> voila, the boxes always sit in the middle of the screen.  when the
> screen is too big for the 100% height outer panel, the boxes "push"
> against the constraints of their outer panel, thus forcing the screen
> to become bigger and thus automatically a vertical scroll-bar is
> added.  for some browsers this results in another onWindowResize
> notification and for some it doesn't (eurgh) - but that's another
> story :)
> 
>  this is what i was referring to in another message... rats, can't
> find it now: it was the one asking about why qt4 and gtk2 layouts
> don't cut it, and i explained about the recursive complex child-parent
> interaction rules between DOM objects.

I'm not entirely sure you fully understood qt or gtk's layout
mechanisms. Now, I do not know QT, but I know wx -- which is implemented
in temrs of gtk, so somehow the wx team got it working on GTK.

wx uses a complicated recursive layout engine (unless you're mildly nuts
and try to do absolute layouts) which in all essence does *exactly*

Re: biopython

2010-06-14 Thread Thomas Jollans
On 06/14/2010 05:45 PM, madhuri vio wrote:
> 
> i am still waiting for some help.

WHAT?! Your behaviour on this list is making me really, really angry. We
are not a tech support company. You are not paying for the privilege of
sending your mail here.
However, Sir, you are acting as if you were entitled to an instantaneous
response to all your silly little problems without even thinking about
the problem yourself!

If you showed us that you're an intelligent human being and that you
think before you post, that you're trying to understand what you're
working on, in short that you're worthy of an answer, I and no doubt
many other knowledgeable folk on this list would be happy to help you
along, but so far you have been but a nuisance, a spammer.

Besides: your original TWO (why two??) posts got a couple of replies.
One annoyed but in principle I think helpful one from myself, and one
rather forthcoming one from Mark Lawrence. Are you even subscribed to
the mailing list, or are you blind posting and hoping for people to CC
you in their replies?

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


Re: Convert .doc to .pdf

2010-06-14 Thread Marco Nawijn
On 14 jun, 17:55, Thales  wrote:
> On 14 jun, 11:01, Marco Nawijn  wrote:
>
>
>
>
>
> > On 14 jun, 13:19, Thales  wrote:
>
> > > Good morning,
>
> > > I need to convert some files from .doc to .pdf. I've googled it a
> > > little bit and all the solutions I've found used the OpenOffice API,
> > > but I can't use it.
>
> > > Anybody knows a library that I can use to do it?
>
> > > Thanks
>
> > What about using the win32 API and use the free  PDFCreator (http://
> > sourceforge.net/projects/pdfcreator/) PDF printer?
>
> > This should be very simple (code untested, but should be roughly OK):
> > - Instantiate MS/Word application
> >   >> from win32com.client import Dispatch
> >   >> app = Dispatch('Word.Application')
> > - Open your document
> >   >> doc = app.Documents.Open("demo.doc")
> > - Print to PDF
> >   >> app.ActivePrinter = "PDFCreator"
> >   >> app.PrintOut()
>
> > The PrintOut call is a little tricky. I normally try to decode and
> > guess the Python call from the corresponding VisualBasic code I record
> > with the macro recording facility. I know there are more sophisticated
> > methods out there, but I never tried them.
>
> > Regards,
>
> > Marco
>
> Thanks for your help Marco, but it has to work on linux, not on
> windows. Is possible to import this win32com on linux systems? How?
>
> Thank you!

Nope. The win32 related packages only work on Windows systems.

Maybe Wine is an option? So running a genuine MS Office under Wine on
Linux?
Otherwise, your best bet is still OpenOffice (although you mention you
cannot use it)

Regards,

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


Re: Convert .doc to .pdf

2010-06-14 Thread Stephen Hansen
On 6/14/10 8:55 AM, Thales wrote:
> Thanks for your help Marco, but it has to work on linux, not on
> windows. Is possible to import this win32com on linux systems? How?

You should include your full requirements when you originally ask :)

That said... I think you're out of luck.

Doc's are a proprietary format. The only way to /read/ them (required to
convert them to PDF) is to get something that can understand them.
There's no readily available library that I'm aware of capable of doing
so. Certain word processing utilities have varying degrees of ability to
(depending on how old the file format is) -- with OpenOffice being the
most controllable.

So I think you either need to figure out a way to turn your "can't use
it" into a "can" or -- I'm back to out of luck :)

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Convert .doc to .pdf

2010-06-14 Thread Thomas Jollans
On 06/14/2010 01:19 PM, Thales wrote:
> Good morning,
> 
> I need to convert some files from .doc to .pdf. I've googled it a
> little bit and all the solutions I've found used the OpenOffice API,
> but I can't use it.
> 
> Anybody knows a library that I can use to do it?

Why can't you use OpenOffice?

In my experience, there are only very few programs able to read msword
files fully and properly: MS Word itself (obviously not an option), and
OpenOffice.org (maybe your best bet)

if you're really only interested in extracting the text, there are a few
tools that you could hook into - "wv" (for word view) springs to mind.

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


Re: biopython

2010-06-14 Thread Mark Lawrence

On 14/06/2010 16:45, madhuri vio wrote:

i am still waiting for some help.


You cheeky git, this is simply *NOT* cricket!  Your 1st post was timed 
at 13:59 BST, the response from Thomas Jollans at 14:12.  Your 2nd post 
was at 15:02 and I replied at 15:12.  Now you're back again at 16:45, to 
which Thomas and Benjamin Kaplan have already responded.


Here is is the reference that I previously gave you.

http://www.biopython.org/wiki/SeqIO#Sequence_Input

If you don't understand something then please ask, but I suggest you 
(re)read this first.


http://www.catb.org/~esr/faqs/smart-questions.html

HTH.

Mark Lawrence



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


Is Scheme/LISP faster than C/C++

2010-06-14 Thread bolega
Quoting the following post :-

I am looking for expert opinions

http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/54fb97d15b234d31#

> Probably doesn't meet your intent, but this is a really impressive bit
> of (whacky) art:

Lisp runs faster than C. Once you get more time away from screwing
Palestinians, and other false-flags, you will find ideas like these

How to make Lisp go faster than C
Didier Verna
Abstract
Contrary to popular belief, Lisp code can be very ef-
 cient today: it can run as fast as equivalent C code
or even faster in some cases. In this paper, we explain
how to tune Lisp code for performance by introducing
the proper type declarations, using the appropriate
data structures and compiler information. We also
explain how e ciency is achieved by the compilers.
These techniques are applied to simple image process-
ing algorithms in order to demonstrate the announced
performance on pixel access and arithmetic operations
in both languages.

===
Standard Disclaimer, nothing personal

http://www.youtube.com/watch?v=lX18zUp6WPY

http://www.youtube.com/watch?v=XQapkVCx1HI

http://www.youtube.com/watch?v=tXJ-k-iOg0M

Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ?
Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did
you release the 5 dancing Israelis compromising the whole 911
investigation ? If the Dubai Police can catch Mossad Murderers and put
the videos and Iranian Police can why cant you put the Pentagon
Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and
puting on INTERNATIONAL MEDIA a day after catching him without
TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did
you have to LIE about Dr Afiya Siddiqui and torture that Innocent
little mother of 3 and smashing the skull of her one child ?

http://www.youtube.com/watch?v=DhMcii8smxk
http://www.youtube.com/watch?v=0SZ2lxDJmdg

There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian
courts.

FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but
only because he was a white. They got away with MURDER of thousands of
Non-whites in all parts of the world.

Daily 911 news : http://911blogger.com

http://www.youtube.com/watch?v=tRfhUezbKLw

http://www.youtube.com/watch?v=x7kGZ3XPEm4

http://www.youtube.com/watch?v=lX18zUp6WPY


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


Re: Python OpenSSL library

2010-06-14 Thread geremy condra
On Mon, Jun 14, 2010 at 10:08 AM, Antoine Pitrou  wrote:
> On Sun, 13 Jun 2010 14:13:32 -0700
> geremy condra  wrote:
>> On Sun, Jun 13, 2010 at 1:29 PM, astral
>>  wrote:
>> > I am looking for Python OpenSSL library, for Python version 2.5.4 (on
>> > Windows)
>> > Which does not require to install Cygwin package. Need just to decrypt 
>> > file,
>> > then uninstall library.
>>
>> Evpy[1] is designed to be a very easy-to-use interface to OpenSSL,
>> although it is by design limited to doing things the right way, so it
>> may not meet your needs.
>
> How about contributing to the standard hashlib and ssl modules? Is
> there anything there that goes in the way, e.g. design-wise?
>
> Regards
>
> Antoine

Evpy currently uses ctypes for its bindings, so my understanding is
that it isn't eligible for inclusion, but a rewrite as a C extension is
under way and I'd be happy to contribute that.

The hard thing would be finding someone to champion it on the
political side, since I have little interest in fighting the interminable
political battles that go with the push for inclusion.

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


Re: Is Scheme/LISP faster than C/C++

2010-06-14 Thread bolega
Sorry, I dont have access to the journal papers ... or I would do
research myself.

On Jun 14, 10:10 am, bolega  wrote:
> Quoting the following post :-
>
> I am looking for expert opinions
>
> http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/54...
>
> > Probably doesn't meet your intent, but this is a really impressive bit
> > of (whacky) art:
>
> Lisp runs faster than C. Once you get more time away from screwing
> Palestinians, and other false-flags, you will find ideas like these
>
> How to make Lisp go faster than C
> Didier Verna
> Abstract
> Contrary to popular belief, Lisp code can be very ef-
>  cient today: it can run as fast as equivalent C code
> or even faster in some cases. In this paper, we explain
> how to tune Lisp code for performance by introducing
> the proper type declarations, using the appropriate
> data structures and compiler information. We also
> explain how e ciency is achieved by the compilers.
> These techniques are applied to simple image process-
> ing algorithms in order to demonstrate the announced
> performance on pixel access and arithmetic operations
> in both languages.
>
> ===
> Standard Disclaimer, nothing personal
>
> http://www.youtube.com/watch?v=lX18zUp6WPY
>
> http://www.youtube.com/watch?v=XQapkVCx1HI
>
> http://www.youtube.com/watch?v=tXJ-k-iOg0M
>
> Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ?
> Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did
> you release the 5 dancing Israelis compromising the whole 911
> investigation ? If the Dubai Police can catch Mossad Murderers and put
> the videos and Iranian Police can why cant you put the Pentagon
> Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and
> puting on INTERNATIONAL MEDIA a day after catching him without
> TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did
> you have to LIE about Dr Afiya Siddiqui and torture that Innocent
> little mother of 3 and smashing the skull of her one child ?
>
> http://www.youtube.com/watch?v=DhMcii8smxkhttp://www.youtube.com/watch?v=0SZ2lxDJmdg
>
> There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian
> courts.
>
> FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but
> only because he was a white. They got away with MURDER of thousands of
> Non-whites in all parts of the world.
>
> Daily 911 news :http://911blogger.com
>
> http://www.youtube.com/watch?v=tRfhUezbKLw
>
> http://www.youtube.com/watch?v=x7kGZ3XPEm4
>
> http://www.youtube.com/watch?v=lX18zUp6WPY

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


Re: Python OpenSSL library

2010-06-14 Thread Antoine Pitrou
Le lundi 14 juin 2010 à 13:18 -0400, geremy condra a écrit :
> >>
> >> Evpy[1] is designed to be a very easy-to-use interface to OpenSSL,
> >> although it is by design limited to doing things the right way, so it
> >> may not meet your needs.
> >
> > How about contributing to the standard hashlib and ssl modules? Is
> > there anything there that goes in the way, e.g. design-wise?
> >
> > Regards
> >
> > Antoine
> 
> Evpy currently uses ctypes for its bindings, so my understanding is
> that it isn't eligible for inclusion, but a rewrite as a C extension is
> under way and I'd be happy to contribute that.

That was not my question. My question was whether there was a reason to
rewrite a separate OpenSSL-accessing library rather than contributing to
improve the "hashlib" and "ssl" modules which are already part of the
Python stdlib.

Regards

Antoine.


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


Re: Is Scheme/LISP faster than C/C++

2010-06-14 Thread Stephen Hansen
On 6/14/10 10:17 AM, bolega wrote:
> Sorry, I dont have access to the journal papers ... or I would do
> research myself.

This has what to do with Python?

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python OpenSSL library

2010-06-14 Thread John Nagle

On 6/13/2010 1:59 PM, Michael Crute wrote:

On Sun, Jun 13, 2010 at 4:29 PM, astral
  wrote:

I am looking for Python OpenSSL library, for Python version 2.5.4 (on
Windows)
Which does not require to install Cygwin package. Need just to decrypt file,
then uninstall library.


You might want to take a look at m2crypto[0]. While I have not
personally run it on Windows (runs great on OS X and Linux) they do
provide pre-compiled Windows binaries.

[0] http://chandlerproject.org/bin/view/Projects/MeTooCrypto


   M2Crypto for Python 2.5 works well. I've used it both on Windows
and Linux.  If you have to build it, though; that's a huge pain.
It uses SWIG, and the build process seems to have problems that
require workarounds.

   The new SSL module in Python 2.6 is convenient, but insecure.
It doesn't check whether the remote domain matches the
cert being presented.  So it's vulnerable to man-in-the-middle
attacks, or sites with "borrowed" SSL certs.  See
"http://mail.python.org/pipermail/python-list/2010-April/1242166.html";.

John Nagle





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


Re: Is Scheme/LISP faster than C/C++

2010-06-14 Thread nanothermite911fbibustards
On Jun 14, 10:17 am, bolega  wrote:
> Sorry, I dont have access to the journal papers ... or I would do
> research myself.
>
> On Jun 14, 10:10 am, bolega  wrote:
>
> > Quoting the following post :-
>
> > I am looking for expert opinions
>
> >http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/54...
>
> > > Probably doesn't meet your intent, but this is a really impressive bit
> > > of (whacky) art:
>
> > Lisp runs faster than C. Once you get more time away from screwing
> > Palestinians, and other false-flags, you will find ideas like these
>
> > How to make Lisp go faster than C
> > Didier Verna
> > Abstract
> > Contrary to popular belief, Lisp code can be very ef-
> >  cient today: it can run as fast as equivalent C code
> > or even faster in some cases. In this paper, we explain
> > how to tune Lisp code for performance by introducing
> > the proper type declarations, using the appropriate
> > data structures and compiler information. We also
> > explain how e ciency is achieved by the compilers.
> > These techniques are applied to simple image process-
> > ing algorithms in order to demonstrate the announced
> > performance on pixel access and arithmetic operations
> > in both languages.
>
> > ===
> > Standard Disclaimer, nothing personal
>
> >http://www.youtube.com/watch?v=lX18zUp6WPY
>
> >http://www.youtube.com/watch?v=XQapkVCx1HI
>
> >http://www.youtube.com/watch?v=tXJ-k-iOg0M
>
> > Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ?
> > Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did
> > you release the 5 dancing Israelis compromising the whole 911
> > investigation ? If the Dubai Police can catch Mossad Murderers and put
> > the videos and Iranian Police can why cant you put the Pentagon
> > Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and
> > puting on INTERNATIONAL MEDIA a day after catching him without
> > TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did
> > you have to LIE about Dr Afiya Siddiqui and torture that Innocent
> > little mother of 3 and smashing the skull of her one child ?
>
> >http://www.youtube.com/watch?v=DhMcii8smxkhttp://www.youtube.com/watc...
>
> > There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian
> > courts.
>
> > FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but
> > only because he was a white. They got away with MURDER of thousands of
> > Non-whites in all parts of the world.
>
> > Daily 911 news :http://911blogger.com
>
> >http://www.youtube.com/watch?v=tRfhUezbKLw
>
> >http://www.youtube.com/watch?v=x7kGZ3XPEm4
>
> >http://www.youtube.com/watch?v=lX18zUp6WPY
>
>

Here is the paper :

http://www.iaeng.org/IJCS/issues_v32/issue_4/IJCS_32_4_19.pdf

Get ghostview which can show you better font display of the older
types.

I give good help and I ask people to spread the info in my sig by
quoting it.

The FAT per DIEM FBI bustards use our TAX PAYER MONEY and INCOMPETENCE
is UNACCEPTABLE.

=

http://www.youtube.com/watch?v=lX18zUp6WPY

http://www.youtube.com/watch?v=XQapkVCx1HI

http://www.youtube.com/watch?v=tXJ-k-iOg0M

Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ?
Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did
you release the 5 dancing Israelis compromising the whole 911
investigation ? If the Dubai Police can catch Mossad Murderers and put
the videos and Iranian Police can why cant you put the Pentagon
Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and
puting on INTERNATIONAL MEDIA a day after catching him without
TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did
you have to LIE about Dr Afiya Siddiqui and torture that Innocent
little mother of 3 and smashing the skull of her one child ?

http://www.youtube.com/watch?v=DhMcii8smxk
http://www.youtube.com/watch?v=0SZ2lxDJmdg

There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian
courts.

FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but
only because he was a white. They got away with MURDER of thousands of
Non-whites in all parts of the world.

Daily 911 news : http://911blogger.com

http://www.youtube.com/watch?v=tRfhUezbKLw

http://www.youtube.com/watch?v=x7kGZ3XPEm4

http://www.youtube.com/watch?v=lX18zUp6WPY

Conclusion : FBI bustards are RACIST and INcompetent. They could
neither catch the ANTHRAX or 911 YANK/Jew criminals nor could they
cover them up - whichever was their actual task.

SLASH the SALARIES of FBI/CIA/NSA etc BUSTARDS into half all across
tbe board, esp the whites/jew on the top.

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


Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Irmen de Jong

On 14-6-2010 15:09, Vincent Davis wrote:

Anyway, make sure readline is installed, and then recompile Python.


So I should run
./configure
make install
again?
Will this overwrite other py packages I have installed?

Vincent


Often there is no need to run the configure script again if you're just satisfying build 
prerequisites for extension modules. Python's build script is smart enough to discover 
the sudden availability of the readline library, and will happily build the readline 
module. Just typing 'make install' should be enough.


Irmen

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


Re: Is Scheme/LISP faster than C/C++

2010-06-14 Thread fortunatus
For crying out loud, the best any compiler can do is make optimal
machine language.  Many C compilers can do that over most inputs.  So
can many Lisp compilers if you give the right type data.  So it's a
moot point.

The only point to discuss would be that Scheme - in the R5 version of
the spec at least - doesn't have standard way to specify type data
unless I am mistaken.  Therefore you  will find that Scheme compilers
add their own syntax for it.  Again we are led to a moot point.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUIs - A Modest Proposal

2010-06-14 Thread rantingrick
On Jun 14, 11:17 am, Stephen Hansen  wrote:
> And the recursive flow of the DOM is powerful

This style of speaking reminds me of our former hillbilly president
(no not Clinton, he was the eloquent hillbilly!) No i am referring to
good old "George Dubya". He left us with so many juicy sound bites

HOST: I’m curious, have you ever googled anybody? Do you use Google?
BUSH: Occasionally. One of the things I’ve used on the Google is to
pull up maps. It’s very interesting to see — I’ve forgot the name of
the program — but you get the satellite, and you can — like, I kinda
like to look at the ranch. It remind me of where I wanna be sometimes.

... Thanks Dubya for making a complete moron of yourself, AGAIN!

> (and in some cases,
> superbly suited to a task), but I maintain fully: at no point is it
> easy, simple, or even entirely comprehensible to most average geeks.
> Traditional GUI models vs the web layout model are just alien to one
> another, and the latter is -extremely- convoluted.

I'll have to very much agree with this assessment Stephan. There
exists not elegant API for these "web" UI's. The people over at
SketchUp (my second love after python) have this problem on a daily
bases with WebDialogs. Even the javascript gurus have a dificult time
juggling javascript, CSS, and Ruby code to make these grumpy beasts
come to life, and when they do it ain't really pretty. Many have
lamented for a simple to use GUI like Tkinter or even Wx but our cries
have fallen on deaf ears.

But digging a bit deeper you can think of the javascript/css/
langugageX here as the same mind warping power C/C++ hold over it's
users too. Low level C hackers cannot properly use a high level
language like Python (with some very small exceptions). I see it all
the time in the SketchUp Ruby API. These guys are like fish out of
water when you give them a Python/Ruby interpretor. Here is a "nutty"
example

# UI.inputbox(prompts, defaults, enums, title) -> result
# With four params, it shows a drop down box for prompts that have
# pipe-delimited lists of options. In this case, the Gender prompt
# is a drop down instead of a text box.
prompts = ["What is your Name?", "What is your Age?", "Gender"]
defaults = ["Enter name", "", "Male"]
list = ["", "", "Male|Female"]
input = UI.inputbox prompts, defaults, list, "Tell me about yourself."

...Does it need to be that messy, well in the C world yes, but in
Python/Ruby world lets make our lives easier shall we...

input = UI.inputbox(
'Title Here',
'prompt1=default1'
'prompt2=default2',
'prompt3=opt1|opt2',
)

... now i feel the same bliss old George knows all to well and
ignorance has nothing to do with it ;-).

> wx uses a complicated recursive layout engine (unless you're mildly nuts
> and try to do absolute layouts) which in all essence does *exactly* what
> you are describing there. With a little bit of boiler plate: you have to
> declare a certain box to be allowed to grow a scrollbar, so that's a
> little more work. But less in others: I never have to resort to resize
> hooks to get stuff to reconfigure itself (with the sole exception being
> the Expandable Text Control).

I must say of all the GUI's Tkinter does handle geometry management in
a most simplistic way. You have your choice between three managers
grid, pack, and place. Wx introduces a little less elegance however
nothing like what we have here.

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


Re: Which is the best implementation of LISP family of languages for real world programming ?

2010-06-14 Thread nanothermite911fbibustards
On Jun 14, 8:29 am, [email protected] (Thomas A. Russ) wrote:
> Pascal Costanza  writes:
> > On 12/06/2010 19:36, bolega wrote:
> > > Is there anything in this old
> > > norvig book that makes it worth pursuing as a text ?
>
> > >http://norvig.com/paip.html
>
> > This "old" book by Peter Norvig is still one of the best Common Lisp
> > introductions you can find, and has some excellent material that is not
> > covered elsewhere. If you are interested in some fundamental AI concepts
> > at the same time, this is one of the best choices.
>
> I agree.
>
> If you are adept at picking up programming languages, you can just start
> with this one, since it does have an introduction to the language in the
> early parts of the book.  But for some people, the terse introduction is
> a bit too barebones.  It introduces the language but it isn't a
> tutorial, so for a lot of people this would make a better second book.
>
> --
> Thomas A. Russ,  USC/Information Sciences Institute

I think the guy wanted to know how to embed a Scheme or Lisp
interpreter inside his C code and do useful things with it.

===
Vacation Responder

The FAT per DIEM FBI bustards use our TAX PAYER MONEY and INCOMPETENCE
is UNACCEPTABLE.

=

http://www.youtube.com/watch?v=lX18zUp6WPY

http://www.youtube.com/watch?v=XQapkVCx1HI

http://www.youtube.com/watch?v=tXJ-k-iOg0M

Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ?
Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did
you release the 5 dancing Israelis compromising the whole 911
investigation ? If the Dubai Police can catch Mossad Murderers and put
the videos and Iranian Police can why cant you put the Pentagon
Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and
puting on INTERNATIONAL MEDIA a day after catching him without
TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did
you have to LIE about Dr Afiya Siddiqui and torture that Innocent
little mother of 3 and smashing the skull of her one child ?

http://www.youtube.com/watch?v=DhMcii8smxk
http://www.youtube.com/watch?v=0SZ2lxDJmdg

There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian
courts.

FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but
only because he was a white. They got away with MURDER of thousands of
Non-whites in all parts of the world.

Daily 911 news : http://911blogger.com

http://www.youtube.com/watch?v=tRfhUezbKLw

http://www.youtube.com/watch?v=x7kGZ3XPEm4

http://www.youtube.com/watch?v=lX18zUp6WPY

Conclusion : FBI bustards are RACIST and INcompetent. They could
neither catch the ANTHRAX or 911 YANK/Jew criminals nor could they
cover them up - whichever was their actual task.

SLASH the SALARIES of FBI/CIA/NSA etc BUSTARDS into half all across
tbe board, esp the whites/jew on the top.

FBI Bustards failed to Catch BERNARD MADOFF even after that RACIST and
UNPATRIOTIC Act
FBI bustards failed to prevent ROMAN POLANSKY from absconding to
europe and rapes.
FBI bustards failed to prevent OKLAHOMA

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


Re: Is Scheme/LISP faster than C/C++

2010-06-14 Thread fortunatus
One point that might be interesting, you do include C++ in your post.
Therefore some compare/contrast of C++ class member function
invocation rate versus Lisp object method invocation rate might be
meaningful.  I'm sure if you Google back through comp.lang.lisp you
will find plenty on it already.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python OpenSSL library

2010-06-14 Thread geremy condra
On Mon, Jun 14, 2010 at 10:25 AM, Antoine Pitrou  wrote:
> Le lundi 14 juin 2010 à 13:18 -0400, geremy condra a écrit :
>> >>
>> >> Evpy[1] is designed to be a very easy-to-use interface to OpenSSL,
>> >> although it is by design limited to doing things the right way, so it
>> >> may not meet your needs.
>> >
>> > How about contributing to the standard hashlib and ssl modules? Is
>> > there anything there that goes in the way, e.g. design-wise?
>> >
>> > Regards
>> >
>> > Antoine
>>
>> Evpy currently uses ctypes for its bindings, so my understanding is
>> that it isn't eligible for inclusion, but a rewrite as a C extension is
>> under way and I'd be happy to contribute that.
>
> That was not my question. My question was whether there was a reason to
> rewrite a separate OpenSSL-accessing library rather than contributing to
> improve the "hashlib" and "ssl" modules which are already part of the
> Python stdlib.

Yes. Hashlib is designed to provide cryptographic hashes, and the ssl
module to provide TLS support. Evpy provides encryption and signing.
Am I answering your question?

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


Re: How to print via python on windows

2010-06-14 Thread rantingrick
On Jun 14, 10:55 am, Tim Golden  wrote:
> On 14/06/2010 16:31, loial wrote:
>
> > What is the easiest way to send a text file to a networked printer
> > from a python script running on windows?
>
>    http://timgolden.me.uk/python/win32_how_do_i/print.html


Hello Tim,

Thanks for posting this wonderful win32 info at your site. I have used
it quite extensively in the past and would like to know if you are
interested in adding a bit more to the code to this simplistic
example...

import win32print
printer_name = win32print.GetDefaultPrinter ()
#
# raw_data could equally be raw PCL/PS read from
#  some print-to-file operation
#
raw_data = "This is a test"

hPrinter = win32print.OpenPrinter (printer_name)
try:
  hJob = win32print.StartDocPrinter (hPrinter, 1, ("test of raw data",
None, "RAW"))
  try:
win32print.WritePrinter (hPrinter, raw_data)
  finally:
win32print.EndDocPrinter (hPrinter)
finally:
  win32print.ClosePrinter (hPrinter)

... It would be nice to include some code to paginate the text. Also
what seems to be missing from the Python world is some info on
configuring a printer programically. MSDN is not much help to anybody
and really nothing more than a smorgasbord of nonsense not even web
dialogs scripting can hold a candle to, but i digress... We need more
than what the CommonDialog classes expose, although some info on CD's
would be helpful. Would you be interested in adding some additional
info to this wonderful site? And What about image acquisition?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUIs - A Modest Proposal

2010-06-14 Thread Ricardo Aráoz

On 14/06/2010 02:57 p.m., rantingrick wrote:

On Jun 14, 11:17 am, Stephen Hansen  wrote:
   

And the recursive flow of the DOM is powerful
 

This style of speaking reminds me of our former hillbilly president
(no not Clinton, he was the eloquent hillbilly!) No i am referring to
good old "George Dubya". He left us with so many juicy sound bites
   



PLONK 

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


Re: GUIs - A Modest Proposal

2010-06-14 Thread lkcl
On Jun 14, 4:17 pm, Stephen Hansen  wrote:

> >> Did you just call DOM manipulation simple with a straight face? I don't
> >> think I've ever seen that before.
>
> >  *lol* - wait for it: see below.  summary: once you start using high-
> > level widgets: yes.  without such, yeah you're damn right.
>
> See, the thing is, my background is a little bit mixed.

 ahh?  good.  perfect.

> I've produced
> complex yet approachable and dynamic interfaces for both traditional
> client applications, and similar level user interfaces for the web. In
> the latter case, I don't do HTML/CSS programming anymore as you describe
> it,

 definitely not as "i" would describe it, either!  so let's substitute
"the average web programmer" for the word "you".

> but JavaScript-based building out of the application.

 yes.  that's effectively what pyjs applications are about: as much
HTML/CSS as you can stand, then _absolute_ pure javascript from there-
on in... only using a compiler (python-to-javascript) so as not to go
completely insane - and, from the rest of your message, i _know_ you
know what i'm talking about, there :)

> And the recursive flow of the DOM is powerful (and in some cases,
> superbly suited to a task), but I maintain fully: at no point is it
> easy, simple, or even entirely comprehensible to most average geeks.

 correct.  i don't pretend to get it, completely. i tend to put my
trust in the pyjamas widgets - things with names like "Grid,
FlexTable, Button, HorizontalPanel and VerticalSlider" - and hope for
the best.

 to be absolutely honest, i very rarely even write my own widgets: i
advocate that people, myself _especially_ myself included, perform
literal line-for-line translations of GWT widgets from java to
python.  why? because, again: on the basis that google have tons of
money to put into GWT widgets, doing full regression tests, and have
thousands of users, they can afford to get the widget right across all
the browsers.  ergo, why duplicate that effort - just code-translate
it verbatim!

 oh, btw, that's turning into quite a powerful project on its own: the
goal is to have a fully automated java-to-python translator!

 http://github.com/thoka/java2python


> Traditional GUI models vs the web layout model are just alien to one
> another, and the latter is -extremely- convoluted.

 we've found that there's a third "hybrid" case, and it's hinted at
through RIA javascript libraries such as extjs: a traditional GUI
model *implemented* as a web app.

 so those RIA JS libraries are not "vs", they're _both_.  except...
javascript has its own headaches, so that's why both pyjamas and GWT
remove _those_ headaches, by using language translators.

 so, yah - except when hybridly-hidden behind "widgets", of which
pyjamas has something like... 70, and GWT must have 150+ and upwards,
if you include 3rd party libraries out there that i can't even begin
to count.

> The virtue of the web model is that it is very easy to get "Something"
> out which looks and behaves almost like what you expect or want with
> minimal fuss.
>
> Then you try to tweak it to get it exactly how you want, and suddenly it
> can devour your soul in a hysterical haze of element style interactions
> along the DOM. And just when you think you have it: somehow the entire
> thing collapses and nothing works. :P

 tell me about it ha ha - been there :)

> Eventually you start to -understand- the DOM, and thinking in DOM, and
> you're clinically a little bit insane, but suddenly it all sort of makes
> sense.
>
> I think you've gone down this path and are slightly lost to the dark
> forces of the DOM and are no longer seeing that its nutty, cuz
> internally nutty is now natural :)

 no, you'll be relieved to know that, as above, i entirely avoid it
unless absolutely necessary (by cheating, and using the java2python
approach).  i wrote a slider class (veeery basic).  ok, i'm lying
somewhat: after doing almost 40,000 lines of java to python
translation involving heavy amounts of DOM you can't _help_ but begin,
by a process of osmosis, to get to grips with it :)

> I can usually do real-life interfaces
> in traditional GUI models which are far simpler and use less code then
> equivalent DOM based interfaces, /except/ in cases where I have a
> content flow situation. Where large amounts of 'unknown' are inserted
> into an interface and I want everything to go with it well.

 i think i know what you're referring to: obtaining 700+ bits of data
and trying to insert them all at once into the DOM interface, as the
web engine is single-threaded, you lock up the browser.  and there's
no escape!  in these circumstances, the trick recommended is to use a
timer, breaking up the loop and adding bits at a time.  e.g.:
  http://pyjs.org/book/Chapter.py

 you can see in onTimer, a simple loop, reads up to 10 lines, fires
the timer again.

 i would _hate_ to have to do this sort of thing in pure javascript.

> That's not to say I think you're actually crazy. I just th

Re: Python OpenSSL library

2010-06-14 Thread Nobody
On Mon, 14 Jun 2010 10:43:02 -0700, John Nagle wrote:

> The new SSL module in Python 2.6

There isn't an SSL module in Python 2.6. There is a module named "ssl"
which pretends to implement SSL, but in fact doesn't.

> is convenient, but insecure.

In which case, it isn't actually convenient, in any meaningful sense of
the word.

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


Re: GUIs - A Modest Proposal

2010-06-14 Thread lkcl
On Jun 14, 5:57 pm, rantingrick  wrote:
> On Jun 14, 11:17 am, Stephen Hansen  wrote:
>
> > And the recursive flow of the DOM is powerful
>
> This style of speaking reminds me of our former hillbilly president
> (no not Clinton, he was the eloquent hillbilly!)

 the one with an IQ of 185?

> No i am referring to
> good old "George Dubya".

 the one with an IQ of 190?

> He left us with so many juicy sound bites
>
> HOST: I’m curious, have you ever googled anybody? Do you use Google?
> BUSH: Occasionally. One of the things I’ve used on the Google is to
> pull up maps. It’s very interesting to see — I’ve forgot the name of
> the program — but you get the satellite, and you can — like, I kinda
> like to look at the ranch. It remind me of where I wanna be sometimes.

 o, you must mean sonny-boy, the one with the IQ of 85 due to
having destroyed his mind with drink and drugs - ahh, yehhs.  the only
thing i can respect that man for is the fact that he insists on going
to bed before 9:30pm.

 yeessh, how did america manage to vote in a president who *started
out* so blatantly unintelligent, as opposed to voting one in who had
an off-the-charts IQ and lost it to alzheimers, dear-old ronnie-boy??

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


Re: Python OpenSSL library

2010-06-14 Thread geremy condra
On Mon, Jun 14, 2010 at 11:47 AM, Nobody  wrote:
> On Mon, 14 Jun 2010 10:43:02 -0700, John Nagle wrote:
>
>>     The new SSL module in Python 2.6
>
> There isn't an SSL module in Python 2.6. There is a module named "ssl"
> which pretends to implement SSL, but in fact doesn't.
>
>> is convenient, but insecure.
>
> In which case, it isn't actually convenient, in any meaningful sense of
> the word.

As one of my friends is fond of saying, it lets you talk encrypted to
your attacker ;)

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


Re: Which is the best implementation of LISP family of languages for real world programming ?

2010-06-14 Thread Pascal J. Bourguignon
"Antti \"Andy\" Ylikoski"  writes:

> 12.6.2010 22:54, Pascal J. Bourguignon kirjoitti:
>> bolega  writes:
>>>
 [PAIP]
>>>
>>> Is there anything in this old norvig book that makes it worth
>>> pursuing as a text ?
>>
>> Yes.
>>
>
> I agree with his criticism that the book is "old", mine stems from the
> year 1992.

That's not "old".  An old book is one that is falling in powder when
you're reading it.  Eg. the Quran manuscripts are "old".  But any book
since Gutenberg's invention is not old.  For a book, that is.



> I bought and studied the Russell-Norvig books on "Artificial
> Intelligence: A Modern Approach", ie. the 1th, 2nd (and in the future
> the 3rd edition), in order to learn modern AI theory.  They have
> discontinued the 3rd edition but I succeeded in ordering a copy
> anyway. I have read the 1st and the 2nd editions, but I have not yet
> received by mail the 3rd edition.
>
> But I only got the PAIP book to learn Common LISP, not in order to
> study modern AI.  This  is why I'm discussing this in the
> new:comp.lang.LISP newsgroup.
>
> Any good modern LISP textbooks out there?
>
> Can anyone point to me any other good modern textbooks on AI than the
> 3rd edition of the Russell-Norvig book?  (Which is reputable.)

If we said it is the last AI book written using Lisp, would that make
it worth reading?There's nothing newer in AI!   :-)


-- 
__Pascal Bourguignon__ http://www.informatimago.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File descriptor to file object

2010-06-14 Thread Robert Kern

On 6/14/10 9:57 AM, Nathan Huesken wrote:

Hi,

tempfile.mkstemp returns a file name and a file descriptor (as returned
by os.open). Can I somehow convert this descriptor to a file object?


Thomas Jollans' advice is likely best, but to answer your specific question, use 
os.fdopen() to make a file object corresponding to the file descriptor.


--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: a +b ?

2010-06-14 Thread Ian

On 14/06/2010 02:35, alex23 wrote:

Python isn't PHP, its built-ins are nowhere near as exhaustive,
something like 80ish vs 2000+ functions? Not exactly a huge lookup
burden.
   
The problem is not learning Python, its learning about the standard 
libraries that Python gives you access to!


.NET from Iron Python anyone?

Regards

Ian

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


Re: GUIs - A Modest Proposal

2010-06-14 Thread lkcl
On Jun 14, 5:57 pm, rantingrick  wrote:
> I'll have to very much agree with this assessment Stephan. There
> exists not elegant API for these "web" UI's. The people over at
> SketchUp (my second love after python) have this problem on a daily
> bases with WebDialogs. Even the javascript gurus have a dificult time
> juggling javascript, CSS, and Ruby code to make these grumpy beasts
> come to life, and when they do it ain't really pretty.

 ah.  again, the "recommended" pyjamas development model vs the
"standard" development model comes to the rescue, here.  in a pyjamas
app, the app loads ONCE and ONLY ONCE, as one whopping great
javascript behemoth which can be somewhere around 2mb if the original
python (pyjamas) source is around... 15 to 20,000 lines of code.

 from thereon in, you DO NOT do *any* HTML page "GETs": it's a one-
time static HTML/JS load, and THAT's IT.

 the only further interaction that we recommend is first and foremost
JSONRPC (and so, out of the 30 or so pyjamas wiki pages, about 10 of
them involve HOWTOs for interacting with django, pylons, web.py,
web2py, twisted and so on) and the second one, because you have to, is
HTTP POST of Multi-Part FORMs.

 even with the HTTP Forms, you _still_ don't have to leave the "main"
pyjamas (static JS) application page, because the GWT team, bless 'em,
came up with a way to do a hidden iframe which does the HTTP POST in
the background.  _well_ smart cookies, them GWT boys - and we just...
lifted it straight into python :)

 so there's _zero_ further "webuhhh pagizz lohdinn".

 we found some really smart cookie's jsonrpc server-side code, which
turns out to be a stonking JSONRPC service in under 30 lines of code,
where you can turn absolutely any python code, pretty much, into an
RPC service with one import line, one line of code and then one
decorator per function you want to be in the JSON RPC service.

 this approach, on its own, drastically simplifies python web service
development.  now your entire server-side web service is implemented
in terms of *data* _not_ the presentation-of-the-data-mixed-in-with-
the-data-and-oops-er-maybe-a-little-bit-of-javascript-oh-hell-actually-
it's-a-lot-of-javascript-and-oh-god-here-we-go-again-how-do-we-debug-
this?

the only down-side of this approach _would_ be that you'd now have to
do everything as a JSONRPC client, which if you were in "pure
javascript land" would truly be absolute hell on earth.

 _but_... as we're talking python... ta-daaa! easy :)

 ok, not _entirely_ easy, because it has to be done asynchronously.
make the call, then wait for a response, timeout or a server error -
but, guess what?  you can create a python class with functions
"onResponse", "onError" and "onTimeout" which will be called when the
function has completed (or not) on the server.  ta-daaa :)

 running example:
http://pyjs.org/examples/jsonrpc/output/JSONRPCExample.html

 pyjamas client-side code:
http://pyjs.org/examples/jsonrpc/JSONRPCExample.py

 so - pyjamas developers _don't_ have the same "juggling" problems
that the "average" advanced AJAX + web-service programmer has, because
everything's compartmentalised along MVC lines:

   http://www.advogato.org/article/993.html

 i would say that GWT developers don't have the same problems, but
because java is a strongly-typed language, they have a biatch-and-a-
half god-awful time carrying out type-casting of JSONRPC parameters
and the function return type when it comes back from the server,
_even_ though the target language of the compiler is dynamic -
javascript!

 poor things.  haw, haw :)

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


setprocname

2010-06-14 Thread Tomasz Pajor

Hello,

Why there is no setprocname function in standard library, or am I 
missing something?

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


Re: setprocname

2010-06-14 Thread Grant Edwards
On 2010-06-14, Tomasz Pajor  wrote:

> Why there is no setprocname function in standard library, or am I 
> missing something?

Dunno.  Before we start guessing, would you care to explain what you
think "setprocname" ought to do?

-- 
Grant Edwards   grant.b.edwardsYow! If I pull this SWITCH
  at   I'll be RITA HAYWORTH!!
  gmail.comOr a SCIENTOLOGIST!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUIs - A Modest Proposal

2010-06-14 Thread Stephen Hansen
On 6/14/10 11:47 AM, lkcl wrote:
> On Jun 14, 4:17 pm, Stephen Hansen  wrote:
>  yes.  that's effectively what pyjs applications are about: as much
> HTML/CSS as you can stand, then _absolute_ pure javascript from there-
> on in... only using a compiler (python-to-javascript) so as not to go
> completely insane - and, from the rest of your message, i _know_ you
> know what i'm talking about, there :)

Yeah. It sounds very interesting. I just wish it, like, somehow bundled
webkit cross-platformly. :)

>  to be absolutely honest, i very rarely even write my own widgets: i
> advocate that people, myself _especially_ myself included, perform
> literal line-for-line translations of GWT widgets from java to
> python.  why? because, again: on the basis that google have tons of
> money to put into GWT widgets, doing full regression tests, and have
> thousands of users, they can afford to get the widget right across all
> the browsers.  ergo, why duplicate that effort - just code-translate
> it verbatim!
> 
>  oh, btw, that's turning into quite a powerful project on its own: the
> goal is to have a fully automated java-to-python translator!
> 
>  http://github.com/thoka/java2python

Somehow this is getting perverse. Java, to Python, to JavaScript. It
just sounds sort of incestuous. :)

But also worth looking into for my next web project.

>> Traditional GUI models vs the web layout model are just alien to one
>> another, and the latter is -extremely- convoluted.
> 
>  we've found that there's a third "hybrid" case, and it's hinted at
> through RIA javascript libraries such as extjs: a traditional GUI
> model *implemented* as a web app.
> 
>  so those RIA JS libraries are not "vs", they're _both_.  except...
> javascript has its own headaches, so that's why both pyjamas and GWT
> remove _those_ headaches, by using language translators.

Well, yes. I have some experience with extjs (and making some pretty
fantastic real-world seeming apps on the web with it), and yeah,
removing Javascript headaches is a very interesting goal. (Pet peeve to
end all pet peeves: trailing commas in objects breaks IE. I always leave
trailing commas, always, in Python code: makes adding stuff easier
later. And I can't shake doing it in my javascript instinctively).

The current project occupying my time involves a fairly complicated mix;
on the server-side we have Pylons, but its interfacing with an external
application server, so about half of the Pylons layers are "outsourced"
(i.e., data and model access).

Then the web interface is ExtJS. Its just getting very, very -- ungainly
from a maintenance point of view. Maybe on its next iteration I'll look
into pyjamas.

>> Now, I do not know QT, but I know wx -- which is implemented
>> in temrs of gtk, so somehow the wx team got it working on GTK.
>>
>> wx uses a complicated recursive layout engine (unless you're mildly nuts
>> and try to do absolute layouts) which in all essence does *exactly* what
>> you are describing there.
> 
>  oooOo.  that's _very_ interesting to hear.  i'd assumed that there
> wouldn't be anything "beneficial" that wx would bring to the table, by
> using gtk.  ha.  that might be worthwhile doing a pyjd-wx port, then,
> after all.  hmm.

Well, I may have overstated it a little bit by mistake.

wx does not require you use this model, and it does not do it on its own
-- you do have to "design" the flow a little bit.

wx has two separate containment hierarchies. The first is a
hierarchical, parent->child relationship. This is what a lot of people
think is its layout: but its not. It has nothing to do with layout, but
instead its more about event propagation. Then again it can *affect*
layout (you can't lay out the child of PanelA in PanelB).

But the real layout system is based on the sizers. Every "container"
control can have a single sizer. This sizer can contain any number of
the children of the parent. It can choose to lay them out in any number
of basic ways: the horizontal box, vertical box, grid layout, flexgrid
layout, then a couple specialized ones. Each individual object in the
sizer can have any number of flags, such as align this way or that, add
this amount of border, and if the object should be expanded to fill the
available opposite-space. (This is complicated: basically, if you have a
Horizontal Box controlling a window, and you add three items into it,
they'll sit next to each other and not fill out either the horizontal or
vertical space. But if the first item is set to 'expand', then it will
fill out all the available *vertical* space that the sizer is allowed to
manage).

Then comes the most important setting: the proportion option. Here you
determine how much of the available primary space each given object
gets. If you have three objects, all proportion 1: then all will share
the horizontal space evenly, expanding to fill all available. If one is
2, and the others have 1... then they'll all expand, but one will have
2:1 of the size.

Now, while the s

Re: setprocname

2010-06-14 Thread Thomas Jollans
On 06/14/2010 08:41 PM, Tomasz Pajor wrote:
> Hello,
> 
> Why there is no setprocname function in standard library, or am I
> missing something?

why should there be one? what should it do?

This sounds like you expect there to be a wrapper of a C system call or
other libc function called "setprocname". There is no "setprocname"
manual page installed on my system, which suggests to me that there is
no such function, at least not in the GNU libc. I may be wrong.

What makes you expect the existence of this function, and on which platform?

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


Re: a +b ?

2010-06-14 Thread Thomas Jollans
On 06/14/2010 09:15 AM, Steven D'Aprano wrote:
> On Mon, 14 Jun 2010 12:24:59 +1000, Ben Finney wrote:
> 
>> With ‘reduce’ gone in Python 3 [0]
> ...
>> [0] http://docs.python.org/py3k/library/functions.html>
> 
> 
> It's not gone, it's just resting.

It's pinin' for the fjords.


(sorry ^^)

> 
> http://docs.python.org/py3k/library/functools.html#functools.reduce
> 
> 

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


Re: GUIs - A Modest Proposal

2010-06-14 Thread Stephen Hansen
On 6/14/10 12:16 PM, lkcl wrote:
>  from thereon in, you DO NOT do *any* HTML page "GETs": it's a one-
> time static HTML/JS load, and THAT's IT.
> 
>  the only further interaction that we recommend is first and foremost
> JSONRPC (and so, out of the 30 or so pyjamas wiki pages, about 10 of
> them involve HOWTOs for interacting with django, pylons, web.py,
> web2py, twisted and so on) and the second one, because you have to, is
> HTTP POST of Multi-Part FORMs.

AJAJ ftw.

(Yes, how you describe the situation is how I develop web apps, minus
the pyjamas and plus the wtf-javascript for the client side)

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Scheme/LISP faster than C/C++

2010-06-14 Thread Raymond Toy
On 6/14/10 1:53 PM, fortunatus wrote:
> For crying out loud, the best any compiler can do is make optimal
> machine language.  Many C compilers can do that over most inputs.  So

Is that why I had to use assembly code instead of C for some parts of my
previous projects?

There was even one example where the C compiler made spectacularly bad
code.  I only needed 6 pointer registers (the arch has 8), but the
compiler decided to use only one or two and spilled and reloaded them
from the stack for each use.  Yay!

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


Re: setprocname

2010-06-14 Thread MRAB

Grant Edwards wrote:

On 2010-06-14, Tomasz Pajor  wrote:

Why there is no setprocname function in standard library, or am I 
missing something?


Dunno.  Before we start guessing, would you care to explain what you
think "setprocname" ought to do?


I think it's to set the name of the OS process.

On Windows, for example, all Python processes are called "python.exe" or
"pythonw.exe", so if you have several running it's not clear which is
which.

Have a look at:

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


Standard Library SSL Module (was: Python OpenSSL library)

2010-06-14 Thread Michael Crute
On Mon, Jun 14, 2010 at 1:25 PM, Antoine Pitrou  wrote:
> That was not my question. My question was whether there was a reason to
> rewrite a separate OpenSSL-accessing library rather than contributing to
> improve the "hashlib" and "ssl" modules which are already part of the
> Python stdlib.

The ssl module in the standard library is currently just SSL wrappers
around sock objects while M2Crypto, PyCrypto and Evpy are all a more
complete implementation of the other cryptography and signing features
in OpenSSL. I think it would be really awesome to have a complete
OpenSSL wrapper in the Python standard library since crypto in Python
is somewhat of a pain today. If I wanted to work on something like
that what would be the best approach? Extend the ssl package? Create a
new crypto package?


-- 
Michael E. Crute
http://mike.crute.org

It is a mistake to think you can solve any major problem just with
potatoes. --Douglas Adams
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Convert .doc to .pdf

2010-06-14 Thread Colin J. Williams

On 14-Jun-10 10:01 AM, Marco Nawijn wrote:

On 14 jun, 13:19, Thales  wrote:

Good morning,

I need to convert some files from .doc to .pdf. I've googled it a
little bit and all the solutions I've found used the OpenOffice API,
but I can't use it.

Anybody knows a library that I can use to do it?

Thanks


What about using the win32 API and use the free  PDFCreator (http://
sourceforge.net/projects/pdfcreator/) PDF printer?

This should be very simple (code untested, but should be roughly OK):
- Instantiate MS/Word application
   >>  from win32com.client import Dispatch
   >>  app = Dispatch('Word.Application')
- Open your document
   >>  doc = app.Documents.Open("demo.doc")
- Print to PDF
   >>  app.ActivePrinter = "PDFCreator"
   >>  app.PrintOut()

The PrintOut call is a little tricky. I normally try to decode and
guess the Python call from the corresponding VisualBasic code I record
with the macro recording facility. I know there are more sophisticated
methods out there, but I never tried them.

Regards,

Marco

Or you could download and use OpenOffice, if there are few files to convert.

Colin W

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


Re: How to print via python on windows

2010-06-14 Thread Tim Golden

On 14/06/2010 7:29 PM, rantingrick wrote:

On Jun 14, 10:55 am, Tim Golden  wrote:

On 14/06/2010 16:31, loial wrote:


What is the easiest way to send a text file to a networked
printer from a python script running on windows?


http://timgolden.me.uk/python/win32_how_do_i/print.html



Hello Tim,

Thanks for posting this wonderful win32 info at your site. I have
used it quite extensively in the past and would like to know if you
are interested in adding a bit more to the code to this simplistic
example...


Thanks for taking the trouble to comment and ask. The challenge
always with putting up examples is deciding the point
at which enough is illustrated to make something useful; as opposed
to a more comprehensive example which then, perhaps, hides the wood
among too many trees. (Or something). My preference, on my own site
and when posting to this group, is towards the former: functional
brevity. Your suggestion for a fleshed-out example involving printer
setup is a good one, I think. Assuming I can find the time, I'll
try to put something together as a separate example.


... We need more than what the CommonDialog classes expose, although
some info on CD's would be helpful. Would you be interested in adding
some additional info to this wonderful site? And What about image
acquisition?


I'm very keen to add things. It just needs the right mixture of
perspiration and inspiration, as the expression has it. Most often
an example here starts as a question on this or the python-win32
lists so thanks for the suggestions. I will add them to the list.
(Of suggestions :) ).

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


Re: GUIs - A Modest Proposal

2010-06-14 Thread lkcl
On Jun 14, 7:30 pm, Stephen Hansen  wrote:
> On 6/14/10 11:47 AM, lkcl wrote:
>
> > On Jun 14, 4:17 pm, Stephen Hansen  wrote:
> >  yes.  that's effectively what pyjs applications are about: as much
> > HTML/CSS as you can stand, then _absolute_ pure javascript from there-
> > on in... only using a compiler (python-to-javascript) so as not to go
> > completely insane - and, from the rest of your message, i _know_ you
> > know what i'm talking about, there :)
>
> Yeah. It sounds very interesting. I just wish it, like, somehow bundled
> webkit cross-platformly. :)
>
> >  to be absolutely honest, i very rarely even write my own widgets: i
> > advocate that people, myself _especially_ myself included, perform
> > literal line-for-line translations of GWT widgets from java to
> > python.  why? because, again: on the basis that google have tons of
> > money to put into GWT widgets, doing full regression tests, and have
> > thousands of users, they can afford to get the widget right across all
> > the browsers.  ergo, why duplicate that effort - just code-translate
> > it verbatim!
>
> >  oh, btw, that's turning into quite a powerful project on its own: the
> > goal is to have a fully automated java-to-python translator!
>
> >  http://github.com/thoka/java2python
>
> Somehow this is getting perverse. Java, to Python, to JavaScript. It
> just sounds sort of incestuous. :)
>
> But also worth looking into for my next web project.
>
> >> Traditional GUI models vs the web layout model are just alien to one
> >> another, and the latter is -extremely- convoluted.
>
> >  we've found that there's a third "hybrid" case, and it's hinted at
> > through RIA javascript libraries such as extjs: a traditional GUI
> > model *implemented* as a web app.
>
> >  so those RIA JS libraries are not "vs", they're _both_.  except...
> > javascript has its own headaches, so that's why both pyjamas and GWT
> > remove _those_ headaches, by using language translators.
>
> Well, yes. I have some experience with extjs (and making some pretty
> fantastic real-world seeming apps on the web with it), and yeah,
> removing Javascript headaches is a very interesting goal. (Pet peeve to
> end all pet peeves: trailing commas in objects breaks IE. I always leave
> trailing commas, always, in Python code: makes adding stuff easier
> later. And I can't shake doing it in my javascript instinctively).
>
> The current project occupying my time involves a fairly complicated mix;
> on the server-side we have Pylons, but its interfacing with an external
> application server, so about half of the Pylons layers are "outsourced"
> (i.e., data and model access).
>
> Then the web interface is ExtJS. Its just getting very, very -- ungainly
> from a maintenance point of view. Maybe on its next iteration I'll look
> into pyjamas.
>
> >> Now, I do not know QT, but I know wx -- which is implemented
> >> in temrs of gtk, so somehow the wx team got it working on GTK.
>
> >> wx uses a complicated recursive layout engine (unless you're mildly nuts
> >> and try to do absolute layouts) which in all essence does *exactly* what
> >> you are describing there.
>
> >  oooOo.  that's _very_ interesting to hear.  i'd assumed that there
> > wouldn't be anything "beneficial" that wx would bring to the table, by
> > using gtk.  ha.  that might be worthwhile doing a pyjd-wx port, then,
> > after all.  hmm.
>
> Well, I may have overstated it a little bit by mistake.

 he he. rats!

> wx does not require you use this model, and it does not do it on its own
> -- you do have to "design" the flow a little bit.
>
> wx has two separate containment hierarchies. The first is a
> hierarchical, parent->child relationship. This is what a lot of people
> think is its layout: but its not. It has nothing to do with layout, but
> instead its more about event propagation.

 oh crap, yeah, i forgot about that.  event propagation rules.  darn
it.  y'know what?  forget it - i might as well, seriously, help
implement an entire modern web browser in python, and use that.

> Ahem. /Rant. I'm not saying its the best layout system in the world, but
> like your DOM/HTML example -- its resolution independant (and
> cross-platform), so you can start resizing things and changing the
> window size and it all reflows things as the window resizes. Lots of
> toolkits can do that, but I just really find the sizer approach both
> flexible and very powerful to achieve very usable interfaces. (And its
> very web-like, except the semantic difference of the two hierarchies)

 *sigh* i think i'm just going to have to try it, just to find out.  i
can't have me saying "all desktop widget sets are rubbish!" if i
haven't _actually_ gone and done my homework, can i?


> >  from there, you just... open it up in a web browser, just like you
> > would any other HTML/CSS/Javascript app.
>
> Well, I got that much; I more meant the Pyjamas-Desktop thing.

 ohh, right - sorry.

> It makes
> regular "seeming" application/client-based user 

Re: setprocname

2010-06-14 Thread John Nagle

On 6/14/2010 12:31 PM, Thomas Jollans wrote:

On 06/14/2010 08:41 PM, Tomasz Pajor wrote:

Hello,

Why there is no setprocname function in standard library, or am I
missing something?


why should there be one? what should it do?

This sounds like you expect there to be a wrapper of a C system call or
other libc function called "setprocname". There is no "setprocname"
manual page installed on my system, which suggests to me that there is
no such function, at least not in the GNU libc. I may be wrong.

What makes you expect the existence of this function, and on which platform?


   This is useful if you're running some web app that has many
processes running, and you'd like some indication of who's doing
what for debugging and administration purposes.  Some daemons change 
their title as they run to indicate what they're doing.  Do a "ps ax"

on Linux, and you'll see some examples.

   (If the original poster simply wants to change the name in the
window of a GUI app, that's a function of the GUI.)

   BSD systems support "setproctitle", which changes the name of the
program visible in "ps", "top", etc.

   Linux doesn't have "setproctitle".  Linux 2.6.9 and later, though,
have a PR_SET_NAME function in "prtcl", to set the process name.

   There's a way to do this in Windows.  Look in Task Manager,
with a browser running, and the description for each Firefox
instance will show the page being displayed.

   Perl supports program name changing.  Storing into "$0"
does the appropriate platform-specific thing behind the
scenes.

   It's a reasonable capability to have in Python.  I have an
application which has a large number of copies of the same Python
program running on a server, and it would be useful to be able to
see, in "ps" and "top", which one was doing what.

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


Re: setprocname

2010-06-14 Thread Grant Edwards
On 2010-06-14, MRAB  wrote:
> Grant Edwards wrote:
>> On 2010-06-14, Tomasz Pajor  wrote:
>> 
>>> Why there is no setprocname function in standard library, or am I 
>>> missing something?
>> 
>> Dunno.  Before we start guessing, would you care to explain what you
>> think "setprocname" ought to do?
>> 
> I think it's to set the name of the OS process.
>
> On Windows, for example, all Python processes are called "python.exe" or
> "pythonw.exe", so if you have several running it's not clear which is
> which.

The Windows task manager won't display the entire command line, so
there's now way to know what's what?  Seems like a problem in the
windows task manager to me...

I must admit that being able to use "killall" on a Python/Java/Bash
program would be handy sometimes.

-- 
Grant Edwards   grant.b.edwardsYow! Is something VIOLENT
  at   going to happen to a
  gmail.comGARBAGE CAN?
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >