ANN: BList v 0.9.3, a list-like type with better asymptotic performance

2007-04-27 Thread Daniel Stutzbach
We're pleased to announce the first public release of BList (v 0.9.3),
a list-like type with better asymptotic performance.

The BList extension module is available via PyPi:
http://www.python.org/pypi/blist

The BList is a type that looks, acts, and quacks like a Python list(),
but has better performance for many (but not all) use cases.  Below
are some of the unique features of the BList:

- just as fast as a Python list() when the list is small
- insertion or removal from the list takes O(log n) time
- getslice runs in O(log n) time and uses O(log n) memory, regardless
  of slice size
- making a shallow copy runs in O(1) time and uses O(1) memory
- setslice runs in O(log n + log k) time if the inserted slice is a
  BList of length k
- multipling a BList by k takes O(log k) time and O(log k) memory

Example:

 from blist import *
 x = blist([0])
 x *= 2**29
 x.append(5)
 y = x[4:-234234]
 del x[3:1024]

None of the above operations have a noticeable delay, even though the
lists have over 500 million elements due to line 3.  The BList has two
key features that allow it to pull this off this performance:

1. Internally, a B+Tree is a wide, squat tree.  Each node has a
   maximum of 128 children.  If the entire list contains 128 or fewer
   objects, then there is only one node, which simply contains an
   array of the objects.  In other words, for short lists, a BList
   works just like Python's array-based list() type.  Thus, it has the
   same good performance on small lists.

2. The BList type features transparent copy-on-write.  If a non-root
   node needs to be copied (as part of a getslice, copy, setslice,
   etc.), the node is shared between multiple parents instead of being
   copied.  If it needs to be modified later, it will be copied at
   that time.  This is completely behind-the-scenes; from the user's
   point of view, the BList works just like a regular Python list.

So you can see the performance of the BList in more detail, several
performance graphs available at the following link:
http://stutzbachenterprises.com/blist/

Feedback


We're eager to hear about your experiences with the BList.  Please
send all feedback and bug reports to [EMAIL PROTECTED]

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

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


bbfreeze 0.92.0

2007-04-27 Thread Ralf Schmitt

Hi all,

I've just uploaded bbfreeze 0.92.0 to python's cheeseshop.
bbfreeze creates standalone executables from python scripts. It's similar
in functionality to py2exe or cx_Freeze.

It offers the following features:

easy installation
 bbfreeze can be installed with setuptools' easy_install command.

binary dependency tracking
 bbfreeze will track binary dependencies and will include DLLs and
 shared libraries needed by a frozen program.

multiple script freezing
 bbfreeze can freeze multiple scripts at once.

python interpreter included
 bbfreeze will create an extra executable named 'py', which might be
 used like the python executable itself.

bbfreeze works on windows and UNIX-like operating systems. It
currently does not work on OS X. bbfreeze has been tested with python
2.4 and 2.5. bbfreeze will not work with python versions prior to 2.3
as it uses the zipimport feature introduced with python 2.3.


Links


cheese shop entry:
http://cheeseshop.python.org/pypi/bbfreeze/

homepage:
http://systemexit.de/bbfreeze/

mercurial repository:
http://systemexit.de/repo/bbfreeze

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

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


ANN: Webware 0.9.3 released

2007-04-27 Thread Christoph Zwerschke
Webware 0.9.3 has been released.

This release of Webware for Python includes a couple of fixes and
improvements of WebKit and some cleanup of the overall Webware codebase.
Please have a look at the WebKit release notes for details.

Webware for Python is a suite of Python packages and tools for
developing object-oriented, web-based applications. The suite uses
well known design patterns and includes a fast Application Server,
Servlets, Python Server Pages (PSP), Object-Relational Mapping,
Task Scheduling, Session Management, and many other features.
Webware is very modular and easily extended.

Webware for Python is well proven and platform-independent.
It is compatible with multiple web servers, database servers
and operating systems.

Check out the Webware for Python home page at http://www.w4py.org
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


pyqt4 signal/slot using PyObject* and shortcut

2007-04-27 Thread Pradnyesh Sawant
Hello, i have the following code:
#
import time
import sys
from PyQt4 import QtGui, QtCore

class Counter(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
def run(self):
cntr = 0
while cntr  10:
cntr += 1
self.emit(QtCore.SIGNAL(showCntr1(PyObject*)), (cntr,
a))   # line 1
self.emit(QtCore.SIGNAL(showCntr2), (cntr, a))
  # line 2
time.sleep(0.2)
class Gui(QtGui.QDialog):
def __init__(self, parent = None):
QtGui.QDialog.__init__(self, parent)
frameStyle = QtGui.QFrame.Sunken | QtGui.QFrame.Panel

self.lCntr = QtGui.QLabel()
self.lCntr.setFrameStyle(frameStyle)
loGrd = QtGui.QGridLayout()
loGrd.addWidget(self.lCntr, 0, 0)
self.setLayout(loGrd)
self.setWindowTitle(self.tr(Counter))
def showCntr1(self, val):
print val, str(val)
self.lCntr.setText(str(val))
def showCntr2(self, val):
print val, str(val)
self.lCntr.setText(str(val))
if __name__ == __main__:
app = QtGui.QApplication(sys.argv)
dialog = Gui()
cntr = Counter()
cntr.start()
QtCore.QObject.connect(cntr, QtCore.SIGNAL(showCntr1(PyObject*)),
dialog.showCntr1, QtCore.Qt.QueuedConnection)
QtCore.QObject.connect(cntr, QtCore.SIGNAL(showCntr2),
dialog.showCntr1, QtCore.Qt.QueuedConnection)
sys.exit(dialog.exec_())
#
If i comment out line 1, then i get the following output:
0.2 0.2
0.2 0.2
0.2 0.2
0.2 0.2
0.2 0.2
0.2 0.2
0.2 0.2
0.2 0.2
0.2 0.2
0.2 0.2
Notice that 0.2 is the time value of the sleep instruction. Why is
this happening?

On the other hand, if i comment out line 2, then i get the following output:
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
(refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
What i get from the above is that a reference to cntr is being
passed, but by the time the gui thread is actually run, both the
values (cntr and a) have been destroyed, hence the NULL values.
***How do i circumvent this problem?***

Lastly, if i don't comment out any of line 1 or 2, then i get the foll output:
(__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
(__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
(__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
(__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, ..
i don't know what this means??? Can anyone kindly explain what's happening...

I'm using:
python: 2.4.4~c1-0ubuntu1
qt4-dev-tools: not installed
python-qt4: 4.0.1-1ubuntu1
sip4: (4.4.5-2ubuntu1
os: ubuntu edgy
-- 
warm regards,
Pradnyesh Sawant
--
Be yourself, everyone else is taken. --Anon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: webbrowser.open works in IDLE and cmd shell but not from cygwin prompt

2007-04-27 Thread Paddy
On Apr 27, 5:09 am, Gregory Bloom [EMAIL PROTECTED] wrote:
 I'm running Python 2.5 under Windows.  If I fire up IDLE and enter:

  import webbrowser
  url = 'http://www.python.org'
  webbrowser.open_new(url)

 it works like a champ, opening the page in Firefox.  Same thing goes
 from a Windows cmd shell: it works as advertised.

 But if I open a cygwin bash shell and try the same thing from a python
 prompt, I get:

  import webbrowser
  url = 'http://www.python.org'
  webbrowser.open_new(url)

 Traceback (most recent call last):
   File stdin, line 1, in module
   File C:\Python25\lib\webbrowser.py, line 60, in open_new
 return open(url, 1)
   File C:\Python25\lib\webbrowser.py, line 55, in open
 if browser.open(url, new, autoraise):
   File C:\Python25\lib\webbrowser.py, line 185, in open
 p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
   File C:\Python25\lib\subprocess.py, line 551, in __init__
 raise ValueError(close_fds is not supported on Windows 
 ValueError: close_fds is not supported on Windows platforms

 What's up with that?  And, more to the point, how can I use webbrowser
 from scripts launched under cygwin?

I have X and kde for cygwin installed.
If i use startxwin to start an xterm, without starting kde, and do
the
above in cygwins python version 2.4.3 i have to wait around 3 minutes
then up pops konqueror at the requested page.

- Paddy.

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


Re: pyqt4 signal/slot using PyObject* and shortcut

2007-04-27 Thread Pradnyesh Sawant
On 4/27/07, Pradnyesh Sawant wrote:
 Hello, i have the following code:
 #
 import time
 import sys
 from PyQt4 import QtGui, QtCore

 class Counter(QtCore.QThread):
 def __init__(self):
 QtCore.QThread.__init__(self)
 def run(self):
 cntr = 0
 while cntr  10:
 cntr += 1
 self.emit(QtCore.SIGNAL(showCntr1(PyObject*)), (cntr,
 a))   # line 1
 self.emit(QtCore.SIGNAL(showCntr2), (cntr, a))
   # line 2
 time.sleep(0.2)
 class Gui(QtGui.QDialog):
 def __init__(self, parent = None):
 QtGui.QDialog.__init__(self, parent)
 frameStyle = QtGui.QFrame.Sunken | QtGui.QFrame.Panel

 self.lCntr = QtGui.QLabel()
 self.lCntr.setFrameStyle(frameStyle)
 loGrd = QtGui.QGridLayout()
 loGrd.addWidget(self.lCntr, 0, 0)
 self.setLayout(loGrd)
 self.setWindowTitle(self.tr(Counter))
 def showCntr1(self, val):
 print val, str(val)
 self.lCntr.setText(str(val))
 def showCntr2(self, val):
 print val, str(val)
 self.lCntr.setText(str(val))
 if __name__ == __main__:
 app = QtGui.QApplication(sys.argv)
 dialog = Gui()
 cntr = Counter()
 cntr.start()
 QtCore.QObject.connect(cntr, QtCore.SIGNAL(showCntr1(PyObject*)),
 dialog.showCntr1, QtCore.Qt.QueuedConnection)
 QtCore.QObject.connect(cntr, QtCore.SIGNAL(showCntr2),
 dialog.showCntr1, QtCore.Qt.QueuedConnection)
There's a small bug in the above line, it should be dialog.showCntr2,
and not dialog.showCntr1. However, even with this change, the output
shown below remains the same :(
 sys.exit(dialog.exec_())
 #
 If i comment out line 1, then i get the following output:
 0.2 0.2
 0.2 0.2
 0.2 0.2
 0.2 0.2
 0.2 0.2
 0.2 0.2
 0.2 0.2
 0.2 0.2
 0.2 0.2
 0.2 0.2
 Notice that 0.2 is the time value of the sleep instruction. Why is
 this happening?

 On the other hand, if i comment out line 2, then i get the following output:
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
 What i get from the above is that a reference to cntr is being
 passed, but by the time the gui thread is actually run, both the
 values (cntr and a) have been destroyed, hence the NULL values.
 ***How do i circumvent this problem?***

 Lastly, if i don't comment out any of line 1 or 2, then i get the foll output:
 (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
 object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
 (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
 object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
 (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
 object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
 (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, ..
 i don't know what this means??? Can anyone kindly explain what's happening...

 I'm using:
 python: 2.4.4~c1-0ubuntu1
 qt4-dev-tools: not installed
 python-qt4: 4.0.1-1ubuntu1
 sip4: (4.4.5-2ubuntu1
 os: ubuntu edgy
 --
 warm regards,
 Pradnyesh Sawant
 --
 Be yourself, everyone else is taken. --Anon



-- 
warm regards,
Pradnyesh Sawant
--
Be yourself, everyone else is taken. --Anon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EuroPython vs PyconUK

2007-04-27 Thread EuGeNe Van den Bulke
Alex Martelli wrote:
 I like the kudos, thanks!, but I'm not quite sure what you're saying
 about my travel plans... just to clarify, once again I'll have to miss
 EuroPython _and_ PythonUK, two events I attended most assiduously when I
 was living in Europe (but then, for two years running I've also missed
 PyCon, _despite_ living in the US, sigh).

I was just using your possible travel plans as an example to express my 
concerns :P

Re your effective travel plans, thanks God for Google Video then :D

Cheers,

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Socket exceptions aren't in the standard exception hierarchy (M2Crypto issue)

2007-04-27 Thread John Nagle
On a related note, M2Crypto's exceptions are direct children
of Exception.  If we add NetworkError, there will be a better
place to put them.

Currently, you have to catch, at least,

M2Crypto.SSL.Checker.SSLVerificationError
M2Crypto.SSL.SSLError

both of which can be raised by socket operations if
M2Crypto is installed.   I'm not sure what errors the
stock SSL module raises.

(I'm running stress tests on a dedicated machine in a colocation
facility.  It's examining 11,000 known spam and malware sites right
now.  This exercises the error handling, forcing many unusual cases
and logging the problems.  That's why I'm discovering all these library
issues.)

John Nagle

Steve Holden wrote:
 John Nagle wrote:
 
 Steve Holden wrote:

 John Nagle wrote:

 Steve Holden wrote:

 John Nagle wrote:
 [socket.error bug report]


 All these notes should be included in the bug report, as I suspect 
 the module would benefit from additional clarity. 


  Done.  See

 [ 1706815 ] socket.error exceptions not subclass of StandardError

 Also see

 [ 805194 ] Inappropriate error received using socket timeout
 [ 1019808 ] wrong socket error returned
 [ 1571878 ] Improvements to socket module exceptions
 [ 708927 ] socket timeouts produce wrong errors in win32

 for related but not identical problems in that area.

 Thanks. At least this is less likely to be overlooked now.
 
 regards
  Steve
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EuroPython vs PyconUK

2007-04-27 Thread EuGeNe Van den Bulke
Michele Simionato wrote:
   I don't see the problem. In my view EuroPython is the big event in
 Europe. If you can
 go to only one conference and you have the possibility to travel to
 Vilnius, then go to EuroPython.
 The national conferences are of interest primarily for people of that
 national (of course, not
 exclusively).

Thanks, I didn't see it that way but that was ignorance on my behalf. I 
was WRONGLY under the impression that we were in front of a classical 
European pattern named what WE can do collectively I can do better 
alone - known use : European constitution :P (but I am digressing :D).

 BTW, this year I will go both to PyCon It and EuroPython, last year I
 went both to
 PyUK and EuroPython. The more, the better ;)

The more the merrier indeed in that respect! I learnt a lot from your 
Using decorators talk last year. Thanks.

EuGeNe -- http://www.3kwa.com
-- 
http://mail.python.org/mailman/listinfo/python-list


regex question

2007-04-27 Thread proctor
hello,

i have a regex:  rx_test = re.compile('/x([^x])*x/')

which is part of this test program:



import re

rx_test = re.compile('/x([^x])*x/')

s = '/xabcx/'

if rx_test.findall(s):
print rx_test.findall(s)



i expect the output to be ['abc'] however it gives me only the last
single character in the group: ['c']

C:\testpython retest.py
['c']

can anyone point out why this is occurring?  i can capture the entire
group by doing this:

rx_test = re.compile('/x([^x]+)*x/')
but why isn't the 'star' grabbing the whole group?  and why isn't each
letter 'a', 'b', and 'c' present, either individually, or as a group
(group is expected)?

any clarification is appreciated!

sincerely,
proctor

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


Re: My python annoyances so far

2007-04-27 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Steven Howe
wrote:

 And before someone get's all technical, I know everything in Python is 
 an 'object' even None, which implies class, or is it the other way around?

Objects don't imply classes.  There are object oriented languages without
classes like the Io language.  Everything there is an object and the base
object has a `clone()` method to make a copy.  So you make copies of
objects and modify them to tweak them into the way you want them.

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


Re: passing tuple with pyqt4 signal/slot mechanism

2007-04-27 Thread Phil Thompson
On Friday 27 April 2007 1:20 am, Pradnyesh Sawant wrote:
  In the first version it didn't. In the second version it did.

 in my case, it didn't in the second version either???

  The version of PyQt? The version of SIP? The version of Qt?

 python2.4:  2.4.4~c1-0ubuntu1
 pyqt4:  4.0.1-1ubuntu1
 python-sip4:   4.4.5-2ubuntu1
 qt4:  couldn't see just qt4 in aptitude ???
 (have qt4-qtconfig installed though).
 qt4-dev-tools not installed (is that needed?)

Then upgrade to a current version of PyQt.

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


video lectures on C, C++, Java, Python and other programming and Computer science.

2007-04-27 Thread AK444
Hi Friends,
Check here http://freevideolectures.com/computerscience.html  for
video lectures on Programming languages like C, C++, Java, COBOL
etc.., OS, Algorithms, Data Structures, RDBMS,
Web designing, etc..

It also has amazing collection of video lectures and animations on all
Engineering and Medical Sciences. I am sure you will be surprised to
see such great collection.

Do you like it???

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


Re: pyqt4 signal/slot using PyObject* and shortcut

2007-04-27 Thread Phil Thompson
On Friday 27 April 2007 7:05 am, Pradnyesh Sawant wrote:
 On 4/27/07, Pradnyesh Sawant wrote:
  Hello, i have the following code:
  #
  import time
  import sys
  from PyQt4 import QtGui, QtCore
 
  class Counter(QtCore.QThread):
  def __init__(self):
  QtCore.QThread.__init__(self)
  def run(self):
  cntr = 0
  while cntr  10:
  cntr += 1
  self.emit(QtCore.SIGNAL(showCntr1(PyObject*)), (cntr,
  a))   # line 1
  self.emit(QtCore.SIGNAL(showCntr2), (cntr, a))
# line 2
  time.sleep(0.2)
  class Gui(QtGui.QDialog):
  def __init__(self, parent = None):
  QtGui.QDialog.__init__(self, parent)
  frameStyle = QtGui.QFrame.Sunken | QtGui.QFrame.Panel
 
  self.lCntr = QtGui.QLabel()
  self.lCntr.setFrameStyle(frameStyle)
  loGrd = QtGui.QGridLayout()
  loGrd.addWidget(self.lCntr, 0, 0)
  self.setLayout(loGrd)
  self.setWindowTitle(self.tr(Counter))
  def showCntr1(self, val):
  print val, str(val)
  self.lCntr.setText(str(val))
  def showCntr2(self, val):
  print val, str(val)
  self.lCntr.setText(str(val))
  if __name__ == __main__:
  app = QtGui.QApplication(sys.argv)
  dialog = Gui()
  cntr = Counter()
  cntr.start()
  QtCore.QObject.connect(cntr, QtCore.SIGNAL(showCntr1(PyObject*)),
  dialog.showCntr1, QtCore.Qt.QueuedConnection)
  QtCore.QObject.connect(cntr, QtCore.SIGNAL(showCntr2),
  dialog.showCntr1, QtCore.Qt.QueuedConnection)

 There's a small bug in the above line, it should be dialog.showCntr2,
 and not dialog.showCntr1. However, even with this change, the output
 shown below remains the same :(

  sys.exit(dialog.exec_())
  #
  If i comment out line 1, then i get the following output:
  0.2 0.2
  0.2 0.2
  0.2 0.2
  0.2 0.2
  0.2 0.2
  0.2 0.2
  0.2 0.2
  0.2 0.2
  0.2 0.2
  0.2 0.2
  Notice that 0.2 is the time value of the sleep instruction. Why is
  this happening?
 
  On the other hand, if i comment out line 2, then i get the following
  output: (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  (refcnt 0 at 0xb7dcd28c, 'a') (NULL, NULL)
  What i get from the above is that a reference to cntr is being
  passed, but by the time the gui thread is actually run, both the
  values (cntr and a) have been destroyed, hence the NULL values.
  ***How do i circumvent this problem?***
 
  Lastly, if i don't comment out any of line 1 or 2, then i get the foll
  output: (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
  0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
  object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
  (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
  0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
  object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
  (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
  0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, (__main__.Gui
  object at 0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c,
  (__main__.Gui object at 0xb6a8f12c, (__main__.Gui object at
  0xb6a8f12c, (__main__.Gui object at 0xb6a8f12c, ..
  i don't know what this means??? Can anyone kindly explain what's
  happening...
 
  I'm using:
  python: 2.4.4~c1-0ubuntu1
  qt4-dev-tools: not installed
  python-qt4: 4.0.1-1ubuntu1
  sip4: (4.4.5-2ubuntu1
  os: ubuntu edgy

As I said in the other thread, upgrade to a current release of PyQt. 
Also PyObject* should no longer be used in signal signatures - 
use PyQt_PyObject instead.

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


RE:: Re-ocurring Events

2007-04-27 Thread Robert Rawlins - Think Blue
Thank you guys for your suggestions.

I've been having a look at that launchd stuff from apple but couldn’t really
see how that applies to my requirements.

I've been putting some serious thought into how this should work as its
essentially the final part of the puzzle for my application, I'll have a
fully working model for my application.

I've been thinking about the possibility of using a combination of xpath to
search the XML with some loops which change the date. As events won't ever
be set to start before 01-01-2007 I can set that as the ceiling for my loop.
So when I'm searching for weekly events, I 'simply' take today's date and
time and loop from now until 01-01-2007 decrementing the date by a week each
iteration of the loop and then search the XML for events in that date, make
sense?

I know that's a fairly intensive way of doing it, but if it works it works.

Now, the loop is where I'm really struggling, I've not done any looping with
dates, can anyone give me a hand with this? How can I loop back in time from
now to beginning of 07 a week at a time? Do we have some form of dateAdd() I
can use with a while loop? Perhaps.

Date = (now)
While date  2007-01-01:
Date = dateAdd(date, -1, w)

Something to that effect? Then I can quickly xpath for every iteration of
the loop.

Thanks guys for any help.

Rob

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Laurent Pointal
Sent: 26 April 2007 15:33
To: python-list@python.org
Subject: Re: Re-ocurring Events

Daniel Nogradi a écrit :
 A bit more of a complex one this time, and I thought I'd get your 
 opinions
 on the best way to achieve this. Basically I'm looking for a way to 
 describe
 a re-occurring event, like a calendar event or appointment I guess. I'm
 likely to use an XML file for the definition of the events, but 
 imagine I've
 got an event that looks something like this.

 event start=2007-01-01 12:00:00 end=2007-01-01 15:00:00 
 repeat=daily
 /

May take a look at launchd (Apple) XML dialect, it may have at least the 
semantic for your need.

For other parts... elementtree, yes.

 Now what I want to do is be able to build a class which has a function 
 like
 'getCurrentEvent()' which will return any events that should be 
 occurring at
 that time. So if the current system time and date is 2007-01-03 13:00:00
 then it will return THAT event to me, but if it was say 2007-01-03 
 16:00:00
 then it would not, as the event isn't 'due' to occur at that time. Make
 sense?

 What's the best way of handling this? I'm really a little lost as to 
 how I
 might get started, checking a static date time isn't a problem, it's 
 when it
 comes to these re-occurring events that I struggle a little. The idea is
 that I would have 5 core repetitions, none, daily, weekly, monthly and
 annually.
 
 This will not solve all your problems, but a very convenient way of
 handling XML is the element tree module (that comes with python 2.5):
 http://docs.python.org/lib/module-xml.etree.ElementTree.html
 
 HTH,
 Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list

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


Re: Feedback on Until recipe

2007-04-27 Thread Antoon Pardon
On 2007-04-26, MRAB [EMAIL PROTECTED] wrote:

 At http://mail.python.org/pipermail/python-dev/2006-February/060718.html
 Raymond Hettinger suggested removing the final colon after the 'while'
 if there's no statement after it, which I agree with, although I would
 prefer 'repeat' instead of 'do' (IMHO that doesn't suggest repetition
 clearly enough):

 repeat:
 statements
 while condition:
 statements

 and:

 repeat:
 statements
 while condition

I wouldn't object to this. But more important than how it will look like
IMO is that it gets implemented. Acoording to your URL there is little
chance that this will be implemented before Py3k. A pity.

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


Re: regex question

2007-04-27 Thread Josiah Carlson
proctor wrote:
 i have a regex:  rx_test = re.compile('/x([^x])*x/')

You probably want...

rx_test = re.compile('/x([^x]*)x/')


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


Re: regex question

2007-04-27 Thread Paul McGuire
On Apr 27, 1:33 am, proctor [EMAIL PROTECTED] wrote:
 hello,

 i have a regex:  rx_test = re.compile('/x([^x])*x/')

 which is part of this test program:

 

 import re

 rx_test = re.compile('/x([^x])*x/')

 s = '/xabcx/'

 if rx_test.findall(s):
 print rx_test.findall(s)

 

 i expect the output to be ['abc'] however it gives me only the last
 single character in the group: ['c']

 C:\testpython retest.py
 ['c']

 can anyone point out why this is occurring?  i can capture the entire
 group by doing this:

 rx_test = re.compile('/x([^x]+)*x/')
 but why isn't the 'star' grabbing the whole group?  and why isn't each
 letter 'a', 'b', and 'c' present, either individually, or as a group
 (group is expected)?

 any clarification is appreciated!

 sincerely,
 proctor

As Josiah already pointed out, the * needs to be inside the grouping
parens.

Since re's do lookahead/backtracking, you can also write:

rx_test = re.compile('/x(.*?)x/')

The '?' is there to make sure the .* repetition stops at the first
occurrence of x/.

-- Paul

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


List objects are un-hashable

2007-04-27 Thread Andy
Hi, I'm trying to search and print any no# of Python keywords present
in a text file (say - foo.txt), and getting the above error. Sad for
not being able to decipher such a simple problem (I can come up with
other ways - but want to fix this one FFS). Any help is appreciated.
Thanks!!

import keyword, re, sys, string
inp = open(foo.txt, r)
words,lines = 0, 0

for line in inp:
lines +=1
# a list of words
tempwords = line.split(None)
if keyword.iskeyword(tempwords):
print tempwords

inp.close()

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


RE: : Re-ocurring Events

2007-04-27 Thread Robert Rawlins - Think Blue
Just as another quick update, I've found this module for python that may be
able to help me, its designed to spot date patterns for things like
recurring events I guess,

http://www.biostat.wisc.edu/~annis/creations/period.py.html

Quite how I can integrate it into my project I'm not sure but if I can loop
through each of the events in my XML and see if they are meant to be
recurring today then that's fantastic.

If anyone has any rough ideas on how this might work for me I'd love to hear
some rough concepts.

Thanks,

Rob

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Robert Rawlins - Think Blue
Sent: 27 April 2007 08:24
To: python-list@python.org
Subject: RE:: Re-ocurring Events

Thank you guys for your suggestions.

I've been having a look at that launchd stuff from apple but couldn’t really
see how that applies to my requirements.

I've been putting some serious thought into how this should work as its
essentially the final part of the puzzle for my application, I'll have a
fully working model for my application.

I've been thinking about the possibility of using a combination of xpath to
search the XML with some loops which change the date. As events won't ever
be set to start before 01-01-2007 I can set that as the ceiling for my loop.
So when I'm searching for weekly events, I 'simply' take today's date and
time and loop from now until 01-01-2007 decrementing the date by a week each
iteration of the loop and then search the XML for events in that date, make
sense?

I know that's a fairly intensive way of doing it, but if it works it works.

Now, the loop is where I'm really struggling, I've not done any looping with
dates, can anyone give me a hand with this? How can I loop back in time from
now to beginning of 07 a week at a time? Do we have some form of dateAdd() I
can use with a while loop? Perhaps.

Date = (now)
While date  2007-01-01:
Date = dateAdd(date, -1, w)

Something to that effect? Then I can quickly xpath for every iteration of
the loop.

Thanks guys for any help.

Rob

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Laurent Pointal
Sent: 26 April 2007 15:33
To: python-list@python.org
Subject: Re: Re-ocurring Events

Daniel Nogradi a écrit :
 A bit more of a complex one this time, and I thought I'd get your 
 opinions
 on the best way to achieve this. Basically I'm looking for a way to 
 describe
 a re-occurring event, like a calendar event or appointment I guess. I'm
 likely to use an XML file for the definition of the events, but 
 imagine I've
 got an event that looks something like this.

 event start=2007-01-01 12:00:00 end=2007-01-01 15:00:00 
 repeat=daily
 /

May take a look at launchd (Apple) XML dialect, it may have at least the 
semantic for your need.

For other parts... elementtree, yes.

 Now what I want to do is be able to build a class which has a function 
 like
 'getCurrentEvent()' which will return any events that should be 
 occurring at
 that time. So if the current system time and date is 2007-01-03 13:00:00
 then it will return THAT event to me, but if it was say 2007-01-03 
 16:00:00
 then it would not, as the event isn't 'due' to occur at that time. Make
 sense?

 What's the best way of handling this? I'm really a little lost as to 
 how I
 might get started, checking a static date time isn't a problem, it's 
 when it
 comes to these re-occurring events that I struggle a little. The idea is
 that I would have 5 core repetitions, none, daily, weekly, monthly and
 annually.
 
 This will not solve all your problems, but a very convenient way of
 handling XML is the element tree module (that comes with python 2.5):
 http://docs.python.org/lib/module-xml.etree.ElementTree.html
 
 HTH,
 Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list

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

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


Re: List objects are un-hashable

2007-04-27 Thread Alexander Schmolck
Andy [EMAIL PROTECTED] writes:

 Hi, I'm trying to search and print any no# of Python keywords present
 in a text file (say - foo.txt), and getting the above error. Sad for
 not being able to decipher such a simple problem (I can come up with

Without looking at the docs, it seems save to assume keywords.iskeyword would
expect a string. You pass it a list.

 other ways - but want to fix this one FFS). Any help is appreciated.
 Thanks!!

 import keyword, re, sys, string
 inp = open(foo.txt, r)
  words = sum(1 for line in inp for w in line.split() if keyword.iskeyword(w))

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


Re: List objects are un-hashable

2007-04-27 Thread Ant
 for line in inp:
 lines +=1
 # a list of words
 tempwords = line.split(None)
 if keyword.iskeyword(tempwords):
 print tempwords

You are trying here to ask if a list of words (tempwords) is a
keyword. The error is due to the implementation of the iskeyword
function which converts the keyword list into a frozenset (in which
elements must be hashable) for, I presume, performance reasons:

 f_set = frozenset((1,2,3,4))
 [test] in f_set
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: list objects are unhashable

What you want is something like:

 for line in inp:
 lines +=1
 # a list of words
 tempwords = line.split()
 for k in tempwords:
 if keyword.iskeyword(k):
print tempwords

Which iterates over each word in your tempwords list in turn. Note
though the following:

 if(True):printHey!
...
Hey!
 s = 'if(True):printHey!'
 s.split()
['if(True):printHey!']

Which may be a problem for you if you are trying to parse badly spaced
python source files!

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


Re: List objects are un-hashable

2007-04-27 Thread Andy

 What you want is something like:

  for line in inp:
  lines +=1
  # a list of words
  tempwords = line.split()
  for k in tempwords:
  if keyword.iskeyword(k):
 print tempwords


I think it should be:

 if keyword.iskeyword(k):
  print k

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


Re: List objects are un-hashable

2007-04-27 Thread Ant
 I think it should be:

  if keyword.iskeyword(k):
   print k

Whoops - yes of course!

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


Re: List objects are un-hashable

2007-04-27 Thread Ganesan Rajagopal
 Andy == Andy  [EMAIL PROTECTED] writes:

 if keyword.iskeyword(tempwords):
 print tempwords

  for word in tempwords:
  if keyword.iskeyword(word):
  print word

Ganesan 


-- 
Ganesan Rajagopal

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


Re: List objects are un-hashable

2007-04-27 Thread Michael Hoffman
Andy wrote:
 Hi, I'm trying to search and print any no# of Python keywords present
 in a text file (say - foo.txt), and getting the above error. Sad for
 not being able to decipher such a simple problem (I can come up with
 other ways - but want to fix this one FFS).

It helps a lot of if you post the traceback with your problem. The line 
it occurred on is crucial for debugging.

But I will use my psychic debugger which tells me that the error is here:

 if keyword.iskeyword(tempwords):

tempwords is a list. You need to iterate over the contents of the list 
and run keyword.iskeyword() for each one. Here's an example for Python 
2.5. I've cleaned up some extra lines of code that didn't have any 
eventual effects in your current implementation

from __future__ import with_statement

import keyword

INFILENAME = foo.txt

with open(INFILENAME) as infile:
 for line in infile:
 words = line.split()
 for word in words:
 if keyword.iskeyword(word):
 print word

This will print multiple lines per input line. If you wanted one line 
per input line then try:

with open(INFILENAME) as infile:
 for line in infile:
 words = line.split()
 print  .join(word for word in words
if keyword.iskeyword(word))
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Re-ocurring Events

2007-04-27 Thread Robert Rawlins - Think Blue
Thanks for getting back to me Laurent.

I've now made some pretty tidy progress on this and -think- it's going to
shape up nicely, I'm just working on converting my date strings from the XML
into a date_struct and we should be good to go.

I'll keep you all posted.

Rob

-Original Message-
From: Laurent Pointal [mailto:[EMAIL PROTECTED] 
Sent: 27 April 2007 09:49
To: Robert Rawlins - Think Blue
Subject: Re: Re-ocurring Events

Robert Rawlins - Think Blue a écrit :
 Thank you guys for your suggestions.
 
 I've been having a look at that launchd stuff from apple but couldn’t
really
 see how that applies to my requirements.

I was not thinking about launchd itself, but about its XML configuration 
files which manage timed events, as you need.

 I've been putting some serious thought into how this should work as its
 essentially the final part of the puzzle for my application, I'll have a
 fully working model for my application.
 
 I've been thinking about the possibility of using a combination of xpath
to
 search the XML with some loops which change the date. As events won't ever
 be set to start before 01-01-2007 I can set that as the ceiling for my
loop.
 So when I'm searching for weekly events, I 'simply' take today's date and
 time and loop from now until 01-01-2007 decrementing the date by a week
each
 iteration of the loop and then search the XML for events in that date,
make
 sense?
 
 I know that's a fairly intensive way of doing it, but if it works it
works.
 
 Now, the loop is where I'm really struggling, I've not done any looping
with
 dates, can anyone give me a hand with this? How can I loop back in time
from
 now to beginning of 07 a week at a time? Do we have some form of dateAdd()
I
 can use with a while loop? Perhaps.

See datetime module, eventually third party mxDatetime.

 Date = (now)
 While date  2007-01-01:
   Date = dateAdd(date, -1, w)
 
 Something to that effect? Then I can quickly xpath for every iteration of
 the loop.

A+

Laurent.

-- 
Laurent POINTAL
CNRS-LIMSI dépt. CHM, groupes AMI et PS
Courriel: [EMAIL PROTECTED](prof)
   [EMAIL PROTECTED] (perso)
Ouebe: http://www.limsi.fr/Individu/pointal/
Tél. 01 69 85 81 06 (prof)
Fax. 01 69 85 80 88



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


Re: Tutorial creates confusion about slices

2007-04-27 Thread Antoon Pardon
On 2007-04-26, Steve Holden [EMAIL PROTECTED] wrote:
 Antoon Pardon wrote:
 On 2007-04-25, Steve Holden [EMAIL PROTECTED] wrote:
 [...]

 Most people reading a tutorial are aware that they are being given the 
 knowledge they need to put the subject matter to immediate use, and that 
 there may well be refinements that are glossed over or covered in detail 
 later or elsewhere.
 
 I agree with that.
 
 However there is a difference between information that will help you
 on the way now that will be refined later and information that will
 help you on the way now and will be contradicted later.
 
 I also understand that the line between the two is rather fuzzy.
 
 In my opinion the text in the tutorial as it stands now, is more
 of the latter than of the former type and that is why I would
 prefer a change.
 
 I had already deduced that from your arguments so far in this thread. Do 
 you *have* to make every trivial conclusion explicit?

Well my problem was I had the feeling your remark totally ignored that.

I honestly don't understand what you thought your remark would
contribute if you had deduced the above.

It is very possible that this is a failing of mine in recognizing
when people have understood the point I am trying to make.

 Warning: this is an explicit test to see whether you can sit on your 
 hands and refrain from replying. It's hard to find a thread where you 
 don't make the last comment on every branch you get involved in.

Well I guess I failed.

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


Re: key detect

2007-04-27 Thread hlubenow
Alex Taslab wrote:

 Hi everybody, does anyone know how to detect a key press from a
 keyboard. Well I do know how to do that, but i need to detect just one
 press and ignore the others. I mean, my program checks an input from the
 outside (a sensor) and i emulate that signal as a keypress, but the
 sensor doesn`t send the signal as a unique pulse y just keeps sending
 signal during some seconds, so that is like to be pressing one key for a
 period of time. How can i take that first press of a key and ignore the
 others? I am using pygtk. thanks everybody!

Perhaps you could emulate the sensor-signal as something else than a
keypress, perhaps pipe the event-data into some temporary file or so.

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


Re: webbrowser.open works in IDLE and cmd shell but not from cygwin prompt

2007-04-27 Thread Michael Hoffman
Gregory Bloom wrote:
 I'm running Python 2.5 under Windows.  If I fire up IDLE and enter:
 
 import webbrowser
 url = 'http://www.python.org'
 webbrowser.open_new(url)
 
 it works like a champ, opening the page in Firefox.  Same thing goes
 from a Windows cmd shell: it works as advertised.
 
 But if I open a cygwin bash shell and try the same thing from a python
 prompt, I get:
 
 import webbrowser
 url = 'http://www.python.org'
 webbrowser.open_new(url)
 Traceback (most recent call last):
   File stdin, line 1, in module
   File C:\Python25\lib\webbrowser.py, line 60, in open_new
 return open(url, 1)
   File C:\Python25\lib\webbrowser.py, line 55, in open
 if browser.open(url, new, autoraise):
   File C:\Python25\lib\webbrowser.py, line 185, in open
 p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
   File C:\Python25\lib\subprocess.py, line 551, in __init__
 raise ValueError(close_fds is not supported on Windows 
 ValueError: close_fds is not supported on Windows platforms
 
 What's up with that?

It's not a Cygwin issue, really. This occurs when one of [firefox, 
firebird, seamonkey, mozilla, netscape, opera] is in your 
path. Your Cygwin environment must be set so one of these is in your 
path when it isn't normally.

You should also submit a bug.

 And, more to the point, how can I use webbrowser from scripts launched under
  cygwin?

If you're using native Windows Python as you seem to be, try 
webbrowser.get(windows-default).open_new(url)

If you want to use Cygwin Python instead, I submitted a patch more than 
1.5 years ago to allow it, but it hasn't been reviewed:

http://python.org/sf/1244861
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


How can I save command prompt screen

2007-04-27 Thread ozan SARI

Hi ,

I  run  a  python  acript   with os.system('script.py')

I  want   save command prompt screen  in  a  text file (everything )   how
can  I  do  this?

Thanks   for your  help


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

what python technology for my app?

2007-04-27 Thread Chris
I have an database containing lots of numerical data. I want to write a 
browser based interface that will allow selection of various key 
parameters and yield tables, plots and/or printouts of the data 
according to the selections. Ultimately I want this to run on an 
intranet so that others can get access via their browsers.

The application is for in-house use only and not likely to have more 
than a few users at any one time. I've managed to hack out enough 
understanding of sql and sqlAlchemy over the last couple of days to 
create and access an sqlite3 based database for my data. This seems to 
suit my purposes for now. Now for a front end and some simple 
distribution over a network.

I have written some small Wxpython  matplotlib apps for data analysis 
and display but I'm not sure how these would work in a browser based 
world, or even if they are appropriate.

Any advice on what technologies I should be looking at for this? Python 
based naturally, and hopefully simple and lightweight. I'm not a 
programmer by trade and that's not what I really get paid for but I've 
learned to love python and its myriad of modules for all the data 
analysis work I need to do. If I can throw something moderately 
functional together in a week or two (along with all the learning that 
entails) I'll be happy.

btw - Platform needs to be windows because that's what on my desk.

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


Re: My python annoyances so far

2007-04-27 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit :
(snip)
 
 Well, why do some things in the library have to be functions, and
 other things have to be class methods?
  Why aren't they all just either functions or class methods? like
  perhaps ruby.
 

If I tell you that Python's functions are in fact static methods of 
their module, will this make you happy ? Because, while not technically 
true, this is conceptually equivalent.

Or if you prefer to stick to technical truth, python's methods are 
nothing more than a thin decorator around a function object (yes, 
Python's functions *are* objects) - so in fact, there are *only* 
functions - sometimes wrapped into a method object, sometimes not, 
depending on how you access them.

In both cases, the fact that you don't have enough knowledge of a 
language to understand it's design, and/or the fact that this design is 
different from other one you already know, doesn't by itself make this 
design an annoyance.


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


RE: Re-ocurring Events

2007-04-27 Thread Robert Rawlins - Think Blue
Ok, Almost done now, it seems to be working a real charm at the moment.

I need a little help on performing a quick if statement against a date
string. I have couple of date strings returned by

s.attributes.getNamedItem(start).nodeValue
s.attributes.getNamedItem(end).nodeValue

and I need to do and conditional that ensures start is before today's
date/time and end is after today's date/time.

The string looks like: '2007-01-01 00:00:00'

Do I have to convert this to a proper time object to do the comparison? Or
can I do it as a string?

Thanks,

Rob

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Robert Rawlins - Think Blue
Sent: 27 April 2007 09:55
To: 'Laurent Pointal'
Cc: python-list@python.org
Subject: RE: Re-ocurring Events

Thanks for getting back to me Laurent.

I've now made some pretty tidy progress on this and -think- it's going to
shape up nicely, I'm just working on converting my date strings from the XML
into a date_struct and we should be good to go.

I'll keep you all posted.

Rob

-Original Message-
From: Laurent Pointal [mailto:[EMAIL PROTECTED] 
Sent: 27 April 2007 09:49
To: Robert Rawlins - Think Blue
Subject: Re: Re-ocurring Events

Robert Rawlins - Think Blue a écrit :
 Thank you guys for your suggestions.
 
 I've been having a look at that launchd stuff from apple but couldn’t
really
 see how that applies to my requirements.

I was not thinking about launchd itself, but about its XML configuration 
files which manage timed events, as you need.

 I've been putting some serious thought into how this should work as its
 essentially the final part of the puzzle for my application, I'll have a
 fully working model for my application.
 
 I've been thinking about the possibility of using a combination of xpath
to
 search the XML with some loops which change the date. As events won't ever
 be set to start before 01-01-2007 I can set that as the ceiling for my
loop.
 So when I'm searching for weekly events, I 'simply' take today's date and
 time and loop from now until 01-01-2007 decrementing the date by a week
each
 iteration of the loop and then search the XML for events in that date,
make
 sense?
 
 I know that's a fairly intensive way of doing it, but if it works it
works.
 
 Now, the loop is where I'm really struggling, I've not done any looping
with
 dates, can anyone give me a hand with this? How can I loop back in time
from
 now to beginning of 07 a week at a time? Do we have some form of dateAdd()
I
 can use with a while loop? Perhaps.

See datetime module, eventually third party mxDatetime.

 Date = (now)
 While date  2007-01-01:
   Date = dateAdd(date, -1, w)
 
 Something to that effect? Then I can quickly xpath for every iteration of
 the loop.

A+

Laurent.

-- 
Laurent POINTAL
CNRS-LIMSI dépt. CHM, groupes AMI et PS
Courriel: [EMAIL PROTECTED](prof)
   [EMAIL PROTECTED] (perso)
Ouebe: http://www.limsi.fr/Individu/pointal/
Tél. 01 69 85 81 06 (prof)
Fax. 01 69 85 80 88



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

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


Re: My python annoyances so far

2007-04-27 Thread Bruno Desthuilliers
Marc 'BlackJack' Rintsch a écrit :
 In [EMAIL PROTECTED], Steven Howe
 wrote:
 
 And before someone get's all technical, I know everything in Python is 
 an 'object' even None, which implies class, or is it the other way around?
 
 Objects don't imply classes.  There are object oriented languages without
 classes like the Io language.  Everything there is an object and the base
 object has a `clone()` method to make a copy.  So you make copies of
 objects and modify them to tweak them into the way you want them.

And FWIW, in Python, classes are objects too, and are attributes of 
their instances. Which makes Python quite close to prototype-based 
languages like Io, Self or Javascript.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: *** Dr G Polya BRILLIANTLY analyses the Virgina Shooting Incident ***

2007-04-27 Thread Fred Bloggs


[EMAIL PROTECTED] wrote:
 On Apr 24, 2:09 pm, Quadibloc [EMAIL PROTECTED] wrote:
 
The Real Andy wrote:

Makes me wonder about the credibility of any statement Dr Gideon Polya
makes.

.
I never thought that I would feel the urge to call someone an
edelweiss-eating Tanzanian devil, but Dr. Polya proved that I lacked
imagination.

(Note that Tanzanian is pronounced Tan.zan._ee_.yan, not
Tan._zayn_.ee.an; one wouldn't want to spoil the effect.)
 
 
 What really spoils the effect is that Dr. Polya lives in Tasmania, a
 state of Australia, and not in Tanzania, which is a country in East
 Africa.
 
 Semi-literate Americans do tend to confuse the two places, as they
 also tend confuse Australia and Austria. Oddly enough, edelweiss grows
 in Austria, so Dr. Polya would have to import it from Europe if he
 were in the habit of dining on edelweiss - which would be an eccentric
 habit, even in Austria, where the flower doesn't form part of the
 normal diet.
 
 --
 Bill Sloman, Nijmegen
 

Is there any civilized life in Tasmania? It looks like just another 
natural wonderland that was raped, pillaged, exploited for its 
resources, and left behind. Even the official tourism site makes the 
place seem dull and bereft of any kind of enthusiasm, warning the 
prospective visitor that life is slow there. I did not know Erol Flynn 
was from there. That's something anyway. They might consider making his 
boyhood home a museum or something. And was that Gunn Forestry you know 
so well?

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


Re: My python annoyances so far

2007-04-27 Thread Bruno Desthuilliers
7stud a écrit :
 [EMAIL PROTECTED] wrote:
 Annoyances:

 
 Every language has annoyances.  Python is no exception.  

Sure. But we may disagree on what are actually Python's annoyances !-)

 Post away.
 Anyone that is offended can go drink a Guinness.
 
 1. Underscores! What's the deal with that? Especially those double
 underscores. The best answer I read on this is that the double
 underscores denotes special methods that the interpreter may
 automatically use. For example, 4+4 get expanded by the interpreter to
 4.__add__(4).

 
 I thought those were pretty ugly myself.  Now, I am used to them.

FWIW, you shouldn't have to directly use __magic__ methods - or only in 
very special corner cases.

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


Re: How to find complementary colour for pixel

2007-04-27 Thread Laurent Pointal
Steven D'Aprano a écrit :
 I shouldn't think so... I always forget if black is all ones or all
 zeroes, so I checked here: http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html

For this I use the mnemotechnics idea of chromatic coil [*], when 
there are *all* colors turning it appear to be *white*. And *no* color 
is then *black*.



[*] Babelfish translation for french roue chromatique
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to find complementary colour for pixel

2007-04-27 Thread Steven D'Aprano
On Thu, 26 Apr 2007 21:17:42 -0700, James Stroud wrote:

 Johny wrote:
  I use PIL to write some text to a picture.The text must  be seen wery
 clearly.
 I write the text to different pictures but to the same position. As 
 pictures maybe  different, colour, in the position where I write the
 text, is also different.
 Is there a way how to set the font colour so that it will be seen very
 clearly in the picture?
 For example, if the picture is bright ( for example yellow), the font
 colour should be dark( e.g. black) and vice versa.
 Is there a routine in PIL available  that calculates complementary
 colour for RGB pixel format?
 Can anyone help?
 Thanks
 L.
 
 
 Don't you just xor with black?

I shouldn't think so... I always forget if black is all ones or all
zeroes, so I checked here: http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html

 black = 0x00 # RGB colours
 white = 0xff
 black^black == white
False
 white^black == black
False

Maybe you meant xor with white?

But even so, I gather that the Original Poster is asking for something
slightly different -- despite his mention of complimentary colours. (Or
maybe I'm just reading too much into it?)

I think he's just looking for one colour which has high contrast over a
bunch of pixels in an image. I don't think that can be done, in general:
it seems to me he's assuming that all the pixels in the area he wants
to overlay text on are nearly the same colour.

I think that a better solution is to draw a box around the area you
want to write text into. The box should have a contrasting frame:
say, a thin white border followed by a thin black border just inside it:
either the white or the black will contrast with the background, no matter
what colour(s) the background is, since no area can be both black and
white in the same place. Then fill the frame with white, and draw black
text inside it. Nice high contrast.

That is probably the most readable method of placing text over an image.


-- 
Steven D'Aprano 

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


Re: what python technology for my app?

2007-04-27 Thread Bruno Desthuilliers
Chris a écrit :
 I have an database containing lots of numerical data. I want to write a 
 browser based interface that will allow selection of various key 
 parameters and yield tables, plots and/or printouts of the data 
 according to the selections. Ultimately I want this to run on an 
 intranet so that others can get access via their browsers.
 
 The application is for in-house use only and not likely to have more 
 than a few users at any one time. I've managed to hack out enough 
 understanding of sql and sqlAlchemy over the last couple of days to 
 create and access an sqlite3 based database for my data. This seems to 
 suit my purposes for now. Now for a front end and some simple 
 distribution over a network.
 
 I have written some small Wxpython  matplotlib apps for data analysis 
 and display but I'm not sure how these would work in a browser based 
 world, or even if they are appropriate.

wxPython being a GUI toolkit, it's of course not really appropriate for 
a web-based solution (and yes, this is an understatement).

I don't have any experience with matplotlib, but according to the 
project's FAQ, this shouldn't be a problem:
http://matplotlib.sourceforge.net/faq.html#BATCHMODE

 
 Any advice on what technologies I should be looking at for this? Python 
 based naturally, and hopefully simple and lightweight. I'm not a 
 programmer by trade and that's not what I really get paid for but I've 
 learned to love python and its myriad of modules for all the data 
 analysis work I need to do. If I can throw something moderately 
 functional together in a week or two (along with all the learning that 
 entails)

If you don't have any experience with web programming, it might take a 
bit more time.

 I'll be happy.

Pylons (http://pylonshq.com) and turbogears are two great web 
frameworks. Both support SQLAlchemy. My own favourite is Pylons, but you 
should try both and choose the one that better fits your brain.

 btw - Platform needs to be windows because that's what on my desk.

Python is mostly platform independant.

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


RE: what python technology for my app?

2007-04-27 Thread Robert Rawlins - Think Blue
Just thought I'd make a little suggestion about this, I don’t know how
strict you want to be with the web development side of things, but I'm a web
developer by trade and have recently started using python for my non-web
type applications.

If you're looking for a web based server side solution, then you can't go
wrong with Adobe ColdFusion. Its and incredibly powerful and scalable
development platform and yet supports a simple tag based language which
makes life very easy when getting started, and yet will support much more
complex OOP methodology with a whole myriad of frameworks, orm's and object
factories.

For a quick 'run down' of its features take a look at the simple tutorials
on the adobe site, they'll demonstrate how easy it is to achieve even quite
complex tasks like PDF creation, animated statistical charts an all sorts.
As CF is a JAVA based technology you get the power of J2EE platform and its
perfectly multi platform playing nicely with linux, unix, sun, windows or
whatever server environment you wish to run it on.

Just my two pence, I'm a big CF fan so my opinions are no doubt bias, but
might be worth you taking a look.

http://www.adobe.com/uk/products/coldfusion/

Pay attention to the 'ColdFusion Demos' at the bottom right of the main
column.

Rob

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Bruno Desthuilliers
Sent: 27 April 2007 12:19
To: python-list@python.org
Subject: Re: what python technology for my app?

Chris a écrit :
 I have an database containing lots of numerical data. I want to write a 
 browser based interface that will allow selection of various key 
 parameters and yield tables, plots and/or printouts of the data 
 according to the selections. Ultimately I want this to run on an 
 intranet so that others can get access via their browsers.
 
 The application is for in-house use only and not likely to have more 
 than a few users at any one time. I've managed to hack out enough 
 understanding of sql and sqlAlchemy over the last couple of days to 
 create and access an sqlite3 based database for my data. This seems to 
 suit my purposes for now. Now for a front end and some simple 
 distribution over a network.
 
 I have written some small Wxpython  matplotlib apps for data analysis 
 and display but I'm not sure how these would work in a browser based 
 world, or even if they are appropriate.

wxPython being a GUI toolkit, it's of course not really appropriate for 
a web-based solution (and yes, this is an understatement).

I don't have any experience with matplotlib, but according to the 
project's FAQ, this shouldn't be a problem:
http://matplotlib.sourceforge.net/faq.html#BATCHMODE

 
 Any advice on what technologies I should be looking at for this? Python 
 based naturally, and hopefully simple and lightweight. I'm not a 
 programmer by trade and that's not what I really get paid for but I've 
 learned to love python and its myriad of modules for all the data 
 analysis work I need to do. If I can throw something moderately 
 functional together in a week or two (along with all the learning that 
 entails)

If you don't have any experience with web programming, it might take a 
bit more time.

 I'll be happy.

Pylons (http://pylonshq.com) and turbogears are two great web 
frameworks. Both support SQLAlchemy. My own favourite is Pylons, but you 
should try both and choose the one that better fits your brain.

 btw - Platform needs to be windows because that's what on my desk.

Python is mostly platform independant.

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

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


Re: My python annoyances so far

2007-04-27 Thread Bjoern Schliessmann
James Stroud wrote:

 Here is something on which to meditate: classes become functions
 when you get the quantum mechanics just so!

s/become/can behave like/

:)

Regards,


Björn

-- 
BOFH excuse #27:

radiosity depletion

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


Re: Re-ocurring Events

2007-04-27 Thread Jarek Zgoda
Robert Rawlins - Think Blue napisał(a):

 and I need to do and conditional that ensures start is before today's
 date/time and end is after today's date/time.
 
 The string looks like: '2007-01-01 00:00:00'
 
 Do I have to convert this to a proper time object to do the comparison? Or
 can I do it as a string?

In the very specific case of string formatted as above, the string
comparison will give the same results as in the case of datetime objects
comparison. You just have to compare the same kinds of things. ;)

-- 
Jarek Zgoda

We read Knuth so you don't have to.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My python annoyances so far

2007-04-27 Thread Bjoern Schliessmann
Steven D'Aprano wrote:

 Perhaps you should read about the Kingdom of Nouns:

 http://steve-yegge.blogspot.com/2006/03/
 execution-in-kingdom-of-nouns.html 

Really cool. :) Thanks for sharing the link.

Regards,


Björn

-- 
BOFH excuse #118:

the router thinks its a printer.

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


RE: Re-ocurring Events

2007-04-27 Thread Robert Rawlins - Think Blue
Thanks for that tip Jarek, It worked a charm, I just created a format time
string and used that in the compare against my XML and it work perfectly.

Thank you,

Rob

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Jarek Zgoda
Sent: 27 April 2007 13:01
To: python-list@python.org
Subject: Re: Re-ocurring Events

Robert Rawlins - Think Blue napisał(a):

 and I need to do and conditional that ensures start is before today's
 date/time and end is after today's date/time.
 
 The string looks like: '2007-01-01 00:00:00'
 
 Do I have to convert this to a proper time object to do the comparison? Or
 can I do it as a string?

In the very specific case of string formatted as above, the string
comparison will give the same results as in the case of datetime objects
comparison. You just have to compare the same kinds of things. ;)

-- 
Jarek Zgoda

We read Knuth so you don't have to.
-- 
http://mail.python.org/mailman/listinfo/python-list

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


Multiple select in wx.GenericDirCrtl

2007-04-27 Thread Soren
Hi!

Is it possible to do multiple file selections in a wx.GenericDirCtrl??

Thanks,
Soren

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


creating an object from base class

2007-04-27 Thread iogilvy
i wish to have some extended functionality added to sockets

i can create my own socket class   class mysocket(socket.socket):

and all should be fine. Except, the sockets are created for me by the
accept method, listening on port. So how can i take the standard
socket created for me and create a 'mysocket'. I need a method that
will initialise any new properties i have added in my class, but how
can i change the class of the socket created?

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


Re: Generalized range

2007-04-27 Thread Beliavsky
On Apr 27, 1:32 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
 Michael Hoffman [EMAIL PROTECTED] wrote:
  [EMAIL PROTECTED] wrote:
   Thanks - you have covered a fair bit of gorund here - I will modify
   myRange taking your suggestions into account. The one suggestion that
   I'm going to have to think through is repeatedly incrementing res.

   I deliberately did not use this as repeated addition can cause
   rounding errors to accumulate, making the loop run a little longer or
   shorter than necessary. I thought I would be far less likely to run
   into rounding issues with a multiplicative construct - hence my use of
   epsilon, and my question about an appropriate value for it

  You are right about rounding issues--with a sufficiently small step, the
  way I have done it, it could become an infinite loop. But you can still
  do it with multiplication, without using an epsilon constant. How about
  something like this:

  index = 0
  while res  maximum:
   yield minimum + (step * index)
   index += 1

 Absolutely (with your later correction of actually assigning res), MUCH
 better than the misguided attempts based on repeatedly adding 'step'.

 I've taught numerical computing in university, and I would have had to
 fail anybody who'd misunderstood floating-point computations badly
 enough to try that +=step idea (including, sigh, the coders of several 
 Fortran compilers who were popular at that time).

You may be referring to the Fortran DO loop with a REAL loop variable,
for example

do x=1.5,3.5,0.5
   print*,x
end do

This was part of standard Fortran 77, so one should blame the
standards committee, not the compiler writers. Very few features of
F77 were deleted in Fortran 95, but this was one of them. In practice,
nothing gets deleted from commercial Fortran compilers.

At the SciPy site http://www.scipy.org/Cookbook/OptimizationAndFitDemo1
there is some code

   1 from enthought.chaco.wx import plt
   2 from scipy import arange, optimize, special
   3
   4 plt.figure()
   5 plt.hold()
   6 w = []
   7 z = []
   8 x = arange(0,10,.01)
   9
  10 for k in arange(1,5,.5):
  11y = special.jv(k,x)
  12plt.plot(x,y)
  13f = lambda x: -special.jv(k,x)
  14x_max = optimize.fminbound(f,0,6)
  15w.append(x_max)
  16z.append(special.jv(k,x_max))
  17
  18 plt.plot(w,z, 'ro')
  19 from scipy import interpolate
  20 t = interpolate.splrep(w, z, k=3)
  21 s_fit3 = interpolate.splev(x,t)
  22 plt.plot(x,s_fit3, 'g-')
  23 t5 = interpolate.splrep(w, z, k=5)
  24 s_fit5 = interpolate.splev(x,t5)
  25 plt.plot(x,s_fit5, 'y-')

I think the use of arange with a non-integer increment is poor style,
for reasons discussed in this thread.

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


Re: My python annoyances so far

2007-04-27 Thread flifus
On 26 Apr, 21:50, Bjoern Schliessmann usenet-
[EMAIL PROTECTED] wrote:

  like perhaps ruby.

 If I were rude, I would ask now why you don't use ruby. But I bet
 ruby has some annoyances ready for you too.

 Regards,

 Björn

Well, I'd use ruby but python is everywhere, and ruby isn't. All the
applications that interest me are scriptable in python, not ruby.

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


Re: *** Dr G Polya BRILLIANTLY analyses the Virgina Shooting Incident ***

2007-04-27 Thread bill . sloman
On Apr 27, 12:59 pm, Fred Bloggs [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  On Apr 24, 2:09 pm, Quadibloc [EMAIL PROTECTED] wrote:

 The Real Andy wrote:

 Makes me wonder about the credibility of any statement Dr Gideon Polya
 makes.

 .
 I never thought that I would feel the urge to call someone an
 edelweiss-eating Tanzanian devil, but Dr. Polya proved that I lacked
 imagination.

 (Note that Tanzanian is pronounced Tan.zan._ee_.yan, not
 Tan._zayn_.ee.an; one wouldn't want to spoil the effect.)

  What really spoils the effect is that Dr. Polya lives in Tasmania, a
  state of Australia, and not in Tanzania, which is a country in East
  Africa.

  Semi-literate Americans do tend to confuse the two places, as they
  also tend confuse Australia and Austria. Oddly enough, edelweiss grows
  in Austria, so Dr. Polya would have to import it from Europe if he
  were in the habit of dining on edelweiss - which would be an eccentric
  habit, even in Austria, where the flower doesn't form part of the
  normal diet.

  --
  Bill Sloman, Nijmegen

 Is there any civilized life in Tasmania? It looks like just another
 natural wonderland that was raped, pillaged, exploited for its
 resources, and left behind.

The pillaging and rapine continues. The Green Party has managed to
protect some of the more interesting elements of the ecology, but the
paper mills where my father was research manager for as long as we
lived in Tasmania continues to chop down a lot of trees. They liked to
claim that their wood felling was sustainable, but since the cycle of
felling and regrowth they had in mind at the time worked on a 200 year
cycle, and the business was set up in the late 1930s, there wasn't a
lot of farmed timber going into the wood chippers at the time. How it
works at the moment isn't clear - two hundred year old wood isn't
ideal for making paper.

Even the official tourism site makes the
 place seem dull and bereft of any kind of enthusiasm, warning the
 prospective visitor that life is slow there.

The population is only around 350,000 on an island the size of
Ireland. The state has the highest fertility and the lowest rate of
population growth of all the Australian states - anybody who is any
good leaves, as I did, and pursues a career someplace where there are
careers worth pursuing.

 I did not know Erol Flynn was from there.

He was born there, but left Tasmania fairly early (like everybody
else) - his father, the distinguished Australian marine biologist/
zoologist Prof. Theodore Thomson Flynn was presumably working at the
University of Tasmania in Hobart in 1909.

That's something anyway. They might consider making his
 boyhood home a museum or something. And was that Gunn Forestry you know
 so well.

I don't know anything about Gunn Forestry.

The Green Party obviously doesn't like it, but they do have a tendency
to describe 25-year-old regrowth forests as virgin primeval
rainforest because the lie plays better to their target audience than
would the more nuanced truth.

The paper mill where my father worked had to severely restrict the
proportion of old-growth wood - trunks more than four feet (1,2
metres) in diameter - because the lignin in the older wood contained a
relatively high proportion of some organic acid that messed up the
caustic soda recovery cycle - and IIRR preferentially logged regrowth
forests that had grown up in areas clear-felled after the first world
war in order to provide cattle-raising farms for soldiers coming back
from the First World War. The farms were not successful, and the land
rapidly went back to forest.

My father was the guy who worked out that a high proportion of old
wood was what messed up the soda recovery process, and he hired the
Norwegian chemist - Asbjorn Baklien - who worked out how the old wood
caused the problem. Asbjorn went on to a brilliant career with ICI and
Monash University.

http://www.asap.unimelb.edu.au/bsparcs/biogs/P003354b.htm

--
Bill Sloman, Nijmegen

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


getting rid of EOL character ?

2007-04-27 Thread stef
hello,

In the previous language I used,
when reading a line by readline, the EOL character was removed.

Now I'm reading a text-file with CR+LF at the end of each line,
Datafile = open(filename,'r') 
line = Datafile.readline()

now this gives an extra empty line
print line

and what I expect that should be correct, remove CR+LF,
gives me one character too much removed
print line[,-2]

while this gives what I need ???
print line[,-1]

Is it correct that the 2 characters CR+LF are converted to 1 character ?
Is there a more automatic way to remove the EOL from the string ?

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


Re: Multiple select in wx.GenericDirCrtl

2007-04-27 Thread kyosohma
On Apr 27, 7:31 am, Soren [EMAIL PROTECTED] wrote:
 Hi!

 Is it possible to do multiple file selections in a wx.GenericDirCtrl??

 Thanks,
 Soren

I'm not finding anything. I do know you can select multiple files
using the FileDialog. You should email the wxPython users group
though. They may have a custom control or they will likely be able to
point you in the right direction.

http://www.wxpython.org/maillist.php

Mike

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


Re: getting rid of EOL character ?

2007-04-27 Thread Michael Hoffman
stef wrote:
 hello,
 
 In the previous language I used,
 when reading a line by readline, the EOL character was removed.
 
 Now I'm reading a text-file with CR+LF at the end of each line,
Datafile = open(filename,'r')line = Datafile.readline()
 
 now this gives an extra empty line
print line
 
 and what I expect that should be correct, remove CR+LF,
 gives me one character too much removed
print line[,-2]
 
 while this gives what I need ???
print line[,-1]
 
 Is it correct that the 2 characters CR+LF are converted to 1 character ?
 Is there a more automatic way to remove the EOL from the string ?

line = line.rstrip(\r\n) should take care of it. If you leave out the 
parameter, it will strip out all whitespace at the end of the line, 
which is what I do in most cases.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what python technology for my app?

2007-04-27 Thread Bruno Desthuilliers
Robert Rawlins - Think Blue a écrit :
 Just thought I'd make a little suggestion about this, I don’t know how
 strict you want to be with the web development side of things, but I'm a web
 developer by trade and have recently started using python for my non-web
 type applications.
 
 If you're looking for a web based server side solution, then you can't go
 wrong with Adobe ColdFusion.

Err... is this a troll ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what python technology for my app?

2007-04-27 Thread Gerard Flanagan
On Apr 27, 12:18 pm, Chris [EMAIL PROTECTED] wrote:
 I have an database containing lots of numerical data. I want to write a
 browser based interface that will allow selection of various key
 parameters and yield tables, plots and/or printouts of the data
 according to the selections. Ultimately I want this to run on an
 intranet so that others can get access via their browsers.

 The application is for in-house use only and not likely to have more
 than a few users at any one time.

 Any advice on what technologies I should be looking at for this? Python
 based naturally, and hopefully simple and lightweight.

 If I can throw something moderately
 functional together in a week or two (along with all the learning that
 entails) I'll be happy.

 btw - Platform needs to be windows because that's what on my desk.


1) for small intranet,
2) in Python,
3) dead simple,
4) runs on Windows

 - consider Karrigell: http://karrigell.sourceforge.net/en/front.htm

Gerard



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


visit http://www.real-article.com/spyware/index.php

2007-04-27 Thread hiruma222
The www.real-article.com website provides a ton of information about
spyware. In addition, you will find extensive information on leading
spyware to help you on your way to success.

Please have a look at our spyware articles, products, resources, and
additional information located throughout www.real-article.com.

We strive to provide only quality articles, so if there is a specific
topic related to spyware that you would like us to cover, please
contact us at any time.

visit http://www.real-article.com/spyware/index.php

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


RE: what python technology for my app?

2007-04-27 Thread Robert Rawlins - Think Blue
Haha, no Troll, just a shameless plug for my life's one true love ;-)

Rob

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Bruno Desthuilliers
Sent: 27 April 2007 14:35
To: python-list@python.org
Subject: Re: what python technology for my app?

Robert Rawlins - Think Blue a écrit :
 Just thought I'd make a little suggestion about this, I don’t know how
 strict you want to be with the web development side of things, but I'm a
web
 developer by trade and have recently started using python for my non-web
 type applications.
 
 If you're looking for a web based server side solution, then you can't go
 wrong with Adobe ColdFusion.

Err... is this a troll ?
-- 
http://mail.python.org/mailman/listinfo/python-list

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


Re: Generalized range

2007-04-27 Thread Alex Martelli
Beliavsky [EMAIL PROTECTED] wrote:
   ...
  I've taught numerical computing in university, and I would have had to
  fail anybody who'd misunderstood floating-point computations badly
  enough to try that +=step idea (including, sigh, the coders of several
  Fortran compilers who were popular at that time).
 
 You may be referring to the Fortran DO loop with a REAL loop variable,
 for example
 
 do x=1.5,3.5,0.5
print*,x
 end do
 
 This was part of standard Fortran 77, so one should blame the
 standards committee, not the compiler writers. Very few features of

I was thinking of Fortran IV aka Fortran '66, where as I recall per
the standard you were _supposed_ to only use integers in a DO, but
several compilers supplied real loop variables as an extension, and got
its implementation wrong.


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


Re: conditional print statement ?

2007-04-27 Thread stef

 or (untested):

 if Print_Info:
 def printOrNot(arg):
 print arg
 else:
 def printOrNot(arg):
 pass

 printOrNot(Datafile.readline())

   
thanks for the creative solution, and indeed it does work ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting rid of EOL character ?

2007-04-27 Thread stef


 line = line.rstrip(\r\n) should take care of it. If you leave out 
 the parameter, it will strip out all whitespace at the end of the 
 line, which is what I do in most cases.
thanks for the solution Michael,

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting rid of EOL character ?

2007-04-27 Thread Jim
If you have a recent Python, see the documentation for open on the
library page for built-in functions.
  http://docs.python.org/lib/built-in-funcs.html

Jim

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


Re: My python annoyances so far

2007-04-27 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote:

 Well, I'd use ruby but python is everywhere, and ruby isn't. All
 the applications that interest me are scriptable in python, not
 ruby.

Pity that you don't comment core topics.

Regards,


Björn

-- 
BOFH excuse #289:

Interference between the keyboard and the chair.

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


Re: regex question

2007-04-27 Thread proctor
On Apr 27, 1:33 am, Paul McGuire [EMAIL PROTECTED] wrote:
 On Apr 27, 1:33 am, proctor [EMAIL PROTECTED] wrote:



  hello,

  i have a regex:  rx_test = re.compile('/x([^x])*x/')

  which is part of this test program:

  

  import re

  rx_test = re.compile('/x([^x])*x/')

  s = '/xabcx/'

  if rx_test.findall(s):
  print rx_test.findall(s)

  

  i expect the output to be ['abc'] however it gives me only the last
  single character in the group: ['c']

  C:\testpython retest.py
  ['c']

  can anyone point out why this is occurring?  i can capture the entire
  group by doing this:

  rx_test = re.compile('/x([^x]+)*x/')
  but why isn't the 'star' grabbing the whole group?  and why isn't each
  letter 'a', 'b', and 'c' present, either individually, or as a group
  (group is expected)?

  any clarification is appreciated!

  sincerely,
  proctor

 As Josiah already pointed out, the * needs to be inside the grouping
 parens.

 Since re's do lookahead/backtracking, you can also write:

 rx_test = re.compile('/x(.*?)x/')

 The '?' is there to make sure the .* repetition stops at the first
 occurrence of x/.

 -- Paul

i am working through an example from the oreilly book mastering
regular expressions (2nd edition) by jeffrey friedl.  my post was a
snippet from a regex to match C comments.   every 'x' in the regex
represents a 'star' in actual usage, so that backslash escaping is not
needed in the example (on page 275).  it looks like this:

===

/x([^x]|x+[^/x])*x+/

it is supposed to match '/x', the opening delimiter, then

(
either anything that is 'not x',

or,

'x' one or more times, 'not followed by a slash or an x'
) any number of times (the 'star')

followed finally by the closing delimiter.

===

this does not seem to work in python the way i understand it should
from the book, and i simplified the example in my first post to
concentrate on just one part of the alternation that i felt was not
acting as expected.

so my question remains, why doesn't the star quantifier seem to grab
all the data.  isn't findall() intended to return all matches?  i
would expect either 'abc' or 'a', 'b', 'c' or at least just
'a' (because that would be the first match).  why does it give only
one letter, and at that, the /last/ letter in the sequence??

thanks again for replying!

sincerely,
proctor

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


Re: conditional print statement ?

2007-04-27 Thread Paul McGuire
On Apr 26, 7:31 am, Dustan [EMAIL PROTECTED] wrote:
 On Apr 26, 1:58 am, Antoon Pardon [EMAIL PROTECTED] wrote:





  On 2007-04-25, Stef Mientki [EMAIL PROTECTED] wrote:

   hello,

   As part of a procedure I've a number sequences like this:

  Python
if Print_Info: print Datafile.readline()
else:Datafile.readline()
  /Python

   Is there a more compressed way to write such a statement,
   especially I dislike the redundancy Datafile.readline().

   thanks,
   Stef Mientki

  You could consider the following

  def Print(arg):
  print arg

  def Noop(arg):
  pass

 or (untested):

 if Print_Info:
 def printOrNot(arg):
 print arg
 else:
 def printOrNot(arg):
 pass

 printOrNot(Datafile.readline())



  (Print if Print_Info else Noop) (Datafile.readline())

  --
  Antoon Pardon- Hide quoted text -

 - Show quoted text -- Hide quoted text -

 - Show quoted text -

The Enable/Disable decorators on the Python wiki (http://
wiki.python.org/moin/PythonDecoratorLibrary?highlight=%28decorator
%29#head-8298dbf9ac7325d9ef15e7130e676378bbbda572) help you do
something very similar, without having to replicate the function being
enabled/disabled.

@(disabled,enabled)[Print_Info]
def printOrNot(arg):
print arg

-- Paul

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


Re: regex question

2007-04-27 Thread Michael Hoffman
proctor wrote:
 On Apr 27, 1:33 am, Paul McGuire [EMAIL PROTECTED] wrote:
 On Apr 27, 1:33 am, proctor [EMAIL PROTECTED] wrote:

 rx_test = re.compile('/x([^x])*x/')
 s = '/xabcx/'
 if rx_test.findall(s):
 print rx_test.findall(s)
 
 i expect the output to be ['abc'] however it gives me only the last
 single character in the group: ['c']

 As Josiah already pointed out, the * needs to be inside the grouping
 parens.

 so my question remains, why doesn't the star quantifier seem to grab
 all the data.

Because you didn't use it *inside* the group, as has been said twice. 
Let's take a simpler example:

  import re
  text = xabc
  re_test1 = re.compile(x([^x])*)
  re_test2 = re.compile(x([^x]*))
  re_test1.match(text).groups()
('c',)
  re_test2.match(text).groups()
('abc',)

There are three places that match ([^x]) in text. But each time you find 
one you overwrite the previous example.

 isn't findall() intended to return all matches?

It returns all matches of the WHOLE pattern, /x([^x])*x/. Since you used 
a grouping parenthesis in there, it only returns one group from each 
pattern.

Back to my example:

  re_test1.findall(xabcxaaaxabc)
['c', 'a', 'c']

Here it finds multiple matches, but only because the x occurs multiple 
times as well. In your example there is only one match.

 i would expect either 'abc' or 'a', 'b', 'c' or at least just
 'a' (because that would be the first match).

You are essentially doing this:

group1 = a
group1 = b
group1 = c

After those three statements, you wouldn't expect group1 to be abc or 
a. You'd expect it to be c.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: regex question

2007-04-27 Thread Duncan Booth
proctor [EMAIL PROTECTED] wrote:

 so my question remains, why doesn't the star quantifier seem to grab
 all the data.  isn't findall() intended to return all matches?  i
 would expect either 'abc' or 'a', 'b', 'c' or at least just
 'a' (because that would be the first match).  why does it give only
 one letter, and at that, the /last/ letter in the sequence??
 
findall returns the matched groups. You get one group for each 
parenthesised sub-expression, and (the important bit) if a single 
parenthesised expression matches more than once the group only contains 
the last string which matched it.

Putting a star after a subexpression means that subexpression can match 
zero or more times, but each time it only matches a single character 
which is why your findall only returned the last character it matched.

You need to move the * inside the parentheses used to define the group, 
then the group will match only once but will include everything that it 
matched.

Consider:

 re.findall('(.)', 'abc')
['a', 'b', 'c']
 re.findall('(.)*', 'abc')
['c', '']
 re.findall('(.*)', 'abc')
['abc', '']

The first pattern finds a single character which findall manages to 
match 3 times.

The second pattern finds a group with a single character zero or more 
times in the pattern, so the first time it matches each of a,b,c in turn 
and returns the c, and then next time around we get an empty string when 
group matched zero times.

In the third pattern we are looking for a group with any number of 
characters in it. First time we get all of the string, then we get 
another empty match.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Command-line option equiv of PYTHONPATH

2007-04-27 Thread Antoon Pardon
On 2007-04-27, James Stroud [EMAIL PROTECTED] wrote:
 Rajesh wrote:
 Hi,
 
 The '-Ipath' option adds the path to the list of directories that
 contains modules that can be included in a script. I can use it as #!/
 usr/bin/perl -Ipath_to_my_modules thereby not asking the user of
 the script to set the path_to_my_modules in their environment.
 
 Is there any equivalent command-line option to the python binary or a
 command-line version of PYTHONPATH?
 
 Regards
 Rajesh

 Why not just modify sys.path within the actual script?

Maybe because he has multiple versions of modules he wants to test his
script against.

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


Re: conditional print statement ?

2007-04-27 Thread Duncan Booth
Paul McGuire [EMAIL PROTECTED] wrote:

 The Enable/Disable decorators on the Python wiki (http://
 wiki.python.org/moin/PythonDecoratorLibrary?highlight=%28decorator
 %29#head-8298dbf9ac7325d9ef15e7130e676378bbbda572) help you do
 something very similar, without having to replicate the function being
 enabled/disabled.
 
 @(disabled,enabled)[Print_Info]
 def printOrNot(arg):
 print arg
 

Pardon me for asking, but isn't that a syntax error? Decorator syntax is:

@ dotted_name [( [argument_list [,]] )] NEWLINE

and you don't have a dotted_name.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: regex question

2007-04-27 Thread Paul McGuire
On Apr 27, 9:10 am, proctor [EMAIL PROTECTED] wrote:
 On Apr 27, 1:33 am, Paul McGuire [EMAIL PROTECTED] wrote:





  On Apr 27, 1:33 am, proctor [EMAIL PROTECTED] wrote:

   hello,

   i have a regex:  rx_test = re.compile('/x([^x])*x/')

   which is part of this test program:

   

   import re

   rx_test = re.compile('/x([^x])*x/')

   s = '/xabcx/'

   if rx_test.findall(s):
   print rx_test.findall(s)

   

   i expect the output to be ['abc'] however it gives me only the last
   single character in the group: ['c']

   C:\testpython retest.py
   ['c']

   can anyone point out why this is occurring?  i can capture the entire
   group by doing this:

   rx_test = re.compile('/x([^x]+)*x/')
   but why isn't the 'star' grabbing the whole group?  and why isn't each
   letter 'a', 'b', and 'c' present, either individually, or as a group
   (group is expected)?

   any clarification is appreciated!

   sincerely,
   proctor

  As Josiah already pointed out, the * needs to be inside the grouping
  parens.

  Since re's do lookahead/backtracking, you can also write:

  rx_test = re.compile('/x(.*?)x/')

  The '?' is there to make sure the .* repetition stops at the first
  occurrence of x/.

  -- Paul

 i am working through an example from the oreilly book mastering
 regular expressions (2nd edition) by jeffrey friedl.  my post was a
 snippet from a regex to match C comments.   every 'x' in the regex
 represents a 'star' in actual usage, so that backslash escaping is not
 needed in the example (on page 275).  it looks like this:

 ===

 /x([^x]|x+[^/x])*x+/

 it is supposed to match '/x', the opening delimiter, then

 (
 either anything that is 'not x',

 or,

 'x' one or more times, 'not followed by a slash or an x'
 ) any number of times (the 'star')

 followed finally by the closing delimiter.

 ===

 this does not seem to work in python the way i understand it should
 from the book, and i simplified the example in my first post to
 concentrate on just one part of the alternation that i felt was not
 acting as expected.

 so my question remains, why doesn't the star quantifier seem to grab
 all the data.  isn't findall() intended to return all matches?  i
 would expect either 'abc' or 'a', 'b', 'c' or at least just
 'a' (because that would be the first match).  why does it give only
 one letter, and at that, the /last/ letter in the sequence??

 thanks again for replying!

 sincerely,
 proctor- Hide quoted text -

 - Show quoted text -

Again, I'll repeat some earlier advice:  you need to move the '*'
inside the parens - you are still leaving it outside.  Also, get in
the habit of using raw literal notation (that is rslkjdfljf instead
of lsjdlfkjs) when defining re strings - you don't have backslash
issues yet, but you will as soon as you start putting real '*'
characters in your expression.

However, when I test this,

restr = r'/x(([^x]|x+[^/])*)x+/'
re_ = re.compile(restr)
print re_.findall(/xabxxcx/ /x123xxx/)

findall now starts to give a tuple for each comment,

[('abxxc', 'xxc'), ('123xx', 'xx')]

so you have gone beyond my limited re skill, and will need help from
someone else.

But I suggest you add some tests with multiple consecutive 'x'
characters in the middle of your comment, and multiple consecutive 'x'
characters before the trailing comment.  In fact, from my
recollections of trying to implement this type of comment recognizer
by hand a long time ago in a job far, far away, test with both even
and odd numbers of 'x' characters.

-- Paul

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


Re: regex question

2007-04-27 Thread proctor
On Apr 27, 8:26 am, Michael Hoffman [EMAIL PROTECTED] wrote:
 proctor wrote:
  On Apr 27, 1:33 am, Paul McGuire [EMAIL PROTECTED] wrote:
  On Apr 27, 1:33 am, proctor [EMAIL PROTECTED] wrote:
  rx_test = re.compile('/x([^x])*x/')
  s = '/xabcx/'
  if rx_test.findall(s):
  print rx_test.findall(s)
  
  i expect the output to be ['abc'] however it gives me only the last
  single character in the group: ['c']

  As Josiah already pointed out, the * needs to be inside the grouping
  parens.
  so my question remains, why doesn't the star quantifier seem to grab
  all the data.

 Because you didn't use it *inside* the group, as has been said twice.
 Let's take a simpler example:

   import re
   text = xabc
   re_test1 = re.compile(x([^x])*)
   re_test2 = re.compile(x([^x]*))
   re_test1.match(text).groups()
 ('c',)
   re_test2.match(text).groups()
 ('abc',)

 There are three places that match ([^x]) in text. But each time you find
 one you overwrite the previous example.

  isn't findall() intended to return all matches?

 It returns all matches of the WHOLE pattern, /x([^x])*x/. Since you used
 a grouping parenthesis in there, it only returns one group from each
 pattern.

 Back to my example:

   re_test1.findall(xabcxaaaxabc)
 ['c', 'a', 'c']

 Here it finds multiple matches, but only because the x occurs multiple
 times as well. In your example there is only one match.

  i would expect either 'abc' or 'a', 'b', 'c' or at least just
  'a' (because that would be the first match).

 You are essentially doing this:

 group1 = a
 group1 = b
 group1 = c

 After those three statements, you wouldn't expect group1 to be abc or
 a. You'd expect it to be c.
 --
 Michael Hoffman

ok, thanks michael.

so i am now assuming that either the book's example assumes perl, and
perl is different from python in this regard, or, that the book's
example is faulty.  i understand all the examples given since my
question, and i know what i need to do to make it work.  i am raising
the question because the book says one thing, but the example is not
working for me.  i am searching for the source of the discrepancy.

i will try to research the differences between perl's and python's
regex engines.

thanks again,

sincerely,
proctor

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


Re: getting rid of EOL character ?

2007-04-27 Thread Steven Howe

stef wrote:

hello,

In the previous language I used,
when reading a line by readline, the EOL character was removed.

Now I'm reading a text-file with CR+LF at the end of each line,
Datafile = open(filename,'r') 
line = Datafile.readline()


now this gives an extra empty line
print line

and what I expect that should be correct, remove CR+LF,
gives me one character too much removed
print line[,-2]

while this gives what I need ???
print line[,-1]

Is it correct that the 2 characters CR+LF are converted to 1 character ?
Is there a more automatic way to remove the EOL from the string ?

thanks,
Stef Mientki
  

 abcd = 'abcdedff . \n'
 abcd
'abcdedff . \n'
 print abcd
abcdedff .

* from string import strip*
 print abcd.strip()
abcdedff .
 a = abcd.strip()
 a
'abcdedff .'


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

Re: regex question

2007-04-27 Thread proctor
On Apr 27, 8:37 am, Duncan Booth [EMAIL PROTECTED] wrote:
 proctor [EMAIL PROTECTED] wrote:
  so my question remains, why doesn't the star quantifier seem to grab
  all the data.  isn't findall() intended to return all matches?  i
  would expect either 'abc' or 'a', 'b', 'c' or at least just
  'a' (because that would be the first match).  why does it give only
  one letter, and at that, the /last/ letter in the sequence??

 findall returns the matched groups. You get one group for each
 parenthesised sub-expression, and (the important bit) if a single
 parenthesised expression matches more than once the group only contains
 the last string which matched it.

 Putting a star after a subexpression means that subexpression can match
 zero or more times, but each time it only matches a single character
 which is why your findall only returned the last character it matched.

 You need to move the * inside the parentheses used to define the group,
 then the group will match only once but will include everything that it
 matched.

 Consider:

  re.findall('(.)', 'abc')
 ['a', 'b', 'c']
  re.findall('(.)*', 'abc')
 ['c', '']
  re.findall('(.*)', 'abc')

 ['abc', '']

 The first pattern finds a single character which findall manages to
 match 3 times.

 The second pattern finds a group with a single character zero or more
 times in the pattern, so the first time it matches each of a,b,c in turn
 and returns the c, and then next time around we get an empty string when
 group matched zero times.

 In the third pattern we are looking for a group with any number of
 characters in it. First time we get all of the string, then we get
 another empty match.

thank you this is interesting.  in the second example, where does the
'nothingness' match, at the end?  why does the regex 'run again' when
it has already matched everything?  and if it reports an empty match
along with a non-empty match, why only the two?

sincerely,
proctor

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


Re: My python annoyances so far

2007-04-27 Thread Antoon Pardon
On 2007-04-27, Bruno Desthuilliers [EMAIL PROTECTED] wrote:
 7stud a écrit :
 [EMAIL PROTECTED] wrote:
 Annoyances:

 
 Every language has annoyances.  Python is no exception.  

 Sure. But we may disagree on what are actually Python's annoyances !-)

That is probably why the subject says: my annoyances

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


Re: How can I save command prompt screen

2007-04-27 Thread Steven Howe

ozan SARI wrote:

Hi ,
 
I  run  a  python  acript   with os.system('script.py')
 
I  want   save command prompt screen  in  a  text file (everything )   
how  can  I  do  this?
 
Thanks   for your  help
 
 
Ozan 
check out using the subprocess module 
http://docs.python.org/lib/node529.html subprocess%20module It seems 
to be the new
replacement for os.system spawn, popen  It has specific stdout, 
stderr and stdin handling.


sph

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

Accessing SQL View with Python

2007-04-27 Thread kyosohma
Hi All,

I need to access a Microsoft SQL database View. Is there a way to do
this with Python? I have done a fair share of googling and found
nothing on accessing Views, just executing SQL, which I already know
how to do.

I am running Windows XP, Python 2.4.

Thanks a lot!

Mike

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


Re: Accessing SQL View with Python

2007-04-27 Thread Tim Golden
[EMAIL PROTECTED] wrote:
 Hi All,
 
 I need to access a Microsoft SQL database View. Is there a way to do
 this with Python? I have done a fair share of googling and found
 nothing on accessing Views, just executing SQL, which I already know
 how to do.
 
 I am running Windows XP, Python 2.4.

Absolutely loads of ways. But (unless I'm missing
something here) they all involve executing SQL
which accesses a View (such as: SELECT * FROM v_info).
Have I missed the point of your question?

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


building _tkinter module with .NET 2005?

2007-04-27 Thread joshusdog
I have the Python 2.5.1 source and I'm trying to build the debug
version of the _tkinter module. I've got .NET 2005 (Visual Studio 8)
but the instructions in the pcbuild\readme.txt file only contain
instructions for using .NET 2003 (Visual Studio 7.1). There's another
readme.txt file under the pcbuild8 directory, but is almost identical
to the one in the pcbuild folder. (There's some information about some
new instrumented build settings, but that's about it)

The instructions contained in both these readme.txt files say that the
Tcl, Tk, and Tix projects must be built from the command line first,
using nmake.exe in conjunction with the corresponding makefile.vc for
each package. I can get this to work using .NET 2003, but not
with .NET 2005. Is there an updated set of instructions somewhere for
doing this with .NET 2005? Is it even possible to get it to work with
the newer version of .NET?

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


Re: Access to raw command line?

2007-04-27 Thread Pieter Edelman
Yes, but I want to make it less difficult for my end users, not more
difficult. I think the best is to require an extra switch for the
photo files, as some of the people here suggested.

On Apr 26, 6:27 pm, Grant Edwards [EMAIL PROTECTED] wrote:
 On 2007-04-26, Pieter Edelman [EMAIL PROTECTED] wrote:

  All your posts pretty much confirmed my own thoughts on this subject.
  Every option requires a specific action from the user, and as Bjoern
  points out, it would differ from what everybody is used to.  I think
  there's no trivial and reliable way to do this, so I can better leave
  it the way it is (at least for now).

 Quoting things on the command line that you don't want the
 shell to expand is trivial and reliable.  It's also something
 than any shell user should know.

 --
 Grant Edwards   grante Yow! I wonder if there's
   at   anything GOOD on tonight?
visi.com


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


Re: conditional print statement ?

2007-04-27 Thread Paul McGuire
On Apr 27, 9:45 am, Duncan Booth [EMAIL PROTECTED] wrote:
 Paul McGuire [EMAIL PROTECTED] wrote:
  The Enable/Disable decorators on the Python wiki (http://
  wiki.python.org/moin/PythonDecoratorLibrary?highlight=%28decorator
  %29#head-8298dbf9ac7325d9ef15e7130e676378bbbda572) help you do
  something very similar, without having to replicate the function being
  enabled/disabled.

  @(disabled,enabled)[Print_Info]
  def printOrNot(arg):
  print arg

 Pardon me for asking, but isn't that a syntax error? Decorator syntax is:

 @ dotted_name [( [argument_list [,]] )] NEWLINE

 and you don't have a dotted_name.

My bad.  The wiki example assigns the appropriate decorator to another
name, and then uses that name, like this:

debugFlag = int(False)
state = (disabled,enabled)[debugFlag]   # -- proper way to do this

@state
def debugPrint(s):
print s

print here comes some debug output
debugPrint(xyzzy is the secret word)
print that was it


I think early in the decorator syntax discussions, there were some
proposals that decorators could be expressions, but I guess I forgot
which way that was decided.  The example in this post does work (and
so does the one on the wiki) .

-- Paul

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


My newbie annoyances so far

2007-04-27 Thread Paul McGuire
Python is not VB and Python is not Java and Python is not Ruby and
Python is not any other language that is not Python.

1. Functions cannot be called without the parens (like in VB)

2. Python uses some naming conventions as programmer cues, such as
leading and trailing double-underscores to indicate some form of
specialness (I'm not overfond of relying on naming for this kind of
information encoding either, but I got used to it)

3. Python does not use braces to demarcate executable blocks of code,
or to define anonymous code blocks (like in Java, Ruby, or Smalltalk)

4. Python does not require every line of code to be enclosed within a
class (like in Java or Smalltalk)

5. Python does not do compile-time type checking on function arguments
or variable assignments (like in Java or C or C++) (yet... and will it
still be Python when it does?)

6. Python does not have interfaces to enforce object type
compatibility (like in Java)

Just because Python has features that are different from those in your
former language X does not mean it is deficient.  Python *might* be
deficient - ternary expressions are now part of the language after
years of refugees from C and C++ asking how to write a = b ? c : d,
and now they'll get to puzzle/gripe over mapping this to a = c if b
else d.  But as a newbie, you need to invest a little more time and
effort and study and reflection (collectively called experience)
before bandying about lists of personal gripes and reasons why Python
is annoying/stupid/sucks.  At least in public.  Actually, it might be
of value to keep your own personal list, and then revisit it a month
or a year later and see if the warts are still as offending to your
sensibilities as they originally were.

Newbies, please try to work with Python as it is for a bit.  Ask
questions when the documentation is unclear to you or the results of
your efforts confound you.  But please hold of on the reasons Python
sucks lists.  You might find that these deficiencies actually
translate into strengths.  Despite its warts, Python is being used
productively by at least several dozen people around the world, so it
must be good for *something*.

-- Paul

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


Re: regex question

2007-04-27 Thread Duncan Booth
proctor [EMAIL PROTECTED] wrote:

  re.findall('(.)*', 'abc')
 ['c', '']

 thank you this is interesting.  in the second example, where does the
 'nothingness' match, at the end?  why does the regex 'run again' when
 it has already matched everything?  and if it reports an empty match
 along with a non-empty match, why only the two?
 

There are 4 possible starting points for a regular expression to match in a 
three character string. The regular expression would match at any starting 
point so in theory you could find 4 possible matches in the string. In this 
case they would be 'abc', 'bc', 'c', ''.

However findall won't get any overlapping matches, so there are only two 
possible matches and it returns both of them: 'abc' and '' (or rather it 
returns the matching group within the match so you only see the 'c' 
although it matched 'abc'.

If you use a regex which doesn't match an empty string (e.g. '/x(.*?)x/' 
then you won't get the empty match.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Access to raw command line?

2007-04-27 Thread Pieter Edelman
Of course you're right about that. I think an optional GUI or wizard-
like interface (in this particular case) would be best, but I was
looking for an easy fix :) Thanks for the suggestion though.

On Apr 26, 5:25 pm, Michele Simionato [EMAIL PROTECTED]
wrote:
 On Apr 26, 9:04 am, Pieter Edelman [EMAIL PROTECTED] wrote:

  Hi,

  I'm currently writing a command-line program in Python, which takes
  commands in the form of:
  ./myprog.py [OPTIONS] ARGS

 Once you start having too many arguments and options on the command
 line, you might
 consider using the cmd module of the standard library instead. Then
 you could implement your own
 expansion, and you would have portability for non-Unix system too.

   Michele Simionato


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


use urllib library to have an upload status bar

2007-04-27 Thread shirish
Hi all,
 Before I start, please know that I'm no developer, just a user.
This is also a cross-post as I have tried to post the same at python-
bugs mailing list, just don't know if it gets in or not.

 We have a bug-reporting system in ubuntu called apport. Apparently
apport uses a python library called urllib. As of now, apport does a
bouncing bar while uploading which doesn't give the user idea as to
how much is being uploaded. Refer 
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/91521
. I did try to see if this issue has been addressed or not but came
nowhere. It would be nice to know if there are some solutions, or is
there a roadmap where this feature would be integrated in the library.
Looking forward to suggestions, additions, flames  constructive
criticism of the same. Keep up the good work. Cheers!

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


Re: regex question

2007-04-27 Thread proctor
On Apr 27, 8:50 am, Paul McGuire [EMAIL PROTECTED] wrote:
 On Apr 27, 9:10 am, proctor [EMAIL PROTECTED] wrote:



  On Apr 27, 1:33 am, Paul McGuire [EMAIL PROTECTED] wrote:

   On Apr 27, 1:33 am, proctor [EMAIL PROTECTED] wrote:

hello,

i have a regex:  rx_test = re.compile('/x([^x])*x/')

which is part of this test program:



import re

rx_test = re.compile('/x([^x])*x/')

s = '/xabcx/'

if rx_test.findall(s):
print rx_test.findall(s)



i expect the output to be ['abc'] however it gives me only the last
single character in the group: ['c']

C:\testpython retest.py
['c']

can anyone point out why this is occurring?  i can capture the entire
group by doing this:

rx_test = re.compile('/x([^x]+)*x/')
but why isn't the 'star' grabbing the whole group?  and why isn't each
letter 'a', 'b', and 'c' present, either individually, or as a group
(group is expected)?

any clarification is appreciated!

sincerely,
proctor

   As Josiah already pointed out, the * needs to be inside the grouping
   parens.

   Since re's do lookahead/backtracking, you can also write:

   rx_test = re.compile('/x(.*?)x/')

   The '?' is there to make sure the .* repetition stops at the first
   occurrence of x/.

   -- Paul

  i am working through an example from the oreilly book mastering
  regular expressions (2nd edition) by jeffrey friedl.  my post was a
  snippet from a regex to match C comments.   every 'x' in the regex
  represents a 'star' in actual usage, so that backslash escaping is not
  needed in the example (on page 275).  it looks like this:

  ===

  /x([^x]|x+[^/x])*x+/

  it is supposed to match '/x', the opening delimiter, then

  (
  either anything that is 'not x',

  or,

  'x' one or more times, 'not followed by a slash or an x'
  ) any number of times (the 'star')

  followed finally by the closing delimiter.

  ===

  this does not seem to work in python the way i understand it should
  from the book, and i simplified the example in my first post to
  concentrate on just one part of the alternation that i felt was not
  acting as expected.

  so my question remains, why doesn't the star quantifier seem to grab
  all the data.  isn't findall() intended to return all matches?  i
  would expect either 'abc' or 'a', 'b', 'c' or at least just
  'a' (because that would be the first match).  why does it give only
  one letter, and at that, the /last/ letter in the sequence??

  thanks again for replying!

  sincerely,
  proctor- Hide quoted text -

  - Show quoted text -

 Again, I'll repeat some earlier advice:  you need to move the '*'
 inside the parens - you are still leaving it outside.  Also, get in
 the habit of using raw literal notation (that is rslkjdfljf instead
 of lsjdlfkjs) when defining re strings - you don't have backslash
 issues yet, but you will as soon as you start putting real '*'
 characters in your expression.

 However, when I test this,

 restr = r'/x(([^x]|x+[^/])*)x+/'
 re_ = re.compile(restr)
 print re_.findall(/xabxxcx/ /x123xxx/)

 findall now starts to give a tuple for each comment,

 [('abxxc', 'xxc'), ('123xx', 'xx')]

 so you have gone beyond my limited re skill, and will need help from
 someone else.

 But I suggest you add some tests with multiple consecutive 'x'
 characters in the middle of your comment, and multiple consecutive 'x'
 characters before the trailing comment.  In fact, from my
 recollections of trying to implement this type of comment recognizer
 by hand a long time ago in a job far, far away, test with both even
 and odd numbers of 'x' characters.

 -- Paul

thanks paul,

the reason the regex now give tuples is that there are now 2 groups,
the inner and outer parens.  so group 1 matches with the star, and
group 2 matches without the star.

sincerely,
proctor

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


editing scripts on a mac

2007-04-27 Thread Steve Holden
I am teaching someone Python by email, and part of our conversation 
recently ran as follows:

him How do I save a script and run it?

me  Do you have a text editor? If so, edit the script in that, then 
save it
me  in your home directory (the place you can see when you open the 
terminal

him I do not have a text editor, but here are the answers to
him questions 1-5.

Now, frankly, I don't think this answer is correct, since I know OS X is 
a UNIX derivative, but I am loathe to involve a programming noob with vi 
or something similar. So I wondered if one of the c.l.py mac users could 
give brief instructions for firing up a visual text editor of some sort 
and saving a file somewhere it can easily be accessed from a terminal 
window (which I presume starts up in his home directory).

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

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


Re: My newbie annoyances so far

2007-04-27 Thread John Nagle
Paul McGuire wrote:
 Python is not VB and Python is not Java and Python is not Ruby and
 Python is not any other language that is not Python.

 As someone who's written in too many programming languages over
a long career, I'm quite pleased with Python as a programming
language.  It's straightforward to write, has few irregularities,
and has good run-time error semantics.

 The weak points in Python are implementation issues.
Sockets, HTTP access, SSL, and database access are all
flakier than they should be for such common capabilities.
The CPython implementation is unreasonably slow compared
to good implementations of other dynamic languages such
as LISP and JavaScript.

 But really, the language is in good shape.  I'd rather
have a faster implementation of Python 2.5 than anything
being proposed as a language change.

John Nagle

(P.S. PEP 3117 is a joke, right?)
-- 
http://mail.python.org/mailman/listinfo/python-list


Learning to use wxPython

2007-04-27 Thread KDawg44
Hi,

I downloaded the wxPython demo and did an emerge wxpython (gentoo) to
install.  When I run the demo, I am getting this error:


# python demo.py
Traceback (most recent call last):
  File /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/
_misc.py, line 1286, in Notify
self.notify()
  File /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/
_core.py, line 13637, in Notify
self.result = self.callable(*self.args, **self.kwargs)
  File /root/wxPython Demo/wxPython-2.8.3.0/demo/Main.py, line 1798,
in ShowMain
frame = wxPythonDemo(None, wxPython: (A Demonstration))
  File /root/wxPython Demo/wxPython-2.8.3.0/demo/Main.py, line 1275,
in __init__
self.filter = wx.SearchCtrl(leftPanel)
AttributeError: 'module' object has no attribute 'SearchCtrl'

What am I doing wrong?

Thanks.

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


Re: Accessing SQL View with Python

2007-04-27 Thread kyosohma
On Apr 27, 10:29 am, Tim Golden [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  Hi All,

  I need to access a Microsoft SQL database View. Is there a way to do
  this with Python? I have done a fair share of googling and found
  nothing on accessing Views, just executing SQL, which I already know
  how to do.

  I am running Windows XP, Python 2.4.

 Absolutely loads of ways. But (unless I'm missing
 something here) they all involve executing SQL
 which accesses a View (such as: SELECT * FROM v_info).
 Have I missed the point of your question?

 TJG

I figured there was. And yes, I knew you'd need to use SQL to get at
the View. I just re-ran it and discovered that I am quite good at
typos. I corrected the SQL and it seems to be working now.

Thanks for the help.

Mike

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


Re: Learning to use wxPython

2007-04-27 Thread Michele Petrazzo
KDawg44 wrote:
 Hi,
 
Hi,

 I downloaded the wxPython demo and did an emerge wxpython (gentoo) to
  install.  When I run the demo, I am getting this error:
 
 
 # python demo.py Traceback (most recent call last): File
 /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/ _misc.py,
 line 1286, in Notify

 From here, I read that you are using the wx version 2.6 and the demo
that you are tring are for the 2.8.3! (the last as now).
So:
1) install the new 2.8
2) download the demo for the 2.6! :)

Bye,
Michele
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: editing scripts on a mac

2007-04-27 Thread Tommy Grav
 him I do not have a text editor, but here are the answers to
 him questions 1-5.

 Now, frankly, I don't think this answer is correct, since I know OS  
 X is
 a UNIX derivative, but I am loathe to involve a programming noob  
 with vi
 or something similar. So I wondered if one of the c.l.py mac users  
 could
 give brief instructions for firing up a visual text editor of some  
 sort
 and saving a file somewhere it can easily be accessed from a terminal
 window (which I presume starts up in his home directory).

I think emacs is bundled with OS X and can be started in a terminal
window with emacs. If you want a non-terminal editor Aquaemacs
(http://aquamacs.org/) is available and easily installed on mac.

Cheers
 Tommy



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


Re: My newbie annoyances so far

2007-04-27 Thread Michael Hoffman
John Nagle wrote:

 (P.S. PEP 3117 is a joke, right?)

Note date of creation.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: editing scripts on a mac

2007-04-27 Thread Thomas Nelson
On Apr 27, 11:37 am, Tommy Grav [EMAIL PROTECTED] wrote:
  him I do not have a text editor, but here are the answers to
  him questions 1-5.

  Now, frankly, I don't think this answer is correct, since I know OS  
  X is
  a UNIX derivative, but I am loathe to involve a programming noob  
  with vi
  or something similar. So I wondered if one of the c.l.py mac users  
  could
  give brief instructions for firing up a visual text editor of some  
  sort
  and saving a file somewhere it can easily be accessed from a terminal
  window (which I presume starts up in his home directory).


1) Open Finder, click Applications, and open TextEdit.
2) hit shift-apple-T, or select Format - Make Plain Text,  to put you
in plaintext mode (It's .rtf by default)
3) Make sure you save in the home directory (usually a picture of a
house).

HTH,
Tom

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


Re: editing scripts on a mac

2007-04-27 Thread Tommy Nordgren

On 27 apr 2007, at 18.08, Steve Holden wrote:

 I am teaching someone Python by email, and part of our conversation
 recently ran as follows:

 him How do I save a script and run it?

 me  Do you have a text editor? If so, edit the script in that, then
 save it
 me  in your home directory (the place you can see when you open the
 terminal

 him I do not have a text editor, but here are the answers to
 him questions 1-5.

 Now, frankly, I don't think this answer is correct, since I know OS  
 X is
 a UNIX derivative, but I am loathe to involve a programming noob  
 with vi
 or something similar. So I wondered if one of the c.l.py mac users  
 could
 give brief instructions for firing up a visual text editor of some  
 sort
 and saving a file somewhere it can easily be accessed from a terminal
 window (which I presume starts up in his home directory).

 regards
   Steve
Text Wrangler (www.barebones.com) and Alpha/Tk
are both excellent GUI programmers editors that run on Mac.
Alpha/Tk is open-sourced as well

--
What is a woman that you forsake her, and the hearth fire and the  
home acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the  
Dane women
Tommy Nordgren
[EMAIL PROTECTED]



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


Re: use urllib library to have an upload status bar

2007-04-27 Thread Larry Bates
shirish wrote:
 Hi all,
  Before I start, please know that I'm no developer, just a user.
 This is also a cross-post as I have tried to post the same at python-
 bugs mailing list, just don't know if it gets in or not.
 
  We have a bug-reporting system in ubuntu called apport. Apparently
 apport uses a python library called urllib. As of now, apport does a
 bouncing bar while uploading which doesn't give the user idea as to
 how much is being uploaded. Refer 
 https://bugs.launchpad.net/ubuntu/+source/apport/+bug/91521
 . I did try to see if this issue has been addressed or not but came
 nowhere. It would be nice to know if there are some solutions, or is
 there a roadmap where this feature would be integrated in the library.
 Looking forward to suggestions, additions, flames  constructive
 criticism of the same. Keep up the good work. Cheers!
 

the generic http browser upload doesn't give you any opportunity to
have a callback so you can update the screen with any progress.
There are some Java solutions available, but IMHO it will take a
major change to browser's http upload implementation to make this
possible.

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


Re: Correct behavior?

2007-04-27 Thread Mitja Trampus
[EMAIL PROTECTED] wrote:
 On Apr 26, 8:34 pm, asker [EMAIL PROTECTED] wrote:
 But: print %15.2f % a+b

 Traceback (most recent call last):
   File stdin, line 1, in module
 TypeError: cannot concatenate 'str' and 'float' objects

 Is this correct for Python to issue this error?
 
 The % operator has higher precedence than +.  Thus, %15.2f % a+b ==
 (%15.2f % a)+b, an illegal str+float addition.

Just as a warning:
If you're not expecting this behavior, you can get a pretty 
  nasty surprise if the adddition in question is str+str and 
the operation becomes legal (but semantically different):

s1 = Captain 
s2 = Bertorelli
print Ah, %s! Welcome to my humble cafe... % s1+s2

-- Ah, Captain ! Welcome to my humble cafe...Bertorelli

Of course this can (and should) be avoided using 
...%s%s... % (s1,s2), but I know it has bitten me once.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Rational numbers

2007-04-27 Thread M.-A. Lemburg
On 2007-02-23 16:35, Martin Manns wrote:
 Hi,
 
 I am starting to use rationals and since I found no batteries included,
 I tried out the mxNumber package.
 
 However, I get strange warnings on comparison operations
 (which however seem to yield correct results):
 
 ---
 $ python
 Python 2.4.3 (#1, Jan 15 2007, 15:46:19) 
 [GCC 4.1.1 (Gentoo 4.1.1-r3)] on linux2
 Type help, copyright, credits or license for more information.
 from mx.Number import *
 a=Rational(0,1)
 a
 0/1
 str(a)
 '0.0'
 b=-50
 b
 -50L
 a==b
 __main__:1: RuntimeWarning: tp_compare didn't return -1, 0 or 1
 False
 ---
 
 How do I get rid of these warnings?

FYI: The next version of mxNumber will have this warning removed.

 Is there any rational number library around that
 1) is comparably fast for large denominators
 2) allows deriving types from Rationals without wrapping?
 
 Regards
 
 Martin
 
 P.S. The respective mailing list does not like me, so that I try my
 luck here.

Why is that ? The egenix-user mailing is open for all our users.
We do require registration to stop spam from reaching the list.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Apr 27 2007)
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My newbie annoyances so far

2007-04-27 Thread John Nagle
Dennis Lee Bieber wrote:
 On 27 Apr 2007 08:34:42 -0700, Paul McGuire [EMAIL PROTECTED]
 declaimed the following in comp.lang.python:
 
 
deficient - ternary expressions are now part of the language after
years of refugees from C and C++ asking how to write a = b ? c : d,
and now they'll get to puzzle/gripe over mapping this to a = c if b
else d.  But as a newbie, you need to invest a little more time and
 
 
   And I'll probably ignore those expressions whenever I do get around
 to 2.5+... That syntax, in my mind, just... stinks...

ALGOL used expression IF; you could write

x := (IF a  b THEN a ELSE b);

but that doesn't map well to an indentation-based language.

A syntax suitable for Python, now that there's a bool type, might
be to define .if() for bool.  Then one could write

(a  b).if(a,b)

which is better than adding an operator.

Such things are useful in formatting expressions.

msg = 'Unit is %s' % (unitstatus.if(on,off),)

but not really essential.

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


Re: http pipelining

2007-04-27 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 Which python module is capable of  pipelining http requests?
 
 (I know httplib can send mulitple requests per tcp connection, but in
 a strictly serial way. )
 
Oops, sorry, you meant sending requests in parallel, right?

You'll need to use either urllib or urllib2 for the web, and the 
threading module is one way to run parallel requests. It's fairly easy 
to use as long as you keep your tasks properly isolated form each other.

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

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


Re: http pipelining

2007-04-27 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 Which python module is capable of  pipelining http requests?
 
 (I know httplib can send mulitple requests per tcp connection, but in
 a strictly serial way. )
 
 
There's nothing in the standard library, I believe, that includes both 
client and server functionality in the same module. So you would need to 
glue them together.

If you want a simple net proxy server I seem to remember the chameleon 
system allows you to write one in about twelve lines. If it has to be 
HTTP-specific, with header parsing and the like, you might want to think 
about Twisted, which supports both client and server functionality and 
tries to make it easy to plumb things together in pipelines.

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

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


Re: Learning to use wxPython

2007-04-27 Thread KDawg44
On Apr 27, 11:25 am, Michele Petrazzo
[EMAIL PROTECTED] wrote:
 KDawg44 wrote:
  Hi,

 Hi,

  I downloaded the wxPython demo and did an emerge wxpython (gentoo) to
   install.  When I run the demo, I am getting this error:

  # python demo.py Traceback (most recent call last): File
  /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/ _misc.py,
  line 1286, in Notify

  From here, I read that you are using the wx version 2.6 and the demo
 that you are tring are for the 2.8.3! (the last as now).
 So:
 1) install the new 2.8
 2) download the demo for the 2.6! :)

 Bye,
 Michele

ahhhmy badi did not realize that.  Thanks!

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


  1   2   >