Re: ANN: SE 2.3. Available now

2006-11-04 Thread Frederic Rentsch
Fredrik Lundh wrote:
> Frederic Rentsch wrote:
>
>   
>> And here's the proof I am being perceived as a nuisance. I apologize, 
>> keeping to myself that I don't care.
>> 
>
> since you're constantly targeting newbies, and are hawking your stuff 
> also for things for which there are simple and efficient solutions 
> available in Python's standard library, your behavior could be seen
> as more than just a nuisance.
>
> 
>
>   
Thank you for making me aware of it. I totally agree with you that 
inefficient complexity should never replace efficient simplicity. SE, in 
fact, is much more a convenient interface complement than a stand-alone 
tool and as such meant to cooperate with the available Python idiom.
  I used this forum to connect with real-life problems, which I 
believe is one of its main purposes. Testing the envelope of my 'stuff' 
I would almost certainly have overstretched it on occasion. And again, 
what's wrong with this absolutely normal development process? And what 
better environment could there be for it than an interest group like 
this one where experts like yourself offer direction?
  I am not targeting newbies (whatever that is). I am not targeting 
at all. I invite response. You had cause to respond as this message of 
yours reveals. But you didn't respond and now your are angry with me for it.
  So, thanks again for the information. Your comments are always 
welcome. I understand your style as an expression of your personality. 
Belligerence passes my notice if I don't see what I have to do with it.

Regards

Frederic


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


Re: Sorted and reversed on huge dict ?

2006-11-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

> Klaas > i do not know about intern construct, i will have look, but
> when googling 

the description in the documentation is pretty concise, I think:

 http://effbot.org/pyref/intern



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


Re: Defaultdict and speed

2006-11-04 Thread bearophileHUGS
Klaas wrote:
> Benchmarks?

There is one (fixed in a succesive post) in the original thread I was
referring to:
http://groups.google.com/group/it.comp.lang.python/browse_thread/thread/aff60c644969f9b/
If you want I can give more of them (and a bit less silly, with strings
too, etc).

def ddict(n):
t = clock()
d = defaultdict(int)
for i in xrange(n):
d[i] += 1
print round(clock()-t, 2)

def ndict(n):
t = clock()
d = {}
for i in xrange(n):
if i in d:
d[i] += 1
else:
d[i] = 1
print round(clock()-t, 2)

ddict(30)
ndict(30)


> (and slowing down other uses of the class)

All it has to do is to cheek if the default_factory is an int, it's
just an "if" done only once, so I don't think it slows down the other
cases significantly.


> especially when the faster alternative is so easy to code.

The faster alternative is easy to create, but the best faster
alternative can't be coded, because if you code it in Python you need
two hash accesses, while the defaultdict can require only one of them:

if n in d:
d[n] += 1
else:
d[n] = 1


>If that performance difference matters,

With Python it's usually difficult to tell if some performance
difference matters. Probably in some programs it may matter, but in
most other programs it doesn't matter. This is probably true for all
the performance tweaks I may invent in the future too.


> you would likely find more fruitful
> gains in coding it in c, using PyDict_SET

I've just started creating a C lib for related purposes, I'd like to
show it to you all on c.l.p, but first I have to find a place to put it
on :-) (It's not easy to find a suitable place, it's a python + c +
pyd, and it's mostly an exercise).

Bye,
bearophile

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


small python cgi webserver

2006-11-04 Thread Fabian Braennstroem
Hi,

I am looking for a small python script, which starts a small
web server with python cgi support on a linux machine.

I tried:


  #!/usr/bin/env python
  import sys
  from CGIHTTPServer import CGIHTTPRequestHandler
  import BaseHTTPServer
  
  class MyRequestHandler(CGIHTTPRequestHandler):
  # In diesem Verzeichnis sollten die CGI-Programme stehen:
  cgi_directories=["/home/fab/Desktop/cgi-bin"]
  
  
  def run():
  # 8000=Port-Nummer
  #   --> http://localhost:8000/
  # Fuer http://localhost/ 
  #   Port-Nummer auf 80 setzen
  httpd=BaseHTTPServer.HTTPServer(('', 8000), MyRequestHandler)
  httpd.serve_forever()
  
  if __name__=="__main__":
  print "Starting Server"
  run()

but when I want to test a small python cgi test file:


  #!/usr/bin/python
  # -*- coding: UTF-8 -*-

  # Debugging fÃŒr CGI-Skripte 'einschalten'
  import cgitb; cgitb.enable()

  print "Content-Type: text/html;charset=utf-8\n"
  print "Hello World!"

I just get the text and not the html output. The file's mode
is 755.

Is there anything wrong with the webserver script or do I do
something completely wrong? Maybe, you have a different
webserver script?

Greetings!
 Fabian

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


Re: Programming Language that is Spreadsheet/Table Based

2006-11-04 Thread James Stroud
Gerard Flanagan wrote:
>> py> # the following is probably the trickiest, should it return a Table
>> py> # should it be illegal?
>> py> # should t['Last'] be the way to take the "slice" and get the col?
>> py> t[None, 'Last'] # 1d slice returns list (2nd dim. explicit)
>> ['Barker', 'Burnet', 'Danson', 'Cooper']
> 
> I can imagine manipulating columns at the Table creation stage -
> insert, append, delete column - but after that I think you would be
> dealing with rows more often. Personally, if I needed columns I would
> be happier with a list comprehension:
> [ (row['Last'], row['Age']) for row in t ]
>  etc.

To make a table from list comprehension in this way seems like it would 
require some redundancy because a list comprehension only gets you a 
list (of rows or lists). It seems if you wanted to work with your 2d 
selection of data, then you would want to get a table back:

data = [ (row['Last'], row['Age']) for row in t ]
t2 = Table(('Last','Age'), data)

This seems, to me, to separates selection in the 2 dimensions and makes 
it "backwards":

data = [ (row['Last'], row['Age']) for row in t[1:3]]
t2 = Table(('Last','Age'), data)

So a function would be needed to group the selection in a way that 
reflects the organization of the table:

t2 = t.subtable((1,3), ('Last','Age'))

But then, since the latter seems a natural consequence of using list 
comprehension for selection, how might one distinguish a range of 
columns if not by a verbose function name?

t2 = t.subtable_with_column_range((1,3), ('Last','Age'))

The concept of slicing seems to take care of this. Maybe

t2 = t.subtable(slice(1,3), slice('Last','Age'))

But this begins to seem awkward and verbose to boot. Any suggestions on 
adapting your idea of list comprehension to generate subtables?


> eg. like:
> 
> http://buzhug.sourceforge.net/
> 
>> py> t2 = t[1:3, ('First', 'Age')]  # 2d slice returns a new Table
>> py> t3 = t[1:3,'First':'Age']  # shorthand to take a swath of columns
>> py> t3 = t[1:3, 0:2]  # if we know what column numbers we want instead
> 
> t[1:3][0:2] and so on would be more intuitive to me, possibly
> t[1:3]['First':'Age']

This looks better than my slicing, and to argue with it I'd have to 
break my own rules and point out that it would require making an 
intermediate table in the implementation. I am emulating numarray 
slicing closely, which itself is probably focused on implementation and 
speed.


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


Re: PySchool - Online Python Web Framework Workshop.

2006-11-04 Thread James Stroud
RobJ wrote:
> Hi! My Name is Rob Johnson and I am a graduate student at The Richard
> Stockton College of NJ. To make a long story short, I'm working on my
> Masters project in the MAIT program (Masters of Arts in Instructional
> Technology). I have written a proposal to put together a free on-line
> Python web framework workshop. The workshop will be geared to help
> people new to Python web frameworks. I am asking for the community's
> assistance to help me get this project off the ground. As part of my
> project, I am conducting a survey for people who are interested in
> learning more about python web frameworks.  The survey is located at
> http://killersurvey.com/answer_survey.php?id=479. I have also started a
> blog about this experience in order to let people know what I'm doing
> (http://pyschool.blogspot.com/). If you have a few minutes, please take
> a couple of minutes to take the quick survey. The survey is anonymous
> and the information will be used for statistics for my project. Also,
> any constructive feedback or suggestions that you can give me would be
> gladly appreciated.  
> 
> Thanks
> 
> Rob J
> 
Q9 should be "check all that apply" or otherwise qualified with "primarily".

Q10 is missing other types of broadband such as what one might find at 
school, and also have the option of multiple selections.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: small python cgi webserver

2006-11-04 Thread ArdPy

Fabian Braennstroem wrote:
> Hi,
>
> I am looking for a small python script, which starts a small
> web server with python cgi support on a linux machine.
>
> I tried:
>
>
>   #!/usr/bin/env python
>   import sys
>   from CGIHTTPServer import CGIHTTPRequestHandler
>   import BaseHTTPServer
>
>   class MyRequestHandler(CGIHTTPRequestHandler):
>   # In diesem Verzeichnis sollten die CGI-Programme stehen:
>   cgi_directories=["/home/fab/Desktop/cgi-bin"]
>
>
>   def run():
>   # 8000=Port-Nummer
>   #   --> http://localhost:8000/
>   # Fuer http://localhost/
>   #   Port-Nummer auf 80 setzen
>   httpd=BaseHTTPServer.HTTPServer(('', 8000), MyRequestHandler)
>   httpd.serve_forever()
>
>   if __name__=="__main__":
>   print "Starting Server"
>   run()
>
> but when I want to test a small python cgi test file:
>
>
>   #!/usr/bin/python
>   # -*- coding: UTF-8 -*-
>
>   # Debugging für CGI-Skripte 'einschalten'
>   import cgitb; cgitb.enable()
>
>   print "Content-Type: text/html;charset=utf-8\n"
>   print "Hello World!"
>
> I just get the text and not the html output. The file's mode
> is 755.
>
> Is there anything wrong with the webserver script or do I do
> something completely wrong? Maybe, you have a different
> webserver script?
>
> Greetings!
>  Fabian

Probably the server is not executing your CGI script. If it is the
Apache web server that you are using then just ensure the following
settings in your /etc/httpd/conf/httpd.conf file is exactly like
following:


AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all


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


Re: Sorted and reversed on huge dict ?

2006-11-04 Thread Nick Craig-Wood
Paul Rubin  wrote:
> > is there a good way to know how much ram is used directly from
> > python (or should i rely on 'top' and other unix command?
> 
>  I think try resource.getrusage()

That should work (under BSD anyway) but unfortunately doesn't under
linux :-(

>From the man page

   CONFORMING TO
   SVr4,  4.3BSD.   POSIX.1-2001 specifies getrusage(), but only specifies
   the fields ru_utime and ru_stime.

and

   The  above struct was taken from 4.3BSD Reno.  Not all fields are mean-
   ingful under Linux.  In linux 2.4 only the fields  ru_utime,  ru_stime,
   ru_minflt, and ru_majflt are maintained.  Since Linux 2.6, ru_nvcsw and
   ru_nivcsw are also maintained.

Ie none of the memory based ones are filled in.

This linux only code works though :-

   def memory_used():
   """Return the memory used by this process under linux in bytes"""
   return int(file("/proc/self/statm").read().split()[0]) * 
resource.getpagesize()

Eg

>>> import resource
>>> def memory_used():
... return int(file("/proc/self/statm").read().split()[0]) * 
resource.getpagesize()
... 
>>> print memory_used()
4575232
>>> a=1000*"x"
>>> print memory_used()
14577664
>>> 

If anyone knows a (unix) portable way of doing this I'd be interested!

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


Re: small python cgi webserver

2006-11-04 Thread Fabian Braennstroem
Hi,

* ArdPy <[EMAIL PROTECTED]> wrote:
>
> Fabian Braennstroem wrote:
>> Hi,
>>
>> I am looking for a small python script, which starts a small
>> web server with python cgi support on a linux machine.
>>
>> I tried:
>>
>>
>>   #!/usr/bin/env python
>>   import sys
>>   from CGIHTTPServer import CGIHTTPRequestHandler
>>   import BaseHTTPServer
>>
>>   class MyRequestHandler(CGIHTTPRequestHandler):
>>   # In diesem Verzeichnis sollten die CGI-Programme stehen:
>>   cgi_directories=["/home/fab/Desktop/cgi-bin"]
>>
>>
>>   def run():
>>   # 8000=Port-Nummer
>>   #   --> http://localhost:8000/
>>   # Fuer http://localhost/
>>   #   Port-Nummer auf 80 setzen
>>   httpd=BaseHTTPServer.HTTPServer(('', 8000), MyRequestHandler)
>>   httpd.serve_forever()
>>
>>   if __name__=="__main__":
>>   print "Starting Server"
>>   run()
>>
>> but when I want to test a small python cgi test file:
>>
>>
>>   #!/usr/bin/python
>>   # -*- coding: UTF-8 -*-
>>
>>   # Debugging für CGI-Skripte 'einschalten'
>>   import cgitb; cgitb.enable()
>>
>>   print "Content-Type: text/html;charset=utf-8\n"
>>   print "Hello World!"
>>
>> I just get the text and not the html output. The file's mode
>> is 755.
>>
>> Is there anything wrong with the webserver script or do I do
>> something completely wrong? Maybe, you have a different
>> webserver script?
>>
>> Greetings!
>>  Fabian
>
> Probably the server is not executing your CGI script. If it is the
> Apache web server that you are using then just ensure the following
> settings in your /etc/httpd/conf/httpd.conf file is exactly like
> following:
>
> 
> AllowOverride None
> Options ExecCGI
> Order allow,deny
> Allow from all
> 

Maybe, I understood something wrong, but I thought that the
above 'webserver' script would replace apache in my case; at
least I hoped!?

Greetings!
 Fabian

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


Re: Programming Language that is Spreadsheet/Table Based

2006-11-04 Thread Gerard Flanagan
James Stroud wrote:
> Gerard Flanagan wrote:
> >> py> # the following is probably the trickiest, should it return a Table
> >> py> # should it be illegal?
> >> py> # should t['Last'] be the way to take the "slice" and get the col?
> >> py> t[None, 'Last'] # 1d slice returns list (2nd dim. explicit)
> >> ['Barker', 'Burnet', 'Danson', 'Cooper']
> >
> > I can imagine manipulating columns at the Table creation stage -
> > insert, append, delete column - but after that I think you would be
> > dealing with rows more often. Personally, if I needed columns I would
> > be happier with a list comprehension:
> > [ (row['Last'], row['Age']) for row in t ]
> >  etc.
>
> To make a table from list comprehension in this way seems like it would
> require some redundancy because a list comprehension only gets you a
> list (of rows or lists). It seems if you wanted to work with your 2d
> selection of data, then you would want to get a table back:
>
> data = [ (row['Last'], row['Age']) for row in t ]
> t2 = Table(('Last','Age'), data)
>
> This seems, to me, to separates selection in the 2 dimensions and makes
> it "backwards":
>
> data = [ (row['Last'], row['Age']) for row in t[1:3]]
> t2 = Table(('Last','Age'), data)
>
> So a function would be needed to group the selection in a way that
> reflects the organization of the table:
>
> t2 = t.subtable((1,3), ('Last','Age'))
>
> But then, since the latter seems a natural consequence of using list
> comprehension for selection, how might one distinguish a range of
> columns if not by a verbose function name?
>
> t2 = t.subtable_with_column_range((1,3), ('Last','Age'))
>
> The concept of slicing seems to take care of this. Maybe
>
> t2 = t.subtable(slice(1,3), slice('Last','Age'))
>
> But this begins to seem awkward and verbose to boot. Any suggestions on
> adapting your idea of list comprehension to generate subtables?
>

What about symmetric 'load' and 'iterrows' methods for the Table class:

t2 = Table()
t2.load( t1.iterrows("LastName", "Age") )

def load(self, iterable):
'''expecting tuples'''
for lname, age in iterable:
self.append( lname, age )

def iterrows(self, *args):
'''returns a generator which itself returns tuples
  filtered by the column names in *args (via
  operator.itemgetter maybe?)'''


There might be some value in comparing Microsoft's DataSet API.  IIRC,
you typically have:

*UI* - DataView - DataSet - DataAdapter - *DATABASE*

A DataSet is a collection of DataTables and has a lot of DB/XML
functionality and so on.  A DataView on the other hand is more
lightweight and has mainly filtering and sorting functions and is
designed to be bound to a GUI widget such as a DataGrid.

You might have something along the lines of:

   ds = DataSet()
   # fill ds from datasource
   dt_customers = ds.tables["customers"]
   view = DataView( dt_customers )
   view.rowfilter = "lastname LIKE 'A*' and Age < 60"

I'm not saying imitate this, but maybe some value in studying the
OO-bondage approach.

All the best

Gerard

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


Re: Programming Language that is Spreadsheet/Table Based

2006-11-04 Thread James Stroud
Gerard Flanagan wrote:
> What about symmetric 'load' and 'iterrows' methods for the Table class:
> 
> t2 = Table()
> t2.load( t1.iterrows("LastName", "Age") )
> 
> def load(self, iterable):
> '''expecting tuples'''
> for lname, age in iterable:
> self.append( lname, age )
> 
> def iterrows(self, *args):
> '''returns a generator which itself returns tuples
>   filtered by the column names in *args (via
>   operator.itemgetter maybe?)'''
> 
> 
> There might be some value in comparing Microsoft's DataSet API.  IIRC,
> you typically have:
> 
> *UI* - DataView - DataSet - DataAdapter - *DATABASE*
> 
> A DataSet is a collection of DataTables and has a lot of DB/XML
> functionality and so on.  A DataView on the other hand is more
> lightweight and has mainly filtering and sorting functions and is
> designed to be bound to a GUI widget such as a DataGrid.
> 
> You might have something along the lines of:
> 
>ds = DataSet()
># fill ds from datasource
>dt_customers = ds.tables["customers"]
>view = DataView( dt_customers )
>view.rowfilter = "lastname LIKE 'A*' and Age < 60"
> 
> I'm not saying imitate this, but maybe some value in studying the
> OO-bondage approach.


Thank you, this is very good stuff to think about.

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


Really strange behavior

2006-11-04 Thread IloChab
Sorry I wasn't able to be more specific on my topic but I really do not
know how to classify my  problem, I mean that I can't understand if it's 
a python
or a twisted
or a Qt4
problem
I'm trying to run a simple application with Twisted and Qt4. 
To do this I downloaded this:
http://twistedmatrix.com/trac/attachment/ticket/1770/qt4reactor.py
Now,
if I run this:
# >
import  qt4reactor
import sys
from PyQt4 import  QtGui
from winIum import Window

def main():
app = QtGui.QApplication(sys.argv)
qt4reactor.install(app)
MainWindow = QtGui.QMainWindow()
win = Window(MainWindow)
MainWindow.show()
from twisted.internet import reactor
reactor.run()
# 
my window shows and run correctly.

If I run this:
# >
import  qt4reactor
import sys
from PyQt4 import  QtGui
from winIum import Window

def creApp():
app = QtGui.QApplication(sys.argv)
qt4reactor.install(app)
retrun app
def creWin():
MainWindow = QtGui.QMainWindow()
win = Window(MainWindow)
MainWindow.show()
def main():
app = creApp()
creWin()
from twisted.internet import reactor
reactor.run()
# <
my window doesn't show and the script doesn't stop but remains trapped in
some gui loop.
 
What's the problem I can't see??

Thank you in advance for any help.
Licia
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: small python cgi webserver

2006-11-04 Thread Norbert Kaufmann
Fabian Braennstroem wrote:
[...]
> 
> Maybe, I understood something wrong, but I thought that the
> above 'webserver' script would replace apache in my case; at
> least I hoped!?
> 

It does. The 'ServerRoot' and 'DocumentRoot' directories are the
directories you are starting your webserver in.
Create a 'cgi' directory inside this and consider that you have to name
it in the serverscript in relation to the serverroot!


cgi_directories=["/home/fab/Desktop/cgi-bin"]


This means you have to start your server inside directory '/'.

If you start your server in your home dir '/home/fab' then you have to
name your cgi_directories ['/Desktop/cgi-bin'].

In your response (cgi-script) you have to divide the header from the
content '\r\n\r\n'.

HTH

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


Re: py2exe questions

2006-11-04 Thread robert
Thomas Heller wrote:
> Larry Bates schrieb:
>> Doug Stell wrote:
>>> I have 2 questions about py2exe or any similar utility.
>>>
>>> 1. Is it possible to create a single Windows executable that does not
>>> blow out to a folder full of files and can be called from scripts
>>> using command line arguments?
>>>
>>> 2. If the above can be done, it is possible to hide parts of the
>>> Python source code from users? These users are software developers,
>>> but we don't want them to see how the code does what it does.
>>>
>>> thanks, doug
>> py2exe reduce the number of files you need to distribute down to 4:
>>
>> msvcr71.dll
>> w9xpopen.exe  (Windows/98 support)
>> library.zip (all .pyo, .pyd, and .dll files)
>> applcation.exe
> 
> It can easily be reduced to 2 files by 'embedding' the libray.zip
> into the exe (use the zipfile=None option), and deleting the w9xpopen.exe
> if you don't need win98 support.

and finally you can use Python2.3 to avoid msvcr71.dll

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


Re: small python cgi webserver

2006-11-04 Thread ArdPy

Fabian Braennstroem wrote:
> Hi,
>
> * ArdPy <[EMAIL PROTECTED]> wrote:
> >
> > Fabian Braennstroem wrote:
> >> Hi,
> >>
> >> I am looking for a small python script, which starts a small
> >> web server with python cgi support on a linux machine.
> >>
> >> I tried:
> >>
> >>
> >>   #!/usr/bin/env python
> >>   import sys
> >>   from CGIHTTPServer import CGIHTTPRequestHandler
> >>   import BaseHTTPServer
> >>
> >>   class MyRequestHandler(CGIHTTPRequestHandler):
> >>   # In diesem Verzeichnis sollten die CGI-Programme stehen:
> >>   cgi_directories=["/home/fab/Desktop/cgi-bin"]
> >>
> >>
> >>   def run():
> >>   # 8000=Port-Nummer
> >>   #   --> http://localhost:8000/
> >>   # Fuer http://localhost/
> >>   #   Port-Nummer auf 80 setzen
> >>   httpd=BaseHTTPServer.HTTPServer(('', 8000), MyRequestHandler)
> >>   httpd.serve_forever()
> >>
> >>   if __name__=="__main__":
> >>   print "Starting Server"
> >>   run()
> >>
> >> but when I want to test a small python cgi test file:
> >>
> >>
> >>   #!/usr/bin/python
> >>   # -*- coding: UTF-8 -*-
> >>
> >>   # Debugging für CGI-Skripte 'einschalten'
> >>   import cgitb; cgitb.enable()
> >>
> >>   print "Content-Type: text/html;charset=utf-8\n"
> >>   print "Hello World!"
> >>
> >> I just get the text and not the html output. The file's mode
> >> is 755.
> >>
> >> Is there anything wrong with the webserver script or do I do
> >> something completely wrong? Maybe, you have a different
> >> webserver script?
> >>
> >> Greetings!
> >>  Fabian
> >
> > Probably the server is not executing your CGI script. If it is the
> > Apache web server that you are using then just ensure the following
> > settings in your /etc/httpd/conf/httpd.conf file is exactly like
> > following:
> >
> > 
> > AllowOverride None
> > Options ExecCGI
> > Order allow,deny
> > Allow from all
> > 
>
> Maybe, I understood something wrong, but I thought that the
> above 'webserver' script would replace apache in my case; at
> least I hoped!?
>
> Greetings!
>  Fabian

Oh yes...Your script is supposed to replace apache. I tried with your
script on my pc and its working just fine. However the problem still is
that the server is taking your file to be a plain file rather than a
CGI script. Looking at CGIHTTPServer.is_cgi method might prove helpful.

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


Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread robert
Martin v. Löwis wrote:
> robert schrieb:
>> in combination with some simple locking (anyway necessary) I don't see a
>> problem in ref-counting.
> 
> In the current implementation, simple locking isn't necessary.
> The refcounter can be modified freely since the code modifying
> it will always hold the GIL.

( meant: a lock to prevent multiple Interpreters accessing concurrently the hot 
shared/tunneled objects )

>>  Question Besides:  do concurrent INC/DEC machine OP-commands
>> execute atomically on Multi-Cores as they do in Single-Core threads?
> 
> Not necessarily, no. On x86, you need to prefix the instruction
> with the LOCK prefix for it to become atomic. Otherwise, the
> two necessary read/write cycles to main memory may interleave
> with the memory operations of another processor.
> 
> On other processors, INC  might not exist at all as an
> instruction; when you only have register add, then implementing
> an atomic increment is a challenge. That's why the Windows API
> provides you with an atomic increment function as part of the
> operating system API.

Thanks for that info. That is interesting.
Thus even on x86 currently this LOCK is not used  (just (op)->ob_refcnt++) )

Reading this I got pinched: 
In win32ui there are infact Py_INC/DECREF's outside of the GIL !
And I have a severe crash problem with threaded apps - the problem is only only 
on dual cores !
That pointer probably will end a long search...


robert


PS: Besides: what are speed costs of LOCK INC  ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Really strange behavior

2006-11-04 Thread ArdPy

IloChab wrote:
> Sorry I wasn't able to be more specific on my topic but I really do not
> know how to classify my  problem, I mean that I can't understand if it's
> a python
> or a twisted
> or a Qt4
> problem
> I'm trying to run a simple application with Twisted and Qt4.
> To do this I downloaded this:
> http://twistedmatrix.com/trac/attachment/ticket/1770/qt4reactor.py
> Now,
> if I run this:
> # >
> import  qt4reactor
> import sys
> from PyQt4 import  QtGui
> from winIum import Window
>
> def main():
> app = QtGui.QApplication(sys.argv)
> qt4reactor.install(app)
> MainWindow = QtGui.QMainWindow()
> win = Window(MainWindow)
> MainWindow.show()
> from twisted.internet import reactor
> reactor.run()
> # 
> my window shows and run correctly.
>
> If I run this:
> # >
> import  qt4reactor
> import sys
> from PyQt4 import  QtGui
> from winIum import Window
>
> def creApp():
> app = QtGui.QApplication(sys.argv)
> qt4reactor.install(app)
> retrun app
> def creWin():
> MainWindow = QtGui.QMainWindow()
> win = Window(MainWindow)
> MainWindow.show()
> def main():
> app = creApp()
> creWin()
> from twisted.internet import reactor
> reactor.run()
> # <
> my window doesn't show and the script doesn't stop but remains trapped in
> some gui loop.
>
> What's the problem I can't see??
>
> Thank you in advance for any help.
> Licia

Well the only problem according to me could be with the 'from
twisted.internet import reactor' statement.
Try putting this at the beginning of the script. Might be it will work
just fine...

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


Re: codecs - where are those on windows?

2006-11-04 Thread GHUM

Fredrik Lundh schrieb:

> > If your installation directory is C:\Python25, then look in
> > C:\Python25\lib\encodings
>
> that's only the glue code.  the actual data sets are provided by a bunch
> of built-in modules:
>  >>> import sys
>  >>> sys.builtin_module_names
> ('__builtin__', '__main__', '_ast', '_bisect', '_codecs',
> '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp',
> '_codecs_kr', '_codecs_tw', ...

So, it should be possible to do a custom build of python24.dll /
python25.dll without some of those codecs, resulting in a smaller
python24.dll ?

It will be some time untill my apps must support Chinese and
Japanese...

Harald

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


Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread GHUM
robert,

> Interprocess communication is tedious and out of questio
[...]
> I expect to be able to directly push around Python Object-Trees between the 2 
> (or more) interpreters by doing some careful locking.

Please do yourself a favour and have a look at pyro. pyro makes
InterComputer and InterProcess Communication a snap. And it allows you
to push around Python Objects not only between processes, but
computers.

Maybe it solves your problem much easier and even more than you want to
solve it now by being able to use more then one computer.

Harald

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


Re: Sorted and reversed on huge dict ?

2006-11-04 Thread vd12005

so it has worked :) and last 12h4:56, 15 dicts with 1133755 keys, i do
not know how much ram was used as i was not always monitoring it.

thanks for all replies, i'm going to study intern and others
suggestions, hope also someone will bring a pythonic way to know memory
usage :)

best.

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


Re: py2exe questions

2006-11-04 Thread Jerry
The McMillan (sp?) Python Installer has recently been resurrected as
well, though now, it is just called PyInstaller and can be found at
http://pyinstaller.python-hosting.com/

It allows you to create a one file distributable without the need to go
back to Python2.3.

Despite what everyone is saying though, I believe that any and all
solutions will require that the byte-code be extracted to some
directory before being run.  It's not as though you are REALLY
compiling the language to native code.  It's just a bootstrap around
the Python interpreter and your code plus any modules that it needs to
run.

--
Jerry

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


Re: WSDL?

2006-11-04 Thread Jorge Vargas
On 11/3/06, tobiah <[EMAIL PROTECTED]> wrote:
> Is WSDL the right answer for in house communication
> between programs written in different languages, or
> is it more for publishing interfaces for use by parties
> outside your own company?
>
at work we use webservices (which is a better name) a lot for
"inhouse" but I work at a big company where other people look like if
they where another company ;)

as soring explained WSDL is a languaje to tell you what to do. the
idea behind it is that anyone can take it read it and write a client
for your service without even having help your your team.

so yes it can or as other people said you could just go with a lossier
webservice interface based on xmlrpc.

and please please don't go to corba we need to kill that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe questions

2006-11-04 Thread Fredrik Lundh
Jerry wrote:

> Despite what everyone is saying though, I believe that any and all
> solutions will require that the byte-code be extracted to some
> directory before being run.

the Python interpreter doesn't really care what you believe, though; 
it's perfectly capable of executing byte code that's stored in memory
buffers.



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


[OT] how to write code into a blog post?

2006-11-04 Thread Jorge Vargas
Hi I know many people here blog so sorry for the OT.

Currently I have a wordpress install and went I wanted to post some
code I notice how painfull it is. I'm still in shock that programmers
forgot about posting code on their own engine, but oohh well they are
php :D

anyway I'll like to know your experiences I google around for wp
plugins and half of them are dead links and the other half I wasn't
very existed about.

I'm running this on a very good webhost so I can install pretty much
anything. so I'll accept suggestions either for wp plugins or another
engine, but the only way I'll accept something like blogger is that
they let me have it on my hostname or at least make me do overwrites.

I'm even willing to change my blogging platform if that's the best
way. So please post your suggestions there too.

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


Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread robert
Paul Rubin wrote:
> robert <[EMAIL PROTECTED]> writes:
>>> I don't want to discourage you but what about reference
>>> counting/memory
>>> management for shared objects? Doesn't seem fun for me.
>> in combination with some simple locking (anyway necessary) I don't
>> see a problem in ref-counting.
>> If at least any interpreter branch has a pointer to the (root)
>> object in question the ref-count is >0. 
>> Question Besides: do concurrent INC/DEC machine OP-commands execute
>> atomically on Multi-Cores as they do in Single-Core threads?
> 
> Generally speaking, no, the inc/dec instructions are not atomic.  You
> can do an atomic increment on the x86 using LOCK XCHG (or maybe LOCK
> INC is possible).  The thing is that the locking protocol that
> guarantees atomicity is very expensive, like 100x as expensive as an
> unlocked instruction on a big multiprocessor.  So yes, of course you
> could accomplish reference counting through locks around the ref
> counts, but performance suffers terribly.  The solution is to get rid
> of the ref counts and manage the entire heap using garbage collection.
> 
> For stuff like dictionary access, there are protocols (again based on
> LOCK XCHG) that don't require locking for lookups.  Only updates
> require locking.  Simon Peyton-Jones has a good paper about how it's
> done in Concurrent Haskell:
> 
>   http://research.microsoft.com/~simonpj/papers/stm/stm.pdf
> 
> This is really cool stuff and has found its way into Perl 6.  I'd like
> to see Python get something like it.

Thats really interesting. Do expect this to remove once the GIL from Python? As 
dict-accesses (which are also must-be-atoms here) compose a major Python CPU 
load, the 100x costing instructions would probably put a >30% burden on Pythons 
overall speed.

A lock-protected possibilty to use multiple well separated Interpreters by 
tunneling objects will probably still be a most effective solution without 
speed costs.
The problem of singleton object's refcount (None, "", 1,2,3...), which MvL 
mentioned, is the main concern as far as I've understood. 
The locking of Python core global resources (files etc.) can be done with litte 
effort.
The globals of extension modules are not really critical, as in the typical 
applications the tunnel method is mainly used for limited number crunching and 
as programmer you are well aware of multi-interpreter-unfit modules (until they 
final become mature). There could be also a special import method to duplicate 
extension data as workaround.

The singletons refcount could be fix-reset to MAXINT/2 at refcreation-time (or 
GC or ..) or so to freeze them quiet for ever.

(Mutable (why?)) exception types could be doubled in same style as normal 
python modules, or they could be rendered read-only. Thrown Exceptions will not 
cross the border. ( Think, the fact that "Exception.x=5" is possible is more an 
artefact than intended )


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


Re: WSDL?

2006-11-04 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Jorge Vargas
wrote:

> and please please don't go to corba we need to kill that.

Have you real reasons or is this a religious thing?  As I see it Corba is
much better supported by Python libs than SOAP is.

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread robert
GHUM wrote:
> robert,
> 
>> Interprocess communication is tedious and out of questio
> [...]
>> I expect to be able to directly push around Python Object-Trees between the 
>> 2 (or more) interpreters by doing some careful locking.
> 
> Please do yourself a favour and have a look at pyro. pyro makes
> InterComputer and InterProcess Communication a snap. And it allows you
> to push around Python Objects not only between processes, but
> computers.
> 
> Maybe it solves your problem much easier and even more than you want to
> solve it now by being able to use more then one computer.
> 

another MPI - pickles and worse on the network :-(   Havy networked batch jobs 
were never a problem with Python. Thats what I want to go away from. Read the 
rest of this thread. Discussion is about in-place object tunnel for fine 
grained high-speed SMP multi-threading ("memory bus")
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Forum written in Python?

2006-11-04 Thread Jorge Vargas
On 11/2/06, Karlo Lozovina <[EMAIL PROTECTED]> wrote:
> Are there any forum or bulletin board systems written entirely in Python?
> I got sick of PhpBB, mostly because I can't tweak and fiddle with the
> code, since I really don't like PHP and don't know it that well.
>
> I thought of writting my own simple forum software, but if there are
> existing projects out there, I wouldn't mind contributing. So far I found
> out about Pocoo, but it seems to immature right now, I was looking for
> something comparable to PhpBB or IPB?
>
why not contribute to Pocoo?

>
> --
>  ___Karlo Lozovina - Mosor
> |   |   |.-.-. web: http://www.mosor.net || ICQ#: 10667163
> |   ||  _  |  _  | Parce mihi domine quia Dalmata sum.
> |__|_|__||_|_|
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WSDL?

2006-11-04 Thread Jorge Vargas
On 11/4/06, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> In <[EMAIL PROTECTED]>, Jorge Vargas
> wrote:
>
> > and please please don't go to corba we need to kill that.
>
> Have you real reasons or is this a religious thing?  As I see it Corba is
> much better supported by Python libs than SOAP is.
>
I see ZSI as a very good engine for SOAP as for xmlrpc it's "better"
since you can interact with a browser and then you can even have json
rpc.

but yes ur right is mostly because of religious reasons :)

> Ciao,
> Marc 'BlackJack' Rintsch
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe questions

2006-11-04 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Jerry wrote:

> Despite what everyone is saying though, I believe that any and all
> solutions will require that the byte-code be extracted to some
> directory before being run.

It's not Python bytecode.  The problem is native libraries which are hard
to run from memory without a real file backing it on some platforms.  A
pure Python program/package should be possible without temporary files.

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how do I pass values between classes?

2006-11-04 Thread Larry Bates
kath wrote:
> hi everyone.
> 
> I have a task, I have fragmented the task into subtask. I have planned
> to create a class to each subclass and one parent class to handle the
> sub tasks. Each subclass are saved in seperate file and all my
> subclasses and parent class are placed in the same folder.
> 
> The parent class is subclass of wx.Frame, and subclasses are subclass
> of wx.Panel. Each subclass will create a GUI for each task..
> 
> ok.. here is problem
> 
> When a menu is selected in the parent class, im instantiating the child
> class(i.e, Panel), which has textbox and two buttons. first button is
> used to select a file, and second one I have planned to, read the file
> and pass the values to parent class [B]OR[/B] pass the filepath to
> parent to read and do rest of the work.
> 
> How do I do that?
> 
> Please tell me whether I am following a correct method, by fragmenting
> task  into small task and assigning it to child class and saving it in
> a separate file?.
> 
> ok, here is the Parent class
> [code]
> import wx
> import client
> """My Parent class"""
> class Parent(wx.Frame):
> def __init__(self, parent, id, title):
> wx.Frame.__init__(self, parent, id, title)
> 
> menu=wx.Menu()
> menu.Append(5000, "File")
> menu.AppendSeparator()
> menu.Append(5001, "Exit")
> menubar=wx.MenuBar()
> menubar.Append(menu, "File")
> self.SetMenuBar(menubar)
> self.Bind(wx.EVT_MENU, self.OnFile,id=5000)
> self.Bind(wx.EVT_MENU, self.OnExit,id=5001)
> 
> def OnFile(self, event):
> self.cl=client.Child(self, -1)
> 
> def OnBrowse(self, event):
> dir=""
> d=x.FileDialog(self, "Choose an Excel file", self.dirname, "",
> "*.xls", wx.OPEN)
> if d.ShowModal() == wx.ID_OK:
> self.filename=d.GetFilename()
> self.dirname=d.GetDirectory()
> self.filepath.SetValue(os.path.join(self.dirname,
> self.filename))
> 
> def OnUpload(self, event):
> pass
> 
> def OnExit(self, event):
> self.Close()
> 
> class MyApp(wx.App):
> def OnInit(self):
> frame=Parent(None, -1, "Parent window")
> frame.Show(True)
> self.SetTopWindow(frame)
> return True
> 
> if __name__ == '__main__':
> app=MyApp(redirect=False)
> app.MainLoop()
> 
> [/code]
> 
> and Child class
> [code]
> import wx, os
> 
> """My Child class"""
> 
> class Child(wx.Panel):
> def __init__(self, parent, id):
> wx.Panel.__init__(self, parent, id, size=(300,300))
> box=wx.BoxSizer(wx.HORIZONTAL)
> label=wx.StaticText(self, -1, "File Path:  ")
> 
> self.text=wx.TextCtrl(self, -1)
> browse=wx.Button(self, -1,"Browse")
> upload=wx.Button(self, -1, "Upload")
> self.Bind(wx.EVT_BUTTON, self.OnBrowse, browse)
> self.Bind(wx.EVT_BUTTON, self.OnUpload, upload)
> box.Add(label)
> box.Add(self.text)
> box.Add(browse)
> 
> mainbox=wx.BoxSizer(wx.VERTICAL)
> mainbox.Add(box)
> mainbox.Add(upload)
> 
> self.SetSizer(mainbox)
> mainbox.Layout()
> def OnBrowse(self, event):
> self.dir=""
> d=wx.FileDialog(self, "Choose an Excel file", self.dir, "",
> "*.xls", wx.OPEN)
> if d.ShowModal() == wx.ID_OK:
> self.filename=d.GetFilename()
> self.dir=d.GetDirectory()
> self.text.SetValue(os.path.join(self.dir, self.filename))
> 
> def OnUpload(self, event):
> pass
> 
> class MyApp(wx.App):
> def OnInit(self):
> frame=wx.Frame(None, -1, "Child window")
> panel=Child(frame, -1)
> frame.Show(True)
> self.SetTopWindow(frame)
> return True
> 
> if __name__ == '__main__':
> app=MyApp()
> app.MainLoop()
> [/code]
> 
> thank you,
> regards,
> kath.
> 
You might consider doing it the same way wx passes things around.
When you instantiate the subclass pass the parent class' instance
as first argument to __init__ method.  That way the subclass can
easily pass values back to the parent by using that pointer.

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


Re: WSDL?

2006-11-04 Thread Steve Holden
Jorge Vargas wrote:
> On 11/4/06, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> 
>>In <[EMAIL PROTECTED]>, Jorge Vargas
>>wrote:
>>
>>
>>>and please please don't go to corba we need to kill that.
>>
>>Have you real reasons or is this a religious thing?  As I see it Corba is
>>much better supported by Python libs than SOAP is.
>>
> 
> I see ZSI as a very good engine for SOAP as for xmlrpc it's "better"
> since you can interact with a browser and then you can even have json
> rpc.
> 
> but yes ur right is mostly because of religious reasons :)
> 
When SOAP can do everything that Corba can do, and as efficiently, it 
might stand a chance of displacing it. I see SOAP as essentially an ugly 
bloated NIH response of the Microsoft camp to an open specification that 
achieved all its goals in an elegant way. And all to allow inappropriate 
remote-method execution through port 80 to avoid the corporate firewall. 
Which ultimately just made firewalling port 80 that much more difficult.

Microsoft is a poor church, and very uncaring of its adherents. So take 
your religious reasons and leave Corba alone until SOAP is an effective 
competitor ;-)

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: small python cgi webserver

2006-11-04 Thread Fabian Braennstroem
Hi Norbert,

* Norbert Kaufmann <[EMAIL PROTECTED]> wrote:
> Fabian Braennstroem wrote:
> [...]
>> 
>> Maybe, I understood something wrong, but I thought that the
>> above 'webserver' script would replace apache in my case; at
>> least I hoped!?
>> 
>
> It does. The 'ServerRoot' and 'DocumentRoot' directories are the
> directories you are starting your webserver in.
> Create a 'cgi' directory inside this and consider that you have to name
> it in the serverscript in relation to the serverroot!
>
> 
> cgi_directories=["/home/fab/Desktop/cgi-bin"]
> 
>
> This means you have to start your server inside directory '/'.

I tried this, but it does not help ... a wait, the leading
'/' is the problem. Thanks!
>
> If you start your server in your home dir '/home/fab' then you have to
> name your cgi_directories ['/Desktop/cgi-bin'].
>
> In your response (cgi-script) you have to divide the header from the
> content '\r\n\r\n'.

I am not sure, what that means!?  ... but it works :-)

Greetings!
 Fabian

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


Python crushing on kinterbasdb connect @ FreeBSD

2006-11-04 Thread Almad
Hi,

I uploaded my application on our production server running FreeBSD and
I found it crashing at startup.

Problem is in connecting to my Firebird database:
kinterbasdb.connect(with either good or wrong arguments) is resolving
in:

python in free(): error: junk pointer, too high to make sense
Abort trap (core dumped)

I installed kinterbasdb manually while I need 3.2 version for DBClass
and latest in ports is 3.1; could this be the problem? (rest of system
is from ports)

Thank You for any advice,

Almad

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


Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread Martin v. Löwis
robert schrieb:
> PS: Besides: what are speed costs of LOCK INC  ?

That very much depends on the implementation. In

http://gcc.gnu.org/ml/java/2001-03/msg00132.html

Hans Boehm claims it's 15 cycles. The LOCK prefix
itself asserts the lock# bus signal for the entire
operation, meaning that the other processors
can't perform memory operations during that time.
On the P6, if the data is cacheable (for some Intel
definition of this word), the lock# signal will
not be asserted, just the cache gets locked.
The LOCK prefix also causes any pending writes
to be performed before the operation starts.

So in the worst case, a LOCK INC will have to
wait for pending writes, then will assert the
lock# prefix, then perform a read and a write
cycle memory cycle, with the increment processor
cycle in-between. Assuming a 400MHz memory bus
and a 4GHz processor, LOCK INC will take around
20 cycles, whereas a plain INC might get done
in a single cycle or less (assuming pipelining
and caching).

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PySchool - Online Python Web Framework Workshop.

2006-11-04 Thread RobJ

Thanks James and Steve for the feedback I have made the appropriate
changes and republished the survey at the following URL:

http://killersurvey.com/answer_survey.php?id=490

Rob J



James Stroud wrote:
> RobJ wrote:
> > Hi! My Name is Rob Johnson and I am a graduate student at The Richard
> > Stockton College of NJ. To make a long story short, I'm working on my
> > Masters project in the MAIT program (Masters of Arts in Instructional
> > Technology). I have written a proposal to put together a free on-line
> > Python web framework workshop. The workshop will be geared to help
> > people new to Python web frameworks. I am asking for the community's
> > assistance to help me get this project off the ground. As part of my
> > project, I am conducting a survey for people who are interested in
> > learning more about python web frameworks.  The survey is located at
> > http://killersurvey.com/answer_survey.php?id=479. I have also started a
> > blog about this experience in order to let people know what I'm doing
> > (http://pyschool.blogspot.com/). If you have a few minutes, please take
> > a couple of minutes to take the quick survey. The survey is anonymous
> > and the information will be used for statistics for my project. Also,
> > any constructive feedback or suggestions that you can give me would be
> > gladly appreciated.
> >
> > Thanks
> >
> > Rob J
> >
> Q9 should be "check all that apply" or otherwise qualified with "primarily".
>
> Q10 is missing other types of broadband such as what one might find at
> school, and also have the option of multiple selections.

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


Re: PySchool - Online Python Web Framework Workshop.

2006-11-04 Thread Fuzzyman

RobJ wrote:
> Hi! My Name is Rob Johnson and I am a graduate student at The Richard
> Stockton College of NJ. To make a long story short, I'm working on my
> Masters project in the MAIT program (Masters of Arts in Instructional
> Technology). I have written a proposal to put together a free on-line
> Python web framework workshop. The workshop will be geared to help
> people new to Python web frameworks. I am asking for the community's
> assistance to help me get this project off the ground. As part of my
> project, I am conducting a survey for people who are interested in
> learning more about python web frameworks.  The survey is located at
> http://killersurvey.com/answer_survey.php?id=479. I have also started a
> blog about this experience in order to let people know what I'm doing
> (http://pyschool.blogspot.com/). If you have a few minutes, please take
> a couple of minutes to take the quick survey. The survey is anonymous
> and the information will be used for statistics for my project. Also,
> any constructive feedback or suggestions that you can give me would be
> gladly appreciated.
>

This is a good idea. Good luck.

I hope you make the results of the survey public.

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml
> Thanks
> 
> Rob J

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


Re: WSDL?

2006-11-04 Thread Jorge Vargas
On 11/4/06, Steve Holden <[EMAIL PROTECTED]> wrote:
> Jorge Vargas wrote:
> > On 11/4/06, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> >
> >>In <[EMAIL PROTECTED]>, Jorge Vargas
> >>wrote:
> >>
> >>
> >>>and please please don't go to corba we need to kill that.
> >>
> >>Have you real reasons or is this a religious thing?  As I see it Corba is
> >>much better supported by Python libs than SOAP is.
> >>
> >
> > I see ZSI as a very good engine for SOAP as for xmlrpc it's "better"
> > since you can interact with a browser and then you can even have json
> > rpc.
> >
> > but yes ur right is mostly because of religious reasons :)
> >
> When SOAP can do everything that Corba can do, and as efficiently, it
> might stand a chance of displacing it. I see SOAP as essentially an ugly
> bloated NIH response of the Microsoft camp to an open specification that
> achieved all its goals in an elegant way. And all to allow inappropriate
> remote-method execution through port 80 to avoid the corporate firewall.
> Which ultimately just made firewalling port 80 that much more difficult.
>
I have to disagree WSDL is a great standard and SOAP is great for
transfering data from point a to point b. and it's very usefull for
giving an interface for people to use like all those web2.0 api's out
there.

I agree on setting a server on port 80 to be a problem but that's a
deployment issue I have never set a SOAP server on port 80 myself.

> Microsoft is a poor church, and very uncaring of its adherents. So take
> your religious reasons and leave Corba alone until SOAP is an effective
> competitor ;-)
>
I'm sorry it's probably that I have seen some many bad Corba
implementations at work that I just hate them. I recently found out
that gnome applets are implemented on top of Corba and I'm very
impress.

> regards
>   Steve
> --
> Steve Holden   +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd  http://www.holdenweb.com
> Skype: holdenweb   http://holdenweb.blogspot.com
> Recent Ramblings http://del.icio.us/steve.holden
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sorted and reversed on huge dict ?

2006-11-04 Thread vd12005

just to be sure about intern, it is used as :

>>> d, f = {}, {}
>>> s = "this is a string"
>>> d[intern(s)] = 1
>>> f[intern(s)] = 1

so actually the key in d and f are a pointer on an the same intern-ed
string? if so it can be interesting,

>>> print intern.__doc__
intern(string) -> string

``Intern'' the given string.  This enters the string in the (global)
table of interned strings whose purpose is to speed up dictionary
lookups.
Return the string itself or the previously interned string object with
the
same value.

the comment here: "(Changed in version 2.3: Interned strings used to be
immortal, but you now need to keep a reference to the interned string
around.)", if it the string is used as a key, it is still reference-d,
am i right?

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


elementtree terminology + tangential questions

2006-11-04 Thread mirandacascade
Was prompted to ask these questions when reading the following link:

http://effbot.org/zone/element-infoset.htm#mixed-content

provides a clear explanation of what the tail member is in the
elementtree package.

Questions:
1) In the xml world, is the text between an element's end tag and the
next tag referred to as the "tail"?
2) None of the xml documents to which I've had exposure (a very, very
small set) have had text between an element's end tag and the next tag,
hence the following question: are there some 'best practices' advice
available to help one decide when it's a good idea to put text between
an element's end tag and the next tag as opposed to putting text in the
text property of an element?
3) Are these questions appropriate for the comp.lang.python group, or
should they be directed to a different group?

Thank you.

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


Re: PySchool - Online Python Web Framework Workshop.

2006-11-04 Thread czhang . cmu
Interesting idea. Just realized that I am the first person who took the
republished survey. :-)
I suggest that you also post this message to various Python web
framework's m-list.

RobJ 写道:

> Thanks James and Steve for the feedback I have made the appropriate
> changes and republished the survey at the following URL:
>
> http://killersurvey.com/answer_survey.php?id=490

-Cheng Zhang
Gentoo/Python/Django Powered
http://www.ifaxian.com
1st Django powered site in Chinese ;-)
http://www.aiyo.cn
Our 2nd Django powered site in Chinese

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

disabledforeground or similar for Entry (in Tkinter)

2006-11-04 Thread Dustan
Back in this post, I attempted to make a label look like a button:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a83195d3970a6851/2053cbaec1bc1f19?auth=DQAAAHkMDAWnhNnzpuKlwOKZUwAGUTtT2Ay-EAB7rCY6SnwfnDzZ98M37bZDW2Is0LrBVrr8XEgPfcuOkiUE-CrSsKbBSX-67voDUXfbATBd0eYNMClezby4EXT2fuLm6f0llJ_xMO8BfkjVho_7CZvlf_9tNGnJixTbq8zr21ODZBhouQ

Alright, I've learned my lesson - don't use a new widget; modify the
old one.

Except the Entry widget doesn't have a disabledforeground option.
Neither does the Text widget, but IDLE seems to accomplish making a
disabled Text look the same as an enabled Text in the IDLE Help
section.

No, foreground (fg) and background (bg) don't make a difference; it
still changes the color of the Entry widget upon disabling.

There must be something I'm missing here...

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


Re: disabledforeground or similar for Entry (in Tkinter)

2006-11-04 Thread Dustan

Dustan wrote:
> Back in this post, I attempted to make a label look like a button:
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/a83195d3970a6851/2053cbaec1bc1f19?auth=DQAAAHkMDAWnhNnzpuKlwOKZUwAGUTtT2Ay-EAB7rCY6SnwfnDzZ98M37bZDW2Is0LrBVrr8XEgPfcuOkiUE-CrSsKbBSX-67voDUXfbATBd0eYNMClezby4EXT2fuLm6f0llJ_xMO8BfkjVho_7CZvlf_9tNGnJixTbq8zr21ODZBhouQ
>
> Alright, I've learned my lesson - don't use a new widget; modify the
> old one.
>
> Except the Entry widget doesn't have a disabledforeground option.
> Neither does the Text widget, but IDLE seems to accomplish making a
> disabled Text look the same as an enabled Text in the IDLE Help
> section.
>
> No, foreground (fg) and background (bg) don't make a difference; it
> still changes the color of the Entry widget upon disabling.
>

> There must be something I'm missing here...

Yes there is! I assumed that
http://www.pythonware.com/library/tkinter/introduction/x4447-options.htm
was telling the truth, in that it's not listed there.

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


Re: python GUIs comparison (want)

2006-11-04 Thread Mudcat
I have been using Tkinter for several years now. Recently I have been
thinking about switching to something else that may have a sharper
appearance. However I'm not sure what that may be, and if that
something else is *that* much better than what I'm already using.

Does everyone agree that wxPython looks best on Windows? I've also read
in a couple of places where Dabo looks pretty good as well.

So if someone were to pick a UI that gave the best appearance, what
would they choose?



Kevin Walzer wrote:
> [EMAIL PROTECTED] wrote:
> > Now i began to learn GUI programming. There are so many
> > choices of GUI in the python world, wxPython, pyGTK, PyQT,
> > Tkinter, .etc, it's difficult for a novice to decide, however.
> > Can you draw a comparison among them on easy coding, pythonish design,
> > beautiful and generous looking, powerful development toolkit, and
> > sufficient documentation, .etc.
> > It's helpful for a GUI beginner.
> > Thank you.
> >
> >
> > :)Sorry for my poor english.
> >
>
> Tkinter:
> Pro: Default GUI library for Python; stable; well-supported
> Con: Needs extension for complex/rich GUI's; core widgets are dated in
> look and feel; many modern extensions in Tcl/Tk have not made it into
> Tkinter or are not widely used (Tile, Tablelist)
>
> wxPython:
> Pro: Popular, actively developed, wraps native widgets, looks great on
> Windows, commercial-friendly license
> Con: Based on C++ toolkit; docs assume knowledge of C++; some think
> coding style is too much like C++; complex to build and deploy on Linux
>  (wraps Gtk)
>
> PyQt:
> Pro: Powerful, cross-platform, sophisticated GUI's
> Con: Based on C++ toolkit; docs assume knowledge of C++; commercial
> deployment is expensive; free deployment must be GPL; smaller
> development and user community than wxPython
>
> PyGtk:
> Pro: Sophisticated GUI's, cross-platform (Linux and Win32); very popular
> on some platforms; active development community
> Con: Not native on OS X
>
>
>
> 
> 
> -- 
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com

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


python to sharepoint ?

2006-11-04 Thread curtin
anyone have code that allows me to post files direct to sharepoint from
python? 

any pointers, FAQ, etc,  appreciated!

thanks,

craig

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


Re: python GUIs comparison (want)

2006-11-04 Thread Peter Decker
On 4 Nov 2006 08:23:40 -0800, Mudcat <[EMAIL PROTECTED]> wrote:

> I have been using Tkinter for several years now. Recently I have been
> thinking about switching to something else that may have a sharper
> appearance. However I'm not sure what that may be, and if that
> something else is *that* much better than what I'm already using.
>
> Does everyone agree that wxPython looks best on Windows? I've also read
> in a couple of places where Dabo looks pretty good as well.

Dabo uses wxPython, so it looks exactly the same. The difference is in
the coding: writing stuff in wxPython is like writing C++ code, while
creating GUIs in Dabo is like writing Python code. Dabo also has a lot
of tools for creating GUIs visually, but even if you don't use those,
Dabo is a huge improvement over raw wxPython.

-- 

# p.d.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python GUIs comparison (want)

2006-11-04 Thread Fredrik Lundh
Mudcat wrote:

> I have been using Tkinter for several years now. Recently I have been
> thinking about switching to something else that may have a sharper
> appearance. However I'm not sure what that may be, and if that
> something else is *that* much better than what I'm already using.

Tk 8.5 isn't that far away, though.

http://www.markroseman.com/tcl/guide85.html



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


Trouble compiling win32all on Windows

2006-11-04 Thread robert
I've trouble compiling win32all. VC98 and latest SDK installed (otherwise with 
original SDK it won't even compile).
It tells that uuid.lib(cguid_i.obj) : fatal error LNK1103: debug info is 
destroyed.  This lib file is in the SDK file tree. What should I do?

( a cguid_i.* file is not in this SDK tree )


C:\usr\src\pywin32-210>python setup.py -q build
Building pywin32 2.3.210.0
PyACL.cpp
PyDEVMODE.cpp
PyHANDLE.cpp
PyIID.cpp
PyLARGE_INTEGER.cpp
PyOVERLAPPED.cpp
PySECURITY_ATTRIBUTES.cpp
PySECURITY_DESCRIPTOR.cpp
PySID.cpp
PyTime.cpp
PyUnicode.cpp
PyWAVEFORMATEX.cpp
PyWinTypesmodule.cpp
   Bibliothek build\temp.win32-2.3\Release\win32\src\pywintypes23.lib und Objekt
 build\temp.win32-2.3\Release\win32\src\pywintypes23.exp wird erstellt
uuid.lib(cguid_i.obj) : fatal error LNK1103: Debug-Informationen beschaedigt; Mo
dul muss neu kompiliert werden.
error: command '"C:\Programme\Microsoft Visual Studio\VC98\BIN\link.exe"' failed
 with exit status 1103

C:\usr\src\pywin32-210>




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


Re: py2exe questions

2006-11-04 Thread Thomas Heller
Marc 'BlackJack' Rintsch schrieb:
> In <[EMAIL PROTECTED]>, Jerry wrote:
> 
>> Despite what everyone is saying though, I believe that any and all
>> solutions will require that the byte-code be extracted to some
>> directory before being run.
> 
> It's not Python bytecode.  The problem is native libraries which are hard
> to run from memory without a real file backing it on some platforms.  A
> pure Python program/package should be possible without temporary files.

py2exe even achives this on Windows.  See http://www.py2exe.org/old/ ,
and look at the section named "The bundle option".  py2exe is able to
load Python extensions (.pyd and .dll) from the zip-archive *without*
extracting them to the file system at all.  It doesn't work for the C
runtime library msvcr71.dll though.

Thomas

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


Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes:
> > PS: Besides: what are speed costs of LOCK INC  ?
> 
> That very much depends on the implementation. In
> http://gcc.gnu.org/ml/java/2001-03/msg00132.html
> Hans Boehm claims it's 15 cycles. 

I think that has to be on a single processor, or at most a dual core
processor with shared cache on die.  With multiple cpu chips I don't
think can get the signals around that fast.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WSDL?

2006-11-04 Thread Paul Boddie
Jorge Vargas wrote:
>

[quotefest trimmed]

> I have to disagree WSDL is a great standard and SOAP is great for
> transfering data from point a to point b. and it's very usefull for
> giving an interface for people to use like all those web2.0 api's out
> there.

Well, unless you're dealing with some kind of multipoint communications
architecture, SOAP isn't really much better than just firing plain XML
documents over HTTP from A to B, although my preferred use-cases for
SOAP don't involve the RPC style of messaging that most people think of
when SOAP is mentioned, so I guess you could benefit from SOAP (plus
WSDL) if you do really care about RPC. However, one thing CORBA has
going for it is maturity: the basic standards aren't in flux, and there
are a number of acceptable implementations out there.

Paul

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


Re: Really strange behavior

2006-11-04 Thread Steven D'Aprano
On Sat, 04 Nov 2006 13:02:26 +0100, IloChab wrote:


> If I run this:
> # >
> import  qt4reactor
> import sys
> from PyQt4 import  QtGui
> from winIum import Window
> 
> def creApp():
> app = QtGui.QApplication(sys.argv)
> qt4reactor.install(app)
> retrun app

This is not actually the code you are trying to run, because "retrun app"
would give a SyntaxError. You should copy and paste the actual code you
have run, don't retype it.


> my window doesn't show and the script doesn't stop but remains trapped
> in some gui loop.
>  
> What's the problem I can't see??

Don't know, I can't see it either.

Why don't you add some temporary print statements into your code to try to
narrow it down?


def main():
print "entered main"
app = creApp()
print "done creApp"
creWin()
print "done creWin"
from twisted.internet import reactor
print "done import"
reactor.run()
print "done reactor.run; exiting main"


-- 
Steven.

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


win32file.DeviceIoControl(FSCTL_GET_RETRIEVAL_POINTERS)

2006-11-04 Thread Jim
I'm not sure how to perform this operation in Python. The difficulty is
in knowing the size of the output buffer: if it is too small, I get an
"insufficient buffer" exception; too large, and I get an "end of file"
exception. In neither case is any partial data available.

I'd rather not resort to a binary seach...

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


Re: win32file.DeviceIoControl(FSCTL_GET_RETRIEVAL_POINTERS)

2006-11-04 Thread Martin v. Löwis
Jim schrieb:
> I'm not sure how to perform this operation in Python. The difficulty is
> in knowing the size of the output buffer: if it is too small, I get an
> "insufficient buffer" exception; too large, and I get an "end of file"
> exception. In neither case is any partial data available.

What precisely is the "end of file" exception you are getting. Looking
at

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/fsctl_get_retrieval_pointers.asp

I'd say it is

ERROR_HANDLE_EOFThe volume is an NTFS file system volume and the
requested starting VCN is past the end of the file.

So my guess is you should just pass a smaller starting VCN.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32file.DeviceIoControl(FSCTL_GET_RETRIEVAL_POINTERS)

2006-11-04 Thread Jim
Mea culpa: files with *no* clusters return the end-of-file error.

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


Re: PySchool - Online Python Web Framework Workshop.

2006-11-04 Thread Ramon Diaz-Uriarte
Dear Rob,

On 4 Nov 2006 06:43:19 -0800, RobJ <[EMAIL PROTECTED]> wrote:
>
> Thanks James and Steve for the feedback I have made the appropriate
> changes and republished the survey at the following URL:
>
> http://killersurvey.com/answer_survey.php?id=490
>


Thanks for the update. However, a whole bunch of Linux distributions
are missing. For instance, I think that both Debian and Gentoo have a
large enough user base to deserve an explicit place in that list. And
I'd definitely add a way to list your very own distro, if not among
the listed, like you do in q. 3.

Best,

R.

> Rob J
>
>
>
> James Stroud wrote:
> > RobJ wrote:
> > > Hi! My Name is Rob Johnson and I am a graduate student at The Richard
> > > Stockton College of NJ. To make a long story short, I'm working on my
> > > Masters project in the MAIT program (Masters of Arts in Instructional
> > > Technology). I have written a proposal to put together a free on-line
> > > Python web framework workshop. The workshop will be geared to help
> > > people new to Python web frameworks. I am asking for the community's
> > > assistance to help me get this project off the ground. As part of my
> > > project, I am conducting a survey for people who are interested in
> > > learning more about python web frameworks.  The survey is located at
> > > http://killersurvey.com/answer_survey.php?id=479. I have also started a
> > > blog about this experience in order to let people know what I'm doing
> > > (http://pyschool.blogspot.com/). If you have a few minutes, please take
> > > a couple of minutes to take the quick survey. The survey is anonymous
> > > and the information will be used for statistics for my project. Also,
> > > any constructive feedback or suggestions that you can give me would be
> > > gladly appreciated.
> > >
> > > Thanks
> > >
> > > Rob J
> > >
> > Q9 should be "check all that apply" or otherwise qualified with "primarily".
> >
> > Q10 is missing other types of broadband such as what one might find at
> > school, and also have the option of multiple selections.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: elementtree terminology + tangential questions

2006-11-04 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, mirandacascade
wrote:

> 2) None of the xml documents to which I've had exposure (a very, very
> small set) have had text between an element's end tag and the next tag,
> hence the following question: are there some 'best practices' advice
> available to help one decide when it's a good idea to put text between
> an element's end tag and the next tag as opposed to putting text in the
> text property of an element?

This depends on the type of document.  Examples of xml with text between
tags are XHTML or DocBook. ::

  This is an example of "tail text" in
XHTML.

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


ANNOUNCE: Scribes 0.3 Released

2006-11-04 Thread mystilleef
I am pleased to release version 0.3 of Scribes. Scribes is a text
editor that uniquely balances simplicity with power. This release is a
significant milestone in providing you with an enjoyable text editing
experience. Bugs were squashed, new features implemented, countless
enhancements made and numerous performance optimizations tweaked. It is
strongly recommended that you upgrade to the new version.

release note: http://scribes.sourceforge.net/release-note-0-3.html

Flash Demo: http://scribes.sf.net/demo.htm

GIF Demo: http://www.minds.may.ie/~dez/images/blog/scribes.html

download: http://scribes.sf.net/download.html

templates: http://scribes.sf.net/templates.tar.bz2

website: http://scribes.sf.net/

donate: http://scribes.sf.net/donate.html

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


Re: elementtree terminology + tangential questions

2006-11-04 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 2) None of the xml documents to which I've had exposure (a very, very
> small set) have had text between an element's end tag and the next tag,
Text elements are not limited to printed/visible text.  If you parsed a 
formatted XML string, I think the indenting whitespace shows up as text 
elements between tags.

-- Paul 


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


Re: disabledforeground or similar for Entry (in Tkinter)

2006-11-04 Thread jim-on-linux
On Saturday 04 November 2006 11:03, Dustan wrote:
> Back in this post, I attempted to make a label
> look like a button:
> http://groups.google.com/group/comp.lang.python
>/browse_thread/thread/a83195d3970a6851/2053cbaec
>1bc1f19?auth=DQAAAHkMDAWnhNnzpuKlwOKZUwAGUTt
>T2Ay-EAB7rCY6SnwfnDzZ98M37bZDW2Is0LrBVrr8XEgPfcu
>OkiUE-CrSsKbBSX-67voDUXfbATBd0eYNMClezby4EXT2fuL
>m6f0llJ_xMO8BfkjVho_7CZvlf_9tNGnJixTbq8zr21ODZBh
>ouQ
>
> Alright, I've learned my lesson - don't use a
> new widget; modify the old one.
>
> Except the Entry widget doesn't have a
> disabledforeground option. Neither does the
> Text widget, but IDLE seems to accomplish
> making a disabled Text look the same as an
> enabled Text in the IDLE Help section.
>
> No, foreground (fg) and background (bg) don't
> make a difference; it still changes the color
> of the Entry widget upon disabling.
>
> There must be something I'm missing here...

Have you tried the state option ?

state = 'disabled'

It works for Text, Entry, and Button.  

Once disabled you won't be able to make changes 
until state= 'normal'

jim-on-linux

http://www.inqvista.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what's the difference between these two methods? (aka, why doesn't one of them work?)

2006-11-04 Thread John Salerno
Steve Holden wrote:

> Don't worry. It's sometimes difficult for the effbot to remember we 
> aren't all as fearsomely intelligent as it is. I think it does a 
> remarkably complete emulation of a human being:
> 
>http://www.flickr.com/photos/[EMAIL PROTECTED]/152495923/
> 
> For what it's worth it's also amazingly helpful if you can ignore to 
> sometimes acerbic wit.
> 
> regards
>   Steve

Heh heh. Things wouldn't be the same without him...I mean "it".  :)
-- 
http://mail.python.org/mailman/listinfo/python-list


NEWBIE: Script help needed

2006-11-04 Thread Lorenzo
I have this script that I want to use weekly to send me email with 
information regarding disk space and available upgrades for my system. 
This script is actually a learning tool for me as I learn Python. The 
problem I've run into has me stumped and I need some help. What happens 
is when the script runs it does these things, parses the result and 
appends that to an html string:

1) checks disk space by using df -t reiserfs
2) runs time emerge --sync 
3) runs emerge -uvp world
4) runs emerge -uv --fetchonly world

The 'emerge' command is a Gentoo specific one. If I remove step 3), 
everything else runs just fine, the email is sent and I receive what I 
expect. But when step 3) is allowed to run, even if its the only command 
that runs, it hangs somewhere in the function getCommandOutput. If I try 
and debug the command, it appears to hang on this line:
err = child.wait()

I suspect a race condition, but I'm not sure how to proceed, can someone 
lend me a hand. Here is the script I wrote, I got the command 
getCommandOutput from this site: 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52296
TIA

[code]
#!/usr/bin/python


### NEED TO RUN THIS AS ROOT ###
### EMERGE SYNC REQUIRES THIS ###

import os, re, smtplib, MimeWriter, mimetools, cStringIO, popen2, fcntl, 
select, pdb

cmd = 'df -t reiserfs'
finalList = []
theOutput = []

text = "This realy should be in HTML"


html = "\
\
\
\
Disk Utilization on 
Hedley:"

out = cStringIO.StringIO()
writer = MimeWriter.MimeWriter(out)
txtin = cStringIO.StringIO(text)


def createhtmlmail (html, text, subject):
 """Create a mime-message that will render HTML in popular
  MUAs, text in better ones"""
   import MimeWriter
   import mimetools
   import cStringIO
   
   out = cStringIO.StringIO() # output buffer for our message 
   htmlin = cStringIO.StringIO(html)
   txtin = cStringIO.StringIO(text)
   
   writer = MimeWriter.MimeWriter(out)
   #
   # set up some basic headers... we put subject here
   # because smtplib.sendmail expects it to be in the
   # message body
   #
   writer.addheader("Subject", subject)
   writer.addheader("MIME-Version", "1.0")

   writer.addheader("From", "[EMAIL PROTECTED]")
  writer.addheader("To", "[EMAIL PROTECTED]")
   #
   # start the multipart section of the message
   # multipart/alternative seems to work better
   # on some MUAs than multipart/mixed
   #
   writer.startmultipartbody("alternative")
   writer.flushheaders()
   #
   # the plain text section
   #
   subpart = writer.nextpart()
   subpart.addheader("Content-Transfer-Encoding", "quoted-printable")
   pout = subpart.startbody("text/plain", [("charset", 'us-ascii')])
   mimetools.encode(txtin, pout, 'quoted-printable')
   txtin.close()
   #
   # start the html subpart of the message
   #
   subpart = writer.nextpart()
   subpart.addheader("Content-Transfer-Encoding", "quoted-printable")
   #
   # returns us a file-ish object we can write to
   #
   pout = subpart.startbody("text/html", [("charset", 'us-ascii')])
   mimetools.encode(htmlin, pout, 'quoted-printable')
   htmlin.close()
   #
   # Now that we're done, close our writer and
   # return the message body
   #
   writer.lastpart()
   msg = out.getvalue()
   out.close()
   print msg
   return msg

def makeNonBlocking(fd):
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
try:
   fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NDELAY)
except AttributeError:
   fcntl.fcntl(fd, fcntl.F_SETFL, fl | fcntl.FNDELAY)


def getCommandOutput(command):
theOutput = []
child = popen2.Popen3(command, 1) # capture stdout and stderr from 
command
child.tochild.close() # don't need to talk to child
outfile = child.fromchild 
outfd = outfile.fileno()
errfile = child.childerr
errfd = errfile.fileno()
makeNonBlocking(outfd)# don't deadlock!
makeNonBlocking(errfd)
outdata = errdata = ''
outeof = erreof = 0
while 1:
   ready = select.select([outfd,errfd],[],[]) # wait for input
   if outfd in ready[0]:
   outchunk = outfile.read()
   if outchunk == '': outeof = 1
   outdata = outdata + outchunk
   if errfd in ready[0]:
   errchunk = errfile.read()
   if errchunk == '': erreof = 1
   errdata = errdata + errchunk
   if outeof and erreof: break
   select.select([],[],[],.1) # give a little time for buffers to fill
   err = child.wait()
if err != 0: 
   raise RuntimeError, '%s failed w/ exit code %d\n%s' % (command, err, 
errdata)
theOutput.append(outdata)
theOutput.append(errdata)
return theOutput


#Run df and get the disk info
output =  os.popen(cmd)

# match two or more spaces, the header line has a sngle
# space between the 'Mouted on' field
# We need to keep those together
# The other spaces are the separation in the field headers
# To get the output from df down to just the field headers
# and the data, we need to match 2 or more spaces
# -

program written to model population evolving over time

2006-11-04 Thread sam
dear all,

i've just finished a program which sets up an initial population
consisting of four different phenotypes, allows them to evolve over
time and graphs the output at the end, displaying what is in effect the
evolutionary steady state for the system.

i'm no authority on evolutionary game theory (to put it mildly), but
there is a certain amount of interesting emergent behaviour if you put
the initial parameters in in a certain manner.

excuse my ignorance, but is there a site where people post this kind of
stuff? i figured someone might be interested in playing with it,
tweaking it a bit, changing the parameters. i've only been programming
a couple of months, so i'm sure more experienced programmers could
whack into shape if they were interested. or not...

it's about 500 lines, including white space and comments, probably
about 400 lines of pretty unconcise code in all. thought i'd try and
contribute something for once instead of just asking questions.

sam

PS it does actually work, in case you're wondering.  :-)

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


Re: Converting Microsoft Works databases.... *shudder*

2006-11-04 Thread Ian Stephenson
I have Works 8.0 and you can SAVE AS to dBase IV format.  Not sure for other 
versions.

Regards,
Ian


"Michael B. Trausch" <"mike$#at^&nospam!%trauschus"> wrote in message 
news:[EMAIL PROTECTED]
>I was wondering if anyone has had any experience with this.  Someone I
> know is trying to move away from Microsoft Works, and I am trying to
> look into a solution that would convert their data in a lossless fashion
> to a more modern format.  The database has more than 65K rows, so
> converting it to be an Excel spreadsheet, would, AFAIK, not be an option.
>
> It would seem that MS Works can export the database as a DBF format
> database, though I have not tried it.  Before I get started, I was
> wondering if anyone has been through this problem in the past and used
> Python to solve the problem.  Knowing nearly nothing about the DBase
> family of application software, and database formats, I find myself
> feeling like the information out there is, frankly, a bit overwhelming.
>
> Would the recipe specified in the "dbf to csv" thread be useful here for
> a file in DBase IV format?  It of course uses the same extension, but I
> am not sure if the file semantics are at all similar.  The idea at the
> end would be to probably create a database on an small SQL server (like
> MySQL) and let the person access their data using ODBC on their Windows
> workstation so that they can create form letters and the like.  They do
> not have access to MS Office's Access product, nor do they wish to use
> OOo Base (and I can't say that I blame them -- it seems to crash far too
> often to be considered reliable stuff).
>
> -- Mike 


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


WebScraping

2006-11-04 Thread Graham Feeley
Can someone steer me to scripts / modules etc on webscraping please???
Ultimately I would like someone to write a script for me.
However i am still searching for documentation on this subject
Thanks Graham



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


Re: Python tools for managing static websites?

2006-11-04 Thread Florian Diesch
"Chris Pearl" <[EMAIL PROTECTED]> wrote:

> Are there Python tools to help webmasters manage static websites?
>
> I'm talking about regenerating an entire static website - all the HTML
> files in their appropriate directories and sub-directories. Each page
> has some fixed parts (navigation menu, header, footer) and some
> changing parts (body content, though in specific cases the normally
> fixed parts might change as well). The tool should help to keep site
> editing DRY every piece of data, including the recurring parts, should
> exist only once.


Tahchee  

SUMMARY = "Automated static and dynamic web site creation tool" 
DESCRIPTION = """\  
Tahchee is a tool for developers and Web designers that makes it possible to
easily build a static Web site using the Cheetah template system. It is used to 
fill in the gap between bare template and macro processing system and dynamic   
template-based Web sites. It acts both as a build system (à la "make") as well  
as an extension to the Cheetah template that makes it really easy to build small
to medium-sized sites. It is ideal for writing open source project or small 
company Web sites.\ 
"""  



   Florian
-- 

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


Re: how to write code into a blog post?

2006-11-04 Thread thebjorn
Jorge Vargas wrote:
> Hi I know many people here blog so sorry for the OT.
>
> Currently I have a wordpress install and went I wanted to post some
> code I notice how painfull it is.

Indeed :-)  I'm using the iG:Syntax Hiliter over on
http://blog.tkbe.org after I got some comments about the lack of
readability of my code samples ;-)  It can be even more colorful than
I've set it up, but it handles a considerable number of languages and
is pretty simple to both use and manage. You can get it at:
http://blog.igeek.info/wp-plugins/igsyntax-hiliter/  I added the
following to the end of the stylesheet to make the code frame bigger
and dynamic:

div.igBar { width: 95%; }
div.syntax_hilite { width:95%; }

hth,
-- bjorn

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


Re: py2exe questions

2006-11-04 Thread timmy
Doug Stell wrote:
> I have 2 questions about py2exe or any similar utility.
> 
> 1. Is it possible to create a single Windows executable that does not
> blow out to a folder full of files and can be called from scripts
> using command line arguments?
py2exe can most certainly do this.
> 
> 2. If the above can be done, it is possible to hide parts of the
> Python source code from users? These users are software developers,
> but we don't want them to see how the code does what it does.
> 
> thanks, doug
you can make a single exe in py2exe which would make it harder to 
disassemble, but there's no such thing in the software world that makes 
it impossible.

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


Re: disabledforeground or similar for Entry (in Tkinter)

2006-11-04 Thread jim-on-linux
On Saturday 04 November 2006 11:03, Dustan wrote:
> Back in this post, I attempted to make a label
> look like a button:
> http://groups.google.com/group/comp.lang.python
>/browse_thread/thread/a83195d3970a6851/2053cbaec
>1bc1f19?auth=DQAAAHkMDAWnhNnzpuKlwOKZUwAGUTt
>T2Ay-EAB7rCY6SnwfnDzZ98M37bZDW2Is0LrBVrr8XEgPfcu
>OkiUE-CrSsKbBSX-67voDUXfbATBd0eYNMClezby4EXT2fuL
>m6f0llJ_xMO8BfkjVho_7CZvlf_9tNGnJixTbq8zr21ODZBh
>ouQ
>
> Alright, I've learned my lesson - don't use a
> new widget; modify the old one.
>
> Except the Entry widget doesn't have a
> disabledforeground option. Neither does the
> Text widget, but IDLE seems to accomplish
> making a disabled Text look the same as an
> enabled Text in the IDLE Help section.
>
> No, foreground (fg) and background (bg) don't
> make a difference; it still changes the color
> of the Entry widget upon disabling.
>
> There must be something I'm missing here...

My previous post was hasty and we all know,  
"Haste makes waste."

Try this;

If you use wiget-01.pack_forget() or 
wiget-01.grid_forget(),  you can now build 
wiget-02 using wiget-02.pack or grid() for the 
same location. 

You can reinstall uninstalled wigets by using 
pack() or grid() again for those hidden wigets. 
However only after uninstalling for the wigets in 
those locations. 



root = Tk()

test1 = Button(root, text='Test No.1 button', bg = 
'yellow', width = 15, height = 10)
test1.grid(row=0, column=0)
test1.grid_forget()


test2 = Button(root, text='Test #2 button', bg = 
'green', width = 15, height = 10)
test2.grid(row=0, column=0)

mainloop()


jim-on-linux

http://www.inqvista.com









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


Re: Defaultdict and speed

2006-11-04 Thread Klaas
[EMAIL PROTECTED] wrote:
> Klaas wrote:
> > Benchmarks?
>
> There is one (fixed in a succesive post) in the original thread I was
> referring to:
> http://groups.google.com/group/it.comp.lang.python/browse_thread/thread/aff60c644969f9b/
> If you want I can give more of them (and a bit less silly, with strings
> too, etc).
<>

Sorry, I didn't see any numbers.  I ran it myself and found the
defaultdict version to be approximately twice as slow.  This, as you
suggest, is the worst case, as you are using integers as hash keys
(essentially no hashing cost) and are accessing each key exactly once.

>
> > (and slowing down other uses of the class)
>
> All it has to do is to cheek if the default_factory is an int, it's
> just an "if" done only once, so I don't think it slows down the other
> cases significantly.

Once it makes that check, surely it must check a flag or some such
every time it is about to invoke the key constructor function?

> > especially when the faster alternative is so easy to code.
>
> The faster alternative is easy to create, but the best faster
> alternative can't be coded, because if you code it in Python you need
> two hash accesses, while the defaultdict can require only one of them:
>
> if n in d:
> d[n] += 1
> else:
> d[n] = 1

How do you think that defaultdict is implemented?  It must perform the
dictionary access to determine that the value is missing.  It must then
go through the method dispatch machinery to look for the __missing__
method, and execute it.  If you _really_ want to make this fast, you
should write a custom distionary subclass which accepts an object (not
function) as default value, and assigns it directly.

> >If that performance difference matters,
>
> With Python it's usually difficult to tell if some performance
> difference matters. Probably in some programs it may matter, but in
> most other programs it doesn't matter. This is probably true for all
> the performance tweaks I may invent in the future too.

In general, I agree, but in this case it is quite clear.  The only
possible speed up is for defaultdict(int).  The re-write using regular
dicts is trivial, hence, for given piece of code is it quite clear
whether the performance gain is important.  This is not an
interpreter-wide change, after all.

Consider also that the performance gains would be relatively
unsubstantial when more complicated keys and a more realistic data
distribution is used.  Consider further that the __missing__ machinery
would still be called.  Would the resulting construct be faster than
the use of a vanilla dict?  I doubt it.

But you can prove me wrong by implementing it and benchmarking it.

> > you would likely find more fruitful
> > gains in coding it in c, using PyDict_SET
>
> I've just started creating a C lib for related purposes, I'd like to
> show it to you all on c.l.p, but first I have to find a place to put it
> on :-) (It's not easy to find a suitable place, it's a python + c +
> pyd, and it's mostly an exercise).

Would suggesting a webpage be too trite?

-Mike

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


Re: Trouble compiling win32all on Windows

2006-11-04 Thread Ross Ridge
robert wrote:
> I've trouble compiling win32all. VC98 and latest SDK installed
> (otherwise with original SDK it won't even compile).
> It tells that uuid.lib(cguid_i.obj) : fatal error LNK1103: debug info
> is destroyed.

The library isn't compatable with the compiler you're using.  You'll
need to use an older version of the Platform SDK that supports your
compiler.

 Ross Ridge

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


Re: WSDL?

2006-11-04 Thread [EMAIL PROTECTED]
CORBA may work fine in an intranet environment, where you can control
the server and the client, but it clearly failed to be a popular choice
on the internet: have you seen any company offering webservices with a
CORBA interface??
The main 2 choices that companies offering webservices seem to have are
REST (Yahoo, Amazon, Google) and SOAP (Amazon, Google).

And no, SOAP is not a Microsoft thing anymore: it's a standard
supported by a lot of large companies (and neither Amazon nor Google
are Microsoft shops, as far as I know).
The reason SOAP moved away from the pure RPC model is because it needed
to support the more modern and flexible distributed computing paradigm
which is "message based", not "RPC based".

But yeah, I fully agree that SOAP is very complicated, and the support
for it is pretty poor.

Sorin

Steve Holden wrote:
> Jorge Vargas wrote:
> > On 11/4/06, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> >
> >>In <[EMAIL PROTECTED]>, Jorge Vargas
> >>wrote:
> >>
> >>
> >>>and please please don't go to corba we need to kill that.
> >>
> >>Have you real reasons or is this a religious thing?  As I see it Corba is
> >>much better supported by Python libs than SOAP is.
> >>
> >
> > I see ZSI as a very good engine for SOAP as for xmlrpc it's "better"
> > since you can interact with a browser and then you can even have json
> > rpc.
> >
> > but yes ur right is mostly because of religious reasons :)
> >
> When SOAP can do everything that Corba can do, and as efficiently, it
> might stand a chance of displacing it. I see SOAP as essentially an ugly
> bloated NIH response of the Microsoft camp to an open specification that
> achieved all its goals in an elegant way. And all to allow inappropriate
> remote-method execution through port 80 to avoid the corporate firewall.
> Which ultimately just made firewalling port 80 that much more difficult.
>
> Microsoft is a poor church, and very uncaring of its adherents. So take
> your religious reasons and leave Corba alone until SOAP is an effective
> competitor ;-)
>
> regards
>   Steve
> --
> Steve Holden   +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd  http://www.holdenweb.com
> Skype: holdenweb   http://holdenweb.blogspot.com
> Recent Ramblings http://del.icio.us/steve.holden

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


Re: wing ide vs. komodo?

2006-11-04 Thread gblais
I have both, but the IDE I use every day is SPE, which is shareware.  I'm
not savvy enough to enumerate a feature comparison, but I do find SPE
extremely friendly and intuitive.

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


Re: wing ide vs. komodo?

2006-11-04 Thread vj
I've tried both and find WingIDE much faster than Komodo and the layout
is very well thought out. I love the way you can collapse all the
differnet panes with a few keystrokes. I also like their autocomplete
functionality.

Wing is developed by a small company, focussed on python development,
while komodo supports all the major scripting languages. 

VJ

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


Re: wing ide vs. komodo?

2006-11-04 Thread Fuzzyman

vj wrote:
> I've tried both and find WingIDE much faster than Komodo and the layout
> is very well thought out. I love the way you can collapse all the
> differnet panes with a few keystrokes. I also like their autocomplete
> functionality.
>

+1

I use Wing and enjoy its auto-completion.

Fuzzyman
http://www.voidspace.org.uk

> Wing is developed by a small company, focussed on python development,
> while komodo supports all the major scripting languages. 
> 
> VJ

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


Re: program written to model population evolving over time

2006-11-04 Thread Steven D'Aprano
On Sat, 04 Nov 2006 13:09:10 -0800, sam wrote:

> i've just finished a program which sets up an initial population
> consisting of four different phenotypes, allows them to evolve over
> time and graphs the output at the end, displaying what is in effect the
> evolutionary steady state for the system.
[snip]
> excuse my ignorance, but is there a site where people post this kind of
> stuff? i figured someone might be interested in playing with it,
> tweaking it a bit, changing the parameters. i've only been programming a
> couple of months, so i'm sure more experienced programmers could whack
> into shape if they were interested. or not...

Something like this would probably go very well on Useless Python, or the
Cheeseshop:

http://www.uselesspython.com/
http://cheeseshop.python.org/pypi



-- 
Steven.

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


Re: WebScraping

2006-11-04 Thread Steven D'Aprano
On Sun, 05 Nov 2006 08:09:52 +1000, Graham Feeley wrote:

> Can someone steer me to scripts / modules etc on webscraping please???

The definitive documentation on the built-in Python modules can be found
here: http://docs.python.org/modindex.html

The ActiveState Python cookbook should be useful, e.g.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/391929

Also see Beautiful Soup:
http://www.crummy.com/software/BeautifulSoup/

And of course, GIYF ("Google Is Your Friend") http://www.google.com which
leads me to:

http://sig.levillage.org/?p=588
http://sig.levillage.org/2005/03/11/web-scraping-with-python-part-ii/
http://wiki.tcl.tk/2915 (not focused on Python, but may still be useful).


> Ultimately I would like someone to write a script for me.

Are you offering to hire a developer?


-- 
Steven.

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


Pyro stability

2006-11-04 Thread writeson
Hi all,

At work I'm considering proposing a solution for our distributed
processing system (a web based shopping cart that feeds an actual
printing production line) based on Pyro. I've done some minor
experiments with this and Pyro looks interesting and like a good
implementation of what I want. I've got a couple of questions though:

1)  Has anyone had any experience with Pyro, and if so, have you had
any stability, or memory use issues running Pyro servers or nameservers
on the various participating computers? (We have a mixed environment of
Linux and Windows, but will be heading to an all Linux (RedHat)
environment soon.

2)  One of the guys I work with is more inclined to set up XMLRPC
communication between the processes, and he is also leery of running
daemon processes. His solution is to have essentially Python CGI code
that responds to the various XMLRPC requests. Does anyone have any
opinions on this? I know what mine are already. :)

3)  I've considered using CORBA, which is more powerful, and certainly
faster, but it's complexity to set up compared to the rather simple
work I'm trying to do seems prohibative. Does anyone have any thoughts
on this?

Thanks in advance,
Doug

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


Re: To remove some lines from a file

2006-11-04 Thread John Savage
Sebastian Busch <[EMAIL PROTECTED]> writes:
>The task is:
>
>"Remove the first two lines that don't begin with "@" from a file."
>
>How would you do it with sed?

Why a sed solution in a python group?

sed '/^@/!{G;/\n\n\n/{P;d;};s/[^\n]*//;h;d;}' data
-- 
John Savage   (my news address is not valid for email)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-04 Thread Martin v. Löwis
Paul Rubin schrieb:
> "Martin v. Löwis" <[EMAIL PROTECTED]> writes:
>>> PS: Besides: what are speed costs of LOCK INC  ?
>> That very much depends on the implementation. In
>> http://gcc.gnu.org/ml/java/2001-03/msg00132.html
>> Hans Boehm claims it's 15 cycles. 
> 
> I think that has to be on a single processor, or at most a dual core
> processor with shared cache on die.  With multiple cpu chips I don't
> think can get the signals around that fast.

Can you explain what you mean? The lock# signal takes *immediate*
effect, within the CPU cycle in which it is asserted. There is no
delay whatsoever (except for speed-of-light issues, of course).

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WebScraping

2006-11-04 Thread Michael Torrie
On Sun, 2006-11-05 at 13:40 +1100, Steven D'Aprano wrote:
> On Sun, 05 Nov 2006 08:09:52 +1000, Graham Feeley wrote:
> 
> > Can someone steer me to scripts / modules etc on webscraping please???
> 
> The definitive documentation on the built-in Python modules can be found
> here: http://docs.python.org/modindex.html
> 
> The ActiveState Python cookbook should be useful, e.g.
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/391929
> 
> Also see Beautiful Soup:
> http://www.crummy.com/software/BeautifulSoup/

Beautiful soup is not always speedy, but it sure is the most flexible
scraper I've ever came across.  I hacked together a web forum-to-nntp
gateway using Beautiful Soup.  Worked very well.

Michael


> 
> And of course, GIYF ("Google Is Your Friend") http://www.google.com which
> leads me to:
> 
> http://sig.levillage.org/?p=588
> http://sig.levillage.org/2005/03/11/web-scraping-with-python-part-ii/
> http://wiki.tcl.tk/2915 (not focused on Python, but may still be useful).
> 
> 
> > Ultimately I would like someone to write a script for me.
> 
> Are you offering to hire a developer?
> 
> 
> -- 
> Steven.
> 

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


Re: python GUIs comparison (want)

2006-11-04 Thread timmy
Mudcat wrote:
> I have been using Tkinter for several years now. Recently I have been
> thinking about switching to something else that may have a sharper
> appearance. However I'm not sure what that may be, and if that
> something else is *that* much better than what I'm already using.
> 
> Does everyone agree that wxPython looks best on Windows? I've also read
> in a couple of places where Dabo looks pretty good as well.
> 
> So if someone were to pick a UI that gave the best appearance, what
> would they choose?
> 
> 
i've been using wxpython for a few years and it's great.
it's got far better widgets then tkinter and it's speed is greater on 
large stuff as well.
it's got a great support forum and the maintainer robin dunn does a 
great job of answering all questions.
i can't particularly fault wxpython. it looks great on all platforms and 
maintain the native look and feel of the platofrm as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python GUIs comparison (want)

2006-11-04 Thread Mudcat
When you say far better widgets, do you mean that it has a greater
number of widgets to choose from, or that the types of widgets are
basically the same but have a greater amount of flexibility in them?

Personally I find programming in Tkinter fairly simple and
straight-forward. I'm sure a lot of that is due to the fact I've been
using it for a while and have many templates already available when I
start to work on something new. But I don't find myself questioning it
very much for unnecessary typing like I do other things.

As far as appearance goes, I've scoured the net looking for examples of
widgets produced wxPython or other UIs, and I really don't see that
much difference than Tkinter. Now I haven't done a whole lot of
programming on XP, but as far as W2000 is concerned they all look very
similar.

What would be really cool is if someone were to come up with a UI that
has a totally new look and feel than anything that currently exists on
Windows. It seems like most of the native look and feel, even in XP,
are rather boxy and stale. I don't like Macs, but they do have cool
looking windows and frames.

Now I hardly know anything at all about low-level windows calls and
what is/is not possible. But I know that many applications draw their
own windows, skins, and functionality widgets to provide a sharper
appearance. It seems like it would be possible for someone to draw
these widgets and provide an api to display them through Python.


timmy wrote:
> Mudcat wrote:
> > I have been using Tkinter for several years now. Recently I have been
> > thinking about switching to something else that may have a sharper
> > appearance. However I'm not sure what that may be, and if that
> > something else is *that* much better than what I'm already using.
> >
> > Does everyone agree that wxPython looks best on Windows? I've also read
> > in a couple of places where Dabo looks pretty good as well.
> >
> > So if someone were to pick a UI that gave the best appearance, what
> > would they choose?
> >
> >
> i've been using wxpython for a few years and it's great.
> it's got far better widgets then tkinter and it's speed is greater on
> large stuff as well.
> it's got a great support forum and the maintainer robin dunn does a
> great job of answering all questions.
> i can't particularly fault wxpython. it looks great on all platforms and
> maintain the native look and feel of the platofrm as well.

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


Re: wing ide vs. komodo?

2006-11-04 Thread vj
Forgot to mention WING's file search and replace is pretty cool and
powerful. It keeps checking changes in a different thread. If you want
to change yyy in say 100 files you would:

1. specify yyy in the search window
2. A list of files get displayed with matching yyy
3. As you fix replace yyy in the files the list of files with matching
yyy reduces automatically. This is very cool and very useful.

Another thing I like about WING is that it warns you if you have tabs
ans spaces mixed in a file.

The embedded python shell is also a useful feature.

VJ

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


Re: python GUIs comparison (want)

2006-11-04 Thread Paul Rubin
"Mudcat" <[EMAIL PROTECTED]> writes:
> When you say far better widgets, do you mean that it has a greater
> number of widgets to choose from, or that the types of widgets are
> basically the same but have a greater amount of flexibility in them?

There's a lot more and they look a lot better.  Tk widgets are quite
stylized and independently of that they look like crap.

> Personally I find programming in Tkinter fairly simple and
> straight-forward. 

Tkinter programming is not too bad once you get used to it, if you
don't mind the limited widget set and weird restrictions, that is
true.  Plus, it's included in the Python distro, which is the main
reason I keep using it.  That's worked ok for me because the apps I've
written with it just needed basic GUI functionality and were not too
demanding of stylistic fine points.  But Tkinter seriously dated by
now, and I don't think its widgets are anywhere near slick enough for
wide-distribution desktop apps that have to look polished.

> What would be really cool is if someone were to come up with a UI
> that has a totally new look and feel than anything that currently
> exists on Windows.

No that would suck.  Best to try to stay as close as possible to the
native widgets on whatever the underlying platform is.  If you want
to depart from the native UI, then start from scratch and write a whole
new window system with a complete app suite etc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WebScraping

2006-11-04 Thread ina
This might be of help to you.
http://phlik.ishpeck.net/index.php?P=a1141076600phlik

http://phlik.ishpeck.net/index.php?P=b1134168973phlik

Graham Feeley wrote:
> Can someone steer me to scripts / modules etc on webscraping please???
> Ultimately I would like someone to write a script for me.
> However i am still searching for documentation on this subject
> Thanks Graham

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