Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Michele Simionato
On Oct 6, 12:57 pm, Bruno Desthuilliers
> Michele Simionato a écrit :
>
> > I looked at the source code and it seems fine to me, but I have
> > not used it directly, not stressed it. I need a
> > production-level WSGI session middleware and I wonder what the
> > players are (for instance how Beaker does compare with flup?)
>
> Can't tell, but I'd trust the Pylons team on this kind of choices.
> They're doing good job so far AFAICT.

Probably Beaker works well, but it is certainly NOT doing things
as Eby recommends:

http://dirtsimple.org/2007/02/wsgi-middleware-considered-harmful.html

BTW, I know that Eby is asking opinions about WSGI 2.0 on the
WSGI SIG and interested people may have a look there.

   Michele Simionato

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


Top Programming Languages of 2013

2007-10-06 Thread Dick Moores


Dick Moores

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


Re: How to create a file on users XP desktop

2007-10-06 Thread Matimus
On Oct 6, 8:31 pm, goldtech <[EMAIL PROTECTED]> wrote:
> Can anyone link me or explain the following:
>
> I open a file in a python script. I want the new file's location to be
> on the user's desktop in a Windows XP environment.  fileHandle = open
> (., 'w' )  what I guess I'm looking for is an environmental
> variable that will usually be correct on most XP desktops and will
> work in the open statement. Or is there another way?
>
> Thanks

I've always used 'USERPROFILE'. I'm not sure how standard it is, but I
have never run into any issues.

Code for your perusal:
[code]
import os, os.path
prof_path = os.environ['USERPROFILE']
filename = os.path.join(prof_path,'Desktop','filename.txt')
f = open(filename,'w')
try:
# do stuff with f
finally:
f.close()
[/code]

Matt

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


Re: How to create a file on users XP desktop

2007-10-06 Thread Scott David Daniels
goldtech wrote:
> ... I want the new file's location to be on the user's desktop in 
> a Windows XP environment
> 
How about:
 import os.path
 handle = open(os.path.expanduser(r'~\DeskTop\somefile.txt'), 'w')
 ...

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


Re: How to create a file on users XP desktop

2007-10-06 Thread [EMAIL PROTECTED]
On Oct 6, 11:31 pm, goldtech <[EMAIL PROTECTED]> wrote:
> Can anyone link me or explain the following:
>
> I open a file in a python script. I want the new file's location to be
> on the user's desktop in a Windows XP environment.  fileHandle = open
> (., 'w' )  what I guess I'm looking for is an environmental
> variable that will usually be correct on most XP desktops and will
> work in the open statement. Or is there another way?
 This is really a Windows question, not a Python question. You should
have been able to figure it out yourself by examining existing
environment variables.
 Something like the code below should work for you if the standard
environment variables haven't been hosed.
--
import os
Filename = os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH") + "\\Desktop
\MyNewFile"
f = file(Filename, "w")
f.write("Here's a file on the desktop\n")
f.close()



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


Re: reliable unit test logging

2007-10-06 Thread Gabriel Genellina
En Wed, 03 Oct 2007 11:37:57 -0300, Vyacheslav Maslov <[EMAIL PROTECTED]>  
escribi�:

> I have one more question related to logging module, not unit test. I use
> FileHandler to append information to file log, in fact location of log
> file depends on some external factor and is calculated during
> initialization. Furthermore i want to use configuration file because it
> is comfortable way. So i need way to define in configuration file some
> variable which should evaluated during logging system initialization, i
> try following way:
>
> [handler_hand02]
> class=FileHandler
> level=NOTSET
> formatter=form01
> args=(logFileDir+"myfile.log","a",)
> logFileDir is defined in scope of module which call
> logging.config.fileConfig()
>
> and it produces "name 'logFileDir' is not defined" exception. As i
> understand this happens because inside logging module variable
> logFileDir is not visible. How i can avoid this?

logging.config uses the ConfigParser class; ConfigParser has some  
interpolation mechanism.
I think this should work (but I've not tested it):

[handler_hand02]
class=FileHandler
level=NOTSET
formatter=form01
args=("%(logFileDir)s"+"myfile.log","a",)

and call it using logging.config.fileConfig({"logFileDir":  
"your/desired/path"})

-- 
Gabriel Genellina

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

Re: How to create a file on users XP desktop

2007-10-06 Thread Josh Bloom
I believe you can use something like '%USERPROFILE%\DESKTOP' as the path on
a windows machine to get to the current users desktop directory. I'm not
sure if the python open() command will expand that correctly, but give it a
shot.

-Josh


On 10/6/07, goldtech <[EMAIL PROTECTED]> wrote:
>
> Can anyone link me or explain the following:
>
> I open a file in a python script. I want the new file's location to be
> on the user's desktop in a Windows XP environment.  fileHandle = open
> (., 'w' )  what I guess I'm looking for is an environmental
> variable that will usually be correct on most XP desktops and will
> work in the open statement. Or is there another way?
>
> Thanks
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: embedding python..

2007-10-06 Thread Gabriel Genellina
En Fri, 05 Oct 2007 20:40:40 -0300, [EMAIL PROTECTED]  
<[EMAIL PROTECTED]> escribi�:

>  I compiled the c program that is supposed to allow you to call a
> procedure from the command line promt..  (it is from the embeding
> example)..  I am a little confused as to what all I am supposed to
> distribute to make it work..  Do I just need the python .dll for the
> version I compiled or is it working with the installed version of
> python.. (I don't want to start deleting stuff to find out)..  Any
> help on this question would be apreaceated..

If you only provide pythonXX.dll (and probably msvcr71.dll), any Python  
code that tries to import any module apart from builtin modules will fail.  
If you provide the Python standard library in full, almost any program  
could be run.
It's up to you to decide how much you require/allow/want to provide.

-- 
Gabriel Genellina

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

How to create a file on users XP desktop

2007-10-06 Thread goldtech
Can anyone link me or explain the following:

I open a file in a python script. I want the new file's location to be
on the user's desktop in a Windows XP environment.  fileHandle = open
(., 'w' )  what I guess I'm looking for is an environmental
variable that will usually be correct on most XP desktops and will
work in the open statement. Or is there another way?

Thanks

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


Re: Need help to understand garbage collection

2007-10-06 Thread Gabriel Genellina
En Sat, 06 Oct 2007 14:16:36 -0300, David Tremouilles  
<[EMAIL PROTECTED]> escribi�:

> I would need help to understand how garbage collection work and how to
> "trace" objects...
> In the example below an object is created and deleted.

Not exactly: an object is created and bound to the name "a". Some code is  
executed... Later, the name "a" is removed; the object's reference count  
is decremented, but the object itself can only be removed when the r.c.  
goes to zero.

> Why in the second part of the example I do not see any object removed:

Because you still hold a reference to the object.

-- 
Gabriel Genellina

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

Tkinter text widget

2007-10-06 Thread goldtech
I thought the "DISABLED" made it so I could not edit it. But it also
makes it so I can not scroll down. If you make the window smaller than
the content then try to put a cursor in there to use up/down arrow you
can't.

What I want is not to be able to change text content, but no other
action is disabled. Is this complicated to do?

Thanks.


from Tkinter import *
root = Tk()
text = Text(root, font=("Courier"))
text.pack()
i='123456789abcdefghijklmnopqrstuvwxyz\n'
for x in range(30):
text.insert(END, i)
text.config(state=DISABLED)
mainloop()

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


Re: Where's the Starship's crew?

2007-10-06 Thread Christian Tismer
exhuma.twn wrote:
> On Oct 5, 10:31 am, Dick Moores <[EMAIL PROTECTED]> wrote:
>> 
>>
>> I didn't check on all of them, but the only one I found was Mark
>> Hammond .
>>
>> Dick Moores
> 
> Doing 6 random clicks, revealed:
> 
> http://starship.python.net/crew/hooft/
> 
> all the others are dead links. I realised this fact as well some time
> ago already. I thought the page itself was still "in development" and
> did not find a single one page. These two obviously eluded me ;)

There are actually 20 active links, different from the error default.
Ok, this is not the best result for a total of 273 members.

> Strange to see that the situation did not yet improve. But then again,
> we all probably know how much of a hassle it is to keep 10 different
> web-pages with personal info's up-to-date. I suppose that the starship
> crew all have som homes elsewhere and don't find the time to update
> yet another page.

No, I think the Starship lost a lot of its popularity after a couple
of havaries, and its initiator failed to lead it and to push it
further. I think this is something that needs to be done by somebody.
There was a couple of very helpful supporters, but they were all
on their own, and the originally driving person did not care
any longer for many years. This has changed.

> I myself don't even bother anymore at all. I have
> about 2 hours of free time per day (given that I like to sleep a
> lot!). What makes things worse, the network at work is completely cut
> off from the rest of the world for security reasons. I am happy that I
> at least can access usenet by using google-groups *sigh*.

So you have HTTP access?
Then ask the starship to support that!
I will take care!

> An interesting task might be to find the homes of the starship crew,
> and post them here? Maybe? If lucky, the right person picks this up
> and updates the crew-quarter labels of the starship. Or would
> "Turbolift Buttons" be a better analogy for hyperlinks? Args.
> Supposing, that these turbolifts *do* have buttons. How retro! ;)

The Starship has gone through quite some problems and different hands.
They all were good, and I wish to thank Stefan Drees especially
for hosting it alone for four years from his personal budget.
Not to forget the years where we were hosted by zope.org, and
beopen.com, and some Service created by Mike Mc. Lay before.
Please excuse me, the I don't remember all the details, this
will go into a history page or blog ASAP.

After a long journey through space and time, I am getting back at
my roots, and I want to fill the gap of a driving person, again.
This is not selfish in any way, and not saying that it must be
me at all, but somehow I feel the wish to bring something to
a working future that I started long time ago.

I invented, created and hosted the Starship, ten years ago.
Now I think, after spending a lot of time with other projects
like Stackless Python and PyPy, time has come to redo the Starship
idea, which was my first contribution for the Python community,
a time where I was not able to really contribute by code.
Especially, I could not work on the Python core because I was no
C programmer. So I created Starship, learned C, understood all
the internals and invented Stackless.

But after all, I think I owe the Starship a lot, and I want it to
continue, and to become a valued resource, again. As a starter,
I moved the ship to my stackless server, this time using OpenVZ.

This transfer worked much smoother than expected; I consider
OpenVZ a great piece of software.

The Starship is therefore right now not very different from its
outside view, it was just moved and upgraded. That is just the
beginning. To turn it into a resource of desire, again, a row
of improvements are necessary.

My personal vision, amoung new projects, is to split my time
between Starship, Stackless and PyPy. If that works depends
on the goodwill of sponsors. But it has worked, so I believe it
will work, again.

--

Here is an incomplete list of things that I want to do or initiate.

First, I want to revive as many as crew homes that are archived.
This will fill the tiny list from above, reasonably, and probably
it will result in people updating their outdated pages.

Then, I want to split the Starship into many sub-sites, first
on my server, then by using a lot of more servers. I am seeking
for sponsors who are willing to support this.

In the end, my vision is turning python.net into a real network
of many servers, each running a very small number of services
through openVZ. Python.net should be something like a server farm,
which runs everything available in Python. Really everything,
including the myriads of possible PyPy builds.

I want to separate all of these things by utilizing OpenVZ,
as fine-grained as makes sense. I am investigating this these days.
Right now, the Starship is a single VE. It will turn into a growing
set of smaller 

esvect and reflectbox

2007-10-06 Thread Tom Jones
Hi,

I am trying to create a leftarrow of \vv{}.  I thought I could just 
reflect the vector, but the solution has escaped me.  Could someone help 
me out?

[EMAIL PROTECTED]
   [EMAIL PROTECTED]
\cleaders\hbox{$#4\mkern0mu#2\mkern0mu$}\hfill%
\mkern-1.5mu#3$%
}

was replaced with

[EMAIL PROTECTED]
   [EMAIL PROTECTED]
\cleaders\hbox{$#4\mkern0mu#2\mkern0mu$}\hfill%
\mkern-1.5mu#3$}%
}

But the result is incorrect (the vector does not fill properly).

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


Re: Segmentation fault..

2007-10-06 Thread Bjoern Schliessmann
Abandoned wrote:
> I run a my script and 3-4 minutes later give me an error
> "segmentation fault".
> What is the reason of this error ?

The reason is that the process tries to write to a memory address it
outside of its allocated segments.

Regards,


Björn

-- 
BOFH excuse #20:

divide-by-zero error

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


Re: Howto Launch a windows application ?

2007-10-06 Thread stef mientki
I finally found out what was wrong:

stef mientki wrote:
> hello,
>
> I'm trying to launch a windows application,
> but as many others on this list, I've some trouble.
> I read some other threads about this topic,
> but sorry, I still don't understand all this (never heard of pipes).
>
> When I use a batch file, I can launch the bat-file from python,
> and the windows application launched from the batchfile is run perfectly.
>
> Now when I try to run the same windows application from Popen or call,
> nothing happens (or at least it's very fast and produces not the 
> expected output).
>
> Please enlighten me, preferable in "windows-terminology"  ;-)
>
> thanks,
> Stef Mientki
>
> from subprocess import *
>
> cmd =[]
> cmd.append ( 'D:\\PIC-tools\\JALxxx\\jalv2_3.exe' )
> cmd.append ( '-long-start' )
> cmd.append ( '-d')
> cmd.append ( '-clear' )
> cmd.append ( '-sD:\\PIC-tools\\JAL\\libs2' )
> cmd.append ( 
> 'd:\\pic-tools\\jal\\programs\\test_rs232\\test_rs232_hw.jal' )
> cmd.append ( '>d:\\data_actueel\\d7_test_browser\\temp.log' )
>
> # DOESN'T WORK
> result = call ( cmd )
>
> # Both Popen and call work
> cmd = [ 'd:\\data_actueel\\d7_test_browser\\JALcc.bat' ]
> #output = Popen ( cmd )
> result = call ( cmd )
> print result
>
subprocess performs double quoting (necessary for paths with spaces) 
automatically.
Therefor both the following lines:
cmd.append ( '-sD:\\PIC-tools\\JAL\\libs2' )
cmd.append ( '>d:\\data_actueel\\d7_test_browser\\temp.log' )
should become
cmd.append ( '-s' )
cmd.append ( ' D:\\PIC-tools\\JAL\\libs2' )
cmd.append ( '>' )
cmd.append ( 'd:\\data_actueel\\d7_test_browser\\temp.log' )
then everything works perfect, also with the convenience call "call"
and the redirection.

thank you all for the hints,
cheers,
Stef Mientki


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


Re: which language allows you to change an argument's value?

2007-10-06 Thread John W. Kennedy
Roedy Green wrote:
> On Sun, 30 Sep 2007 10:47:13 -, Summercool
> <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone
> who said :
>> and now n will be 3.  I think C++ and PHP can let you do that, using
>> their reference (alias) mechanism.  And C, Python, and Ruby probably
>> won't let you do that.  What about Java and Perl?

> Seem to me you could in FORTRAN and Pascal, and maybe even Algol. 

FORTRAN generally looked like call by reference, but was often actually 
implemented element variables as copy-in at call time and copy-out at 
return time. In standard older FORTRAN, the effective results were the 
same. I don't know how things stand with modern Fortran, where some new 
features have made the assumption that copy-in-copy-out is equivalent to 
reference more dangerous. Ada is /defined/ as using copy-in-copy-out for 
element variables.

ALGOL had a weird "by name" convention. The semantics were essentially 
that, for each argument, a closure (historically called a "thunk") was 
constructed, and every time the parameter was referenced, the 
corresponding closure was called. Theoretically elegant, but hideous to 
implement, and with bizarre side-effects in certain cases.
-- 
John W. Kennedy
Read the remains of Shakespeare's lost play, now annotated!
http://pws.prserv.net/jwkennedy/Double%20Falshood/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Magazine: Issue 1 Free!

2007-10-06 Thread Bruno Desthuilliers
Terry Reedy a écrit :
> "Steve Holden" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> | I've just been told by the editors at Python Magazine that the first
> | issue is out. It's all-electronic so anyone can download and read it.
> | Let them know what you think:
> |
> |   http://www.pythonmagazine.com/c/issue/2007/10
> 
> OK.  Given that my (widescreen) monitor, like most current monitors, does 
> not rotate into the portrait mode that would display a whole page, double 
> column pdf files are painful to read on a screen.  Up and down, up and 
> down.  And the color pages cannot be sensibly printed  on a b/w printer, 
> even if I wanted to go to paper (which is what pdf was meant for), which I 
> do not.  Mismatching electronic documents to the screens they are most 
> commonly read on is to me at least shortsighted.  So I suggest that you 
> also produce a readable html version. 

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


Re: Adding behaviour for managing "task" dependencies

2007-10-06 Thread Bruno Desthuilliers
David a écrit :
>>Any thoughts would be most appreciated, though I would like to stress
>>that I don't think Python should support the syntax I'm proposing I'd
>>just like to know if I can extend a copy of it to do that.
>>
> 
> 
> You can use syntax like this:
> 
> class MyJob1(Job):
> depends(MyJob2)
> depends(MyJob3)
> 
(snip)
> (where 'depends' is a DSL-like construct. See Elixir
> (elixir.ematia.de) for an example of how to implement DSL statements
> like "depends". Check their implementation of the "belongs_to"
> statement.

+1 on this. I've payed a bit with elixir's 'statements' API, and while 
it's relying on a (in)famous hack, it does the job.

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


Re: Create a string array of all comments in a html file...

2007-10-06 Thread Stefan Behnel
sophie_newbie wrote:
> Hi, I'm wondering how i'd go about extracting a string array of all
> comments in a HTML file, HTML comments obviously taking the format
> "".
> 
> I'm fairly stumped on how to do this? Maybe using regular expressions?


   from lxml import etree

   parser = etree.HTMLParser()
   tree = etree.parse("somefile.html", parser)

   print tree.xpath("//comment()")


http://codespeak.net/lxml

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


Re: Cross platform way of finding number of processors on a machine?

2007-10-06 Thread Nick Craig-Wood
Lawrence Oluyede <[EMAIL PROTECTED]> wrote:
>  John <[EMAIL PROTECTED]> wrote:
> > Is there a way to find the number of processors on a machine (on linux/
> > windows/macos/cygwin) using python code (using the same code/cross
> > platform code)?
> 
>  From processing  :
> 
>  def cpuCount():
>  '''
>  Returns the number of CPUs in the system
>  '''
>  if sys.platform == 'win32':
>  try:
>  num = int(os.environ['NUMBER_OF_PROCESSORS'])
>  except (ValueError, KeyError):
>  pass
>  elif sys.platform == 'darwin':
>  try:
>  num = int(os.popen('sysctl -n hw.ncpu').read())
>  except ValueError:
>  pass
>  else:
>  try:
>  num = os.sysconf('SC_NPROCESSORS_ONLN')
>  except (ValueError, OSError, AttributeError):
>  pass
>  
>  if num >= 1:
>  return num
>  else:
>  raise NotImplementedError


There is a bug in that code...

NotImplementedError will never be raised because num won't have been
set.  It will raise "UnboundLocalError: local variable 'num'
referenced before assignment" instead

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


setuptools on mac

2007-10-06 Thread Calvin Spealman
I am trying to install the newest setuptools on my macbook. 2.3 was
installed by default, and 2.4 is installed and is my default version
now. However, when I try to import setuptools, which is required to
_install_ setuptools, I get this error:

macbkpro1:~/Desktop/setuptools-0.6c7 ironfroggy$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 7, in ?
execfile(convert_path('setuptools/command/__init__.py'), d)
  File "setuptools/command/__init__.py", line 13, in ?
from distutils.command.bdist import bdist
  File 
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distutils/command/bdist.py",
line 29, in ?
class bdist (Command):
  File 
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distutils/command/bdist.py",
line 33, in bdist
user_options = [('bdist-base=', 'b',
  File 
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distutils/util.py",
line 78, in get_platform
cfgvars = get_config_vars()
  File 
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distutils/sysconfig.py",
line 488, in get_config_vars
func()
  File 
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/distutils/sysconfig.py",
line 373, in _init_posix
raise DistutilsPlatformError(my_msg)
distutils.errors.DistutilsPlatformError: $MACOSX_DEPLOYMENT_TARGET
mismatch: now "10.4" but "10.3" during configure
macbkpro1:~/Desktop/setuptools-0.6c7 ironfroggy$

-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xml modifications

2007-10-06 Thread dcleaner
Bruno Desthuilliers <[EMAIL PROTECTED]>
wrote in news:[EMAIL PROTECTED]: 

> dcleaner a écrit :
>> hi there...i'm a begginer level user and i've stumbbled upon a
>> problem a bit beyond my knowledge. i hope that somebody will be able
>> to help me with my problem...
>> 
>> the problem is: i'm transforming an Access database to XML
> 
> Strange idea IMHO, but anyway...
> 
>> with some 
>> adjustements. basicaly i have one main table in which i have my main
>> data and keys to other tables containing other relevant data.
>> after exporting my main table to xml i have in some tags only keys to
>> other tables. and now i want to change those keys to meaningful data.
>> for instance: after exporting, i have a line like this:
>> 1, and i want to change it to be just an opening tag for
>> something else; .the data which must be
>> written in attr1 and attr2 depends upon the number (in this case
>> number 1) inside  the tag (tagZ).
> 
> And where's your problem exactly ?-)
> 
> More seriously: you don't explain how you export your database to XML,
> so it won't be easy to help.
> 
> What I'd personnaly do would be to use the db-api (or whatever 
> appropriate for accessing a .mdb) and a templating system (like genshi
> or mako or...) to build the xml file. In which case there's no problem
> accessing the related tables (that's what SQL is for, isn't it ?).
> 
> Now if you hope to get some serious help, you probably want to give
> more details...
> 

the tool i used to transform from mdb to xml was the microsoft's access itself 
(2007 
version). i only exported one table for now which is my main table, from the 
others i 
want to extract data so that i could put in inside the newly formed xml. hmm... 
in 
short i want to have everything in one xml file...
about sql database... i'm using xml because i want it to be able to run offline.
-- 
http://mail.python.org/mailman/listinfo/python-list

Need help to understand garbage collection

2007-10-06 Thread David Tremouilles
I would need help to understand how garbage collection work and how to
"trace" objects...
In the example below an object is created and deleted.
Why in the second part of the example I do not see any object removed:

import gc
class Test(object):
def __init__(self):
pass


gc.collect()
original_objects_id = [id(x) for x in gc.get_objects()]
#create object a
a = Test()
gc.collect()
new_objects = [x for x in gc.get_objects()
   if id(x) not in original_objects_id]
print "-" * 40
print "Added object:", len(new_objects)
for obj in new_objects:
print "*" * 10
print str(id(obj)) + ":" + str(obj)
print gc.get_referents(obj)
print "*" * 3
print "-" * 20

gc.collect()
original_objects_id = [id(x) for x in gc.get_objects()]
#remove object a
del a
gc.collect()
after_rm_objects_id = [id(x) for x in gc.get_objects()]
removed_objects_id = [x for x in original_objects_id
   if x not in after_rm_objects_id]
print "-" * 40
print "Removed objects:", len(removed_objects_id)
print removed_objects_id
print "-" * 20

Which give:


Added object: 2
**
400600:[[...], <__main__.Test object at 0x62bd0>]
[<__main__.Test object at 0x62bd0>, [[...], <__main__.Test object at 0x62bd0>]]
***
**
404432:<__main__.Test object at 0x62bd0>
[]
***


Removed objects: 0
[]

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


help on understanding garbage collection

2007-10-06 Thread David Tremouilles
Hello,

 I would need help to understand how garbage collection work and how
to "trace" objects...
An example is joined where and object is created and deleted.
Why in the second part of the example I do not see any object removed:
"

Removed objects: 0
[]

"

Thanks for your help,

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


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Bruno Desthuilliers
Michele Simionato a écrit :
> On Oct 6, 9:13 am, Bruno Desthuilliers  [EMAIL PROTECTED]> wrote:
>> - talking about routes, you say:
>>
>> """
>> I have no Ruby On Rails background, so I don't see the advantages of routes.
>> """
>>
>> I don't have any RoR neither, but as far as I'm concerned, one of the
>> big points with routes is url_for(), that avoids having too much
>> hard-coded urls.
> 
> Well, url_for is convenient, I would not deny it. Still it is
> not compelling to me.

To me, yes - but the context probably makes some difference here. 
Anyway, even for apps I developped with older versions of Django or for 
Trac plugins, I missed this feature. I like being able to reorganize my 
url space, and having urls knowldege all over is very bad IMHO. While 
perhaps not the ultimate solution (is there one), routes does a good job 
with this IMHO.

(snip)

>> - about SQLAlchemy : here again, I used this package prior any
>> experience with Pylons. FWIW, I used it in the most basic, 'low-level'
>> way, ie without any ORM stuff, and I found it to be a pretty good
>> alternative to db-api. It's a bit complex, but powerful, and having the
>> possibility to handle sql requests as Python objects (instead of raw
>> strings) really helps.
> 
> I have wanted to do a serious test of SQLAlchemy for a
> couple of years, but never found the time :-(

Then rejoice : you'll have a better package to test, with better 
documentation !-)

> Do you (or something else) have something to say about Beaker?

Sorry, not so far. As I mentionned, I had to delay serious work with 
Pylons so far.

> I looked at the source code and it seems fine to me, but I have
> not used it directly, not stressed it. I need a
> production-level WSGI session middleware and I wonder what the
> players are (for instance how Beaker does compare with flup?)

Can't tell, but I'd trust the Pylons team on this kind of choices. 
They're doing good job so far AFAICT.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Kay Schluehr
> I really, really like Django (and its community and the competence of
> the developers) and I think it deserves what it has gained and more but
> we are not here to decide who's the best (there's always no best).

+1 QOTW

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


Re: How to do transparent (opaque) windows from Python

2007-10-06 Thread Matimus
On Oct 6, 8:21 am, Don Taylor <[EMAIL PROTECTED]> wrote:
> I want to build an application in Python that can show an opaque window
> so that you can still see and type into any window that it covers.
>
> Sort of like a software mylar transparency sheet placed over the screen.
>   I need to be able to type 'through' the transparency into the
> underlying application, focus remains on the underlying window.
>
> My application is assisted typing, but I can envisage other uses such as
>   on-screen rulers.
>
> While I would like this to be multi-platform, I need it in MS-Windows.
>
> Does anyone know of any Python packages that can do this type of thing?

I don't think opaque means what you think it means:
http://mw1.merriam-webster.com/dictionary/Opaque. The best option for
transparency is probably to look at the .NET framework in Windows, via
IronPython. I only say that because I know that I've seen demos of
transparent windows in .NET that were native to Windows and simple to
implement. I don't know if you can do transparency in wx, but I would
certainly check out the wxPython demos first to see if it has
anything. http://www.wxpython.org. wxpython would give you cross
platform support, if it works.

Matt

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


Re: Segmentation fault..

2007-10-06 Thread Jorge Godoy
Bruno Desthuilliers wrote:

> Jorge Godoy a écrit :
>> Without seeing any code, it is hard to say anything.  But the answer to
>> the ultimate question is "42".
> 
> Indeed. Err, what was the question, exactly ?-)

As soon as calculations are finished, you'll know. :-)
-- 
http://mail.python.org/mailman/listinfo/python-list

How to do transparent (opaque) windows from Python

2007-10-06 Thread Don Taylor
I want to build an application in Python that can show an opaque window 
so that you can still see and type into any window that it covers.

Sort of like a software mylar transparency sheet placed over the screen. 
  I need to be able to type 'through' the transparency into the 
underlying application, focus remains on the underlying window.

My application is assisted typing, but I can envisage other uses such as 
  on-screen rulers.

While I would like this to be multi-platform, I need it in MS-Windows.

Does anyone know of any Python packages that can do this type of thing?

Thanks,

Don.

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


Re: unit testing

2007-10-06 Thread Ben Finney
Paul Rubin  writes:

> Ben Finney <[EMAIL PROTECTED]> writes:
> > Or even better:
> > 
> > def test_raises_good_exception():
> > try:
> > thingy()
> 
> Well if we're grading on style, maybe you really want to name the
> function 'test_thingy' instead of 'test_raises_good_exception'.

The function is a test case. It should be named for what specific case
it's testing.

A function named "test_thingy" (given the code unit is a function
named "thingy") would be some generic "do *all* the tests for
thingy". That's not a test case; perhaps it's the name of the unit
test module for "thingy".

-- 
 \ "I must have a prodigious quantity of mind; it takes me as much |
  `\  as a week sometimes to make it up."  -- Mark Twain, _The |
_o__)Innocents Abroad_ |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WebBased Vector 2D Graphics

2007-10-06 Thread Dorai
On Oct 5, 4:28 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
>  [EMAIL PROTECTED] wrote:
> > Hi there
>
> > I currently have a Python program outputing to the command line,
> > durations of 'completed Steps' and 'data items' in relation to time
> > i.e.
>
> > --jfh
> >   -kl//kl started after jfh finished
> > % Ds  //new data arrived at this point in time
> > ---pl (1)  //Details error with finsihed Step
> >*kl  // This step is now outputed but
> > due to error with pl is cancelled (no duration)
>
> > I am new to doing any web based development and don't have a clue
> > where to start! I just wondered what is the best way to output this
> > program to a web page graphically.
>
> > I want to be able to represent these durations "-" as rectangles
> > and as the program runs the page will refresh every 10 seconds, thus
> > the boxes will expand with time until they have finished. New data
> > will also be represented in boxes with a different colour. I believe
> > some kind of script will have to be run which constantly updates the
> > html page after x seconds which then causes the web page to refresh
> > with the updated data.
>
> > Is there any way this web programming can be done in python. Or
> > perhaps I can use soemthing such as ajax?
>
> > As mentioned previously, I have never done any web based development
> > so don't really know what I'm talking about when trying to understand
> > how I can go from this Python program output to producing some
> > graphical output on a web page.
>
> You certainly need to get on speed with webdevelopment. Otherwise you will
> fail miserably.
>
> There are several options here:
>
>  - rendering a server-side image, deliver that embedded in a html-page
>
>  - render using html tags like DIV and the like, which allow for positioned
> colored rectangles and text, in pixel coordinates
>
>  - canvas tag, to render 2D-drawing-commands
>
>  - embedded SVG
>
> All that can be enriched with AJAX to have that fancy
> realtime-update-thingy.
>
> Diez

Great ideas.

Another approach would be to generate some simple metadata (simple
text, json or xml) on the server and use a javascript libraries (like
http://www.openjacob.org/draw2d.html). SVG is a more generic version
of this approach.

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


Re: slice with negative stride

2007-10-06 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

>>> mystr = 'my string'
> 
> I would have then thought of the contents of mystr as:
> 
> indices0 1 2 3 4 5 6 7 8
> contentm y   s t r i n g
> 
> with mystr[:3] = 'my '
> 
> Can someone explain to me how mystr[:3:-1] = 'gnirt'?

A slice [i:j:k] includes the first index (i) but *not* the last index 
(j).  Since you're stepping backwards, the slice will start at the end 
of the string (i=len(mystr)-1=8) and stop when it reaches j=3.

 >>> mystr[8]
'g'
 >>> mystr[7]
'n'
 >>> mystr[6]
'i'
 >>> mystr[5]
'r'
 >>> mystr[4]
't'



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


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Lawrence Oluyede
Tim Chase <[EMAIL PROTECTED]> wrote:
> Any respectable comparison of Python web frameworks should
> include evaluation of at least Django and TG.  Or at least give
> good reason why the comparison excludes them.

I think you didn't read the foreword of the comparison. That is by no
means a comprehensive comparison and is not meant to be one. Is a series
of thoughts about the frameworks we already tried (we don't have to
decide today) and the ones we experimented with. Django is not
completely off the radar because I used it extensively this year but the
company has certain requirements and the full stackness of Django is not
really one of our needs.

> Zope is also missing, but I'm not sure Zope qualifies so much as
> a framework, but as an answer to the question "If Emacs were a
> Python web environment, what would it look like?"

Zope2/Plone2 is the one framework they are running away from :-)
More KISS less over engineering, that's the mantra.

> Django's built-in templating system is one of those things you
> either love or you hate.  Fortunately, if you're a hater, you can
> mindlessly swap it out for your template system of choice with
> minimal fuss.

I really, really like Django (and its community and the competence of
the developers) and I think it deserves what it has gained and more but
we are not here to decide who's the best (there's always no best).

-- 
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand 
something when his salary depends on not
understanding it" - Upton Sinclair
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Lawrence Oluyede
Jorge Godoy <[EMAIL PROTECTED]> wrote:
> What is good, since a lot of good things from Pylons will work with TG and a
> lot of good TG things will remain (and possibly be compatible with Pylons).
> If you take a better look at "the next version", you'll also see that the
> major concern was with WSGI support and reinventing / "rewriting" the wheel
> (what TG developers don't want to do all the time).

Not reinventing the wheel just don't feel as a universal dogma to me. I
developed quite a bit with Django and I was glad they started from
scratch. On the paper reusing different and existing projects is great
but not always is good or done the right way. Anyway I don't know TG at
all so I'm speaking in a figurative way.

We (Michele, myself and our colleagues) have a series of stuff we need
to stick to so the choosing of a web framework ain't that easy. Most of
the frameworks are a vision of the author of how to do things from
scratch but a framework (by definition an evolution of a library) is not
always meant to be used when the scratch is far from your starting
point. 

I'd like to read some commenting of Michele's thoughts, they would be
really useful.

:-)

-- 
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand 
something when his salary depends on not
understanding it" - Upton Sinclair
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cross platform way of finding number of processors on a machine?

2007-10-06 Thread Lawrence Oluyede
Paul Boddie <[EMAIL PROTECTED]> wrote:
> From the experiments I've done with pprocess [1], pretending that a
> hyperthreading "virtual CPU" is as good as a real CPU (or CPU core)
> tends to be counter-productive: the performance benefits in moving
> from the utilisation of one to two "virtual CPUs" are virtually non-
> existent.

We came the same conclusion at work. One of my colleagues has a machine
with HyperThreading and he noticed no real performance increase with the
processing library altough on my machine (which is a dual Core 2 Duo)
the performance boost was definitely there :-)

The good side of this is hyperthreading with parallel processes is like
using a mono-CPU machine so we don't have to take into account it like
if it was an entirely different kind of architecture.

-- 
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand 
something when his salary depends on not
understanding it" - Upton Sinclair
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: slice with negative stride

2007-10-06 Thread Mark T

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I'm really confused about results of slices with negative strides. For
> example
>
>>>mystr = 'my string'
>
> I would have then thought of the contents of mystr as:
>
> indices0 1 2 3 4 5 6 7 8
> contentm y   s t r i n g
>
> with mystr[:3] = 'my '
>
> Can someone explain to me how mystr[:3:-1] = 'gnirt'?
>
> I was expecting the result to be mystr[:3] reversed (' ym') i.e slice
> then reverse or even the first 3 elements of the string after being
> reversed ('gni') i.e. reverse then slice.
>
> Thanks
>
> Andy
>

When the step is negative, a missing start is interpreted as the end of the 
string.  A slice always includes the start index character through, but not 
including, the end index character.  In your example, the end index 
character was mystr[3], so you received the end of the string ('g') down to 
but not including 's', which is 'gnirt'.

To see the indices a slice is using, use the slice object's indices method. 
Given the length of a string, it returns the exact start,stop,step indices 
used:

>>> mystr='my string'
>>> s=slice(None,3,-1)
>>> s.indices(len(mystr))  # start is the end of the string if step is 
>>> negative
(8, 3, -1)
>>> mystr[8],mystr[3]
('g', 's')
>>> mystr[8:3:-1]
'gnirt'
>>> s=slice(None,3,1)
>>> s.indices(len(mystr))  # start is the beginning of the string if step is 
>>> positive
(0, 3, 1)
>>> mystr[0],mystr[3]
('m', 's')
>>> mystr[0:3:1]
'my '

-Mark T


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


Re: slice with negative stride

2007-10-06 Thread Paul Hankin
On Oct 6, 1:05 pm, [EMAIL PROTECTED] wrote:
> I'm really confused about results of slices with negative strides. For
> example
>
> >>mystr = 'my string'
> ...
> Can someone explain to me how mystr[:3:-1] = 'gnirt'?

You've omitted the first number in the slice: python uses a sensible
default for it - in this case the index of the end of the string
because your stride is negative. If your stride was positive, the
sensible default is the start of the string, so mystr[:3:1] means
mystr[0:3:1] as you would expect.

It's explained in the python documentation, 
http://docs.python.org/lib/typesseq.html
(especially note 5 on that page).

--
Paul Hankin

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


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Michele Simionato
On Oct 6, 9:13 am, Bruno Desthuilliers  wrote:
> - talking about routes, you say:
>
> """
> I have no Ruby On Rails background, so I don't see the advantages of routes.
> """
>
> I don't have any RoR neither, but as far as I'm concerned, one of the
> big points with routes is url_for(), that avoids having too much
> hard-coded urls.

Well, url_for is convenient, I would not deny it. Still it is
not compelling to me.

> - about FormEncode : that's a package I've used before without Pylons,
> and while it has a few dark corners, it's mostly doing TheRightThing for
> most current validation/conversion tasks. I'll still use it with or
> without Pylons
>
> - about SQLAlchemy : here again, I used this package prior any
> experience with Pylons. FWIW, I used it in the most basic, 'low-level'
> way, ie without any ORM stuff, and I found it to be a pretty good
> alternative to db-api. It's a bit complex, but powerful, and having the
> possibility to handle sql requests as Python objects (instead of raw
> strings) really helps.

I have wanted to do a serious test of SQLAlchemy for a
couple of years, but never found the time :-(

Do you (or something else) have something to say about Beaker?
I looked at the source code and it seems fine to me, but I have
not used it directly, not stressed it. I need a
production-level WSGI session middleware and I wonder what the
players are (for instance how Beaker does compare with flup?)

 Michele Simionato

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


Re: Cross platform way of finding number of processors on a machine?

2007-10-06 Thread Paul Boddie
On 6 Okt, 12:45, [EMAIL PROTECTED] (Lawrence Oluyede) wrote:
>
> From processing  :

[...]

> num = os.sysconf('SC_NPROCESSORS_ONLN')

It's interesting what new (or obscure) standard library functions (and
system functions) can be discovered through these kinds of
discussions. However, this one seems to report the number of "virtual
CPUs" in situations like mine where the CPU supports hyperthreading,
as Nicholas Bastin says. One way to get the real number of CPUs (on
Linux-based systems) is to parse /proc/cpuinfo, and to count the
number of distinct "physical id" values.

>From the experiments I've done with pprocess [1], pretending that a
hyperthreading "virtual CPU" is as good as a real CPU (or CPU core)
tends to be counter-productive: the performance benefits in moving
from the utilisation of one to two "virtual CPUs" are virtually non-
existent.

Paul

[1] http://www.python.org/pypi/pprocess

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


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Bruno Desthuilliers
Michele Simionato a écrit :
> At work we are shopping for a Web framework, so I have been looking at
> the available options
> on the current market. In particular I have looked at Paste and Pylons
> and I have written my
> impressions here:
> 
> http://www.phyast.pitt.edu/~micheles/python/yet-another-comparison-of-web-frameworks.html
> 
> I do not speak too well of Pylons, so if you thing I am wrong feel
> free to correct me here ;)
> 

Well... Last year, I had a look at Pylons, then played a bit with wsgi 
and building my own framework over it. I finally dropped that code and 
went back to Pylons, which I felt could become far better than my own 
efforts. Now since then I had way too much to do at work (using other 
technos) and didn't find the time to work on my own projects, so I still 
don't know how well Pylons will pass the "real world" test, but it seems 
to me that it's rapidly progressing and mostly in the right direction. I 
still wait for an opportunity to check this out !-)

While we're at it:

- talking about routes, you say:

"""
I have no Ruby On Rails background, so I don't see the advantages of routes.
"""

I don't have any RoR neither, but as far as I'm concerned, one of the 
big points with routes is url_for(), that avoids having too much 
hard-coded urls.

- about FormEncode : that's a package I've used before without Pylons, 
and while it has a few dark corners, it's mostly doing TheRightThing for 
most current validation/conversion tasks. I'll still use it with or 
without Pylons

- about SQLAlchemy : here again, I used this package prior any 
experience with Pylons. FWIW, I used it in the most basic, 'low-level' 
way, ie without any ORM stuff, and I found it to be a pretty good 
alternative to db-api. It's a bit complex, but powerful, and having the 
possibility to handle sql requests as Python objects (instead of raw 
strings) really helps.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: my Python lib is broken

2007-10-06 Thread Bruno Rezende
Thanks for the information! Indeed, I was geting an error when trying
to do:

from xml.dom import minidom

but it was because there is a xml.py file inside the same package, so
it happens a conflict...

On Oct 6, 9:22 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote:
> 2007/10/6, Bruno Rezende <[EMAIL PROTECTED]>:
>
> > Hi,
>
> > I think I've broken my python installation (don't know how). All the
> > packages that are under 'lib' in python installation doesn't work the
> > way expected:
>
> > >>> import xml
> > >>> xml.dom
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > AttributeError: 'module' object has no attribute 'dom'
>
> This is not broken. It is how packages works.
> xml is a package, dom is a package inside xml. If you want to check
> the attributes that you get importing xml you do dir(xml)
>
> > but, if I import * from xml, it starts to work again:
>
> > >>> from xml import *
>
> Doing that will cause the __init__.py inside package xml to check its
> __all__ list and import them all, including dom
>
> > >>> xml.dom
> > 
>
> > Does someone know why is this happening? (I can reinstall my python
> > 2.5, but would like to know how the python lib got broken).
>
> This is hapenning because you have installed Python, congratulations =)
>
>
>
> > regards,
> > Bruno
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> -- Guilherme H. Polo Goncalves


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


Re: my Python lib is broken

2007-10-06 Thread Guilherme Polo
2007/10/6, Bruno Rezende <[EMAIL PROTECTED]>:
> Hi,
>
> I think I've broken my python installation (don't know how). All the
> packages that are under 'lib' in python installation doesn't work the
> way expected:
>
> >>> import xml
> >>> xml.dom
> Traceback (most recent call last):
>   File "", line 1, in 
> AttributeError: 'module' object has no attribute 'dom'
>

This is not broken. It is how packages works.
xml is a package, dom is a package inside xml. If you want to check
the attributes that you get importing xml you do dir(xml)

> but, if I import * from xml, it starts to work again:
>
> >>> from xml import *

Doing that will cause the __init__.py inside package xml to check its
__all__ list and import them all, including dom

> >>> xml.dom
> 
>
>
> Does someone know why is this happening? (I can reinstall my python
> 2.5, but would like to know how the python lib got broken).

This is hapenning because you have installed Python, congratulations =)

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


-- 
-- Guilherme H. Polo Goncalves
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Segmentation fault..

2007-10-06 Thread Bruno Desthuilliers
Jorge Godoy a écrit :
> Abandoned wrote:
> 
>> Hi..
>> I run a my script and 3-4 minutes later give me an error "segmentation
>> fault".
>> What is the reason of this error ?
>>
>> I use in my script:
>> Threading
>> Psycopg2
>> open & write to txt
>> urlopen
>>
>> My platform is ubuntu linux.
>>
>> I'm sorry my bad english.
>> King regards..
> 
> Without seeing any code, it is hard to say anything.  But the answer to the
> ultimate question is "42".

Indeed. Err, what was the question, exactly ?-)

> Show the group some code and I'm sure people will help.

To be more precise: post the minimal working code reproducing the 
problem, and the full traceback.
-- 
http://mail.python.org/mailman/listinfo/python-list


slice with negative stride

2007-10-06 Thread ajcppmod
I'm really confused about results of slices with negative strides. For
example

>>mystr = 'my string'

I would have then thought of the contents of mystr as:

indices0 1 2 3 4 5 6 7 8
contentm y   s t r i n g

with mystr[:3] = 'my '

Can someone explain to me how mystr[:3:-1] = 'gnirt'?

I was expecting the result to be mystr[:3] reversed (' ym') i.e slice
then reverse or even the first 3 elements of the string after being
reversed ('gni') i.e. reverse then slice.

Thanks

Andy

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


my Python lib is broken

2007-10-06 Thread Bruno Rezende
Hi,

I think I've broken my python installation (don't know how). All the
packages that are under 'lib' in python installation doesn't work the
way expected:

>>> import xml
>>> xml.dom
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'module' object has no attribute 'dom'

but, if I import * from xml, it starts to work again:

>>> from xml import *
>>> xml.dom



Does someone know why is this happening? (I can reinstall my python
2.5, but would like to know how the python lib got broken).

regards,
Bruno

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


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Michele Simionato
On Oct 6, 7:15 am, Jorge Godoy <[EMAIL PROTECTED]> wrote:
> Tim Chase wrote:
> > Any respectable comparison of Python web frameworks should
> > include evaluation of at least Django and TG.  Or at least give
> > good reason why the comparison excludes them.


Mine is not a respectable comparison of Web frameworks, it is
NOT intended to be so. It is just a set of notes I kept for
myself and that may be or may be not of interest to others.

> When he said that he didn't want anything complex neither anything that used
> a templating system, I thought this had already excluded a lot of
> frameworks, including TG and Django.

This is clearly not true, since I could use these frameworks
without using their templates if I wanted. It would be very
stupid to dismiss an entire framework only because I dislike
its templates.

> > Zope is also missing, but I'm not sure Zope qualifies so much as
> > a framework, but as an answer to the question "If Emacs were a
> > Python web environment, what would it look like?"
>
> He already had dislikings with Plone that weren't clear, maybe a lot of
> those are Zope related...
>
> I agree, though, that more time could be spent explaining "why" things were
> discarded / ignored.

Look, there are already tons of pages on the net ranting against
Zope, my complaints are quite common and I have no interest
in repeating what has been already said. For instance, if you
Google a bit you should find the rants of the Quixote people
against Zope. I share their position.
I did not talk about TG because I see it as being very close to
Pylons and everybody is saying they will be unified in the near
future, so it would be a waste of effort to discuss TG per se.

  Michele Simionato

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


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Jorge Godoy
Lawrence Oluyede wrote:

> Thomas Wittek <[EMAIL PROTECTED]> wrote:
>> At least, you missed Turbo Gears :)
>> http://turbogears.org/
>> For me, it feels more integrated than Pylons.
> 
> Yeah, so integrated that the next version will be based upon Pylons ;-) ?

What is good, since a lot of good things from Pylons will work with TG and a
lot of good TG things will remain (and possibly be compatible with Pylons). 
If you take a better look at "the next version", you'll also see that the
major concern was with WSGI support and reinventing / "rewriting" the wheel
(what TG developers don't want to do all the time).

As an example of this fusion, take a look at ToscaWidgets.  Works, *today*,
with both frameworks.  You don't have to wait for "the next version".
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Jorge Godoy
Tim Chase wrote:
 
> Any respectable comparison of Python web frameworks should
> include evaluation of at least Django and TG.  Or at least give
> good reason why the comparison excludes them.

When he said that he didn't want anything complex neither anything that used
a templating system, I thought this had already excluded a lot of
frameworks, including TG and Django.

> Zope is also missing, but I'm not sure Zope qualifies so much as
> a framework, but as an answer to the question "If Emacs were a
> Python web environment, what would it look like?"

He already had dislikings with Plone that weren't clear, maybe a lot of
those are Zope related...


I agree, though, that more time could be spent explaining "why" things were
discarded / ignored.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Segmentation fault..

2007-10-06 Thread Jorge Godoy
Abandoned wrote:

> Hi..
> I run a my script and 3-4 minutes later give me an error "segmentation
> fault".
> What is the reason of this error ?
> 
> I use in my script:
> Threading
> Psycopg2
> open & write to txt
> urlopen
> 
> My platform is ubuntu linux.
> 
> I'm sorry my bad english.
> King regards..

Without seeing any code, it is hard to say anything.  But the answer to the
ultimate question is "42".

Show the group some code and I'm sure people will help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Tim Chase
>> At work we are shopping for a Web framework, so I have been
>> looking at the available options on the current market.
> 
> At least, you missed Turbo Gears :)
> http://turbogears.org/
> For me, it feels more integrated than Pylons.

Django [1] barely gets anything more than a mention as well.

Any respectable comparison of Python web frameworks should
include evaluation of at least Django and TG.  Or at least give
good reason why the comparison excludes them.

Zope is also missing, but I'm not sure Zope qualifies so much as
a framework, but as an answer to the question "If Emacs were a
Python web environment, what would it look like?"

I chose Django, but saw the power in TG as well...from my testing
of them, Django has a nice unified OOB experience, while TG feels
like it's trying to rein in very strong, but disparate parts.
Django's built-in templating system is one of those things you
either love or you hate.  Fortunately, if you're a hater, you can
mindlessly swap it out for your template system of choice with
minimal fuss.

-tim

[1] http://www.djangoproject.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Segmentation fault..

2007-10-06 Thread Abandoned
Hi..
I run a my script and 3-4 minutes later give me an error "segmentation
fault".
What is the reason of this error ?

I use in my script:
Threading
Psycopg2
open & write to txt
urlopen

My platform is ubuntu linux.

I'm sorry my bad english.
King regards..

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


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Lawrence Oluyede
Thomas Wittek <[EMAIL PROTECTED]> wrote:
> At least, you missed Turbo Gears :)
> http://turbogears.org/
> For me, it feels more integrated than Pylons.

Yeah, so integrated that the next version will be based upon Pylons ;-)
?

-- 
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand 
something when his salary depends on not
understanding it" - Upton Sinclair
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cross platform way of finding number of processors on a machine?

2007-10-06 Thread Lawrence Oluyede
John <[EMAIL PROTECTED]> wrote:
> Is there a way to find the number of processors on a machine (on linux/
> windows/macos/cygwin) using python code (using the same code/cross
> platform code)?

>From processing  :

def cpuCount():
'''
Returns the number of CPUs in the system
'''
if sys.platform == 'win32':
try:
num = int(os.environ['NUMBER_OF_PROCESSORS'])
except (ValueError, KeyError):
pass
elif sys.platform == 'darwin':
try:
num = int(os.popen('sysctl -n hw.ncpu').read())
except ValueError:
pass
else:
try:
num = os.sysconf('SC_NPROCESSORS_ONLN')
except (ValueError, OSError, AttributeError):
pass

if num >= 1:
return num
else:
raise NotImplementedError

-- 
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand 
something when his salary depends on not
understanding it" - Upton Sinclair
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet another comparison of Python Web Frameworks

2007-10-06 Thread Thomas Wittek
Michele Simionato:
> At work we are shopping for a Web framework, so I have been looking at
> the available options
> on the current market.

At least, you missed Turbo Gears :)
http://turbogears.org/
For me, it feels more integrated than Pylons.

-- 
Thomas Wittek
Web: http://gedankenkonstrukt.de/
Jabber: [EMAIL PROTECTED]
GPG: 0xF534E231
-- 
http://mail.python.org/mailman/listinfo/python-list


Yet another comparison of Python Web Frameworks

2007-10-06 Thread Michele Simionato
At work we are shopping for a Web framework, so I have been looking at
the available options
on the current market. In particular I have looked at Paste and Pylons
and I have written my
impressions here:

http://www.phyast.pitt.edu/~micheles/python/yet-another-comparison-of-web-frameworks.html

I do not speak too well of Pylons, so if you thing I am wrong feel
free to correct me here ;)


 Michele Simionato

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


Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-06 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>,
timw.google wrote:

> I want to write a python script that runs rsync on a given directory
> and host. I build the command line string, but when I try to run
> subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or
> os.system(cmd), I get prompted for my login password.

Why not set up a public/private SSH key pair between the accounts on the two
machines? Then you can get in without a password.

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


Re: tkinter question

2007-10-06 Thread Hendrik van Rooyen
"Kevin Walzer" <[EMAIL PROTECTED]> wrote:

> I find "pack" to be more flexible than "grid," so I prefer it for 
> complex layouts. "grid" is better for simple layouts.

*does a double take*  are you serious? - my experience is that
pack is only good for simple single row or single column stuff.

- Hendrik


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


Re: Please Help me

2007-10-06 Thread Hendrik van Rooyen

Jean-Francois Canac  wrote:

8< -- duplicate request ---

see other answer.

- Hendrik

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