the lockfile. Convert the os.open file
# descriptor into a Python file object and record our PID in it
f = os.fdopen(fd, w)
f.write(%d\n % os.getpid())
f.close()
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
In article [EMAIL PROTECTED],
Jim Segrave [EMAIL PROTECTED] wrote:
except OSError, e:
if e.errno != errno.EEXIST:
this should read:
if e.errno != errno.ENOENT:
(it was left with EEXIST from testing this code by forcing an error,
as the code for this failure
.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
calls with the
same argument.
The += version finds the object to be operated upon once, the expanded
version does it twice.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
, but not Python's, support (?-flag) and this
allows turning the flag off and on for parts of the regex.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
counters as
in the quoted posting.
For Python 2.4 and later, you can replace the keyz =
counts.keys()/keyz.sourt() for k in keyz: with
for k in sorted(counters.heys()):
print k, counters[k]
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
which can detect this situation
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
application simply stops transmitting new
commands after a timeout? Do you eventually get all the responses in?
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
was to have a post-install CD or floppy which
fetched standard server configuration data. This included an ssh
public key for our ssh-key distribution, so after running the
post-install disc, we could push out staff ssh-keys and logins were
available.
--
Jim Segrave ([EMAIL PROTECTED
ColumnReportTemplate:
This class allows one to specify column oriented output formats.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
right string
Result: right string %6s short right string %1s
Testing: escaped chars \ \.## \\ \\
Result: escaped chars \#%3d \#%6.2f \\%-3s \\%-3s
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
included into.translate(trans_table)
prints:
I dOn't knOw, bUt cAn bE thIs fEAtUrE InclUdEd IntO
That more than addresses your requirements, as it can do multiple
character substitutions multiple times in one call.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman
.
Pyparsing's project wiki is at http://pyparsing.wikispaces.com.
If fails for floats specified as ###. or .###, it outputs an integer
format and the decimal point separately. It also ignores \# which
should prevent the '#' from being included in a format.
--
Jim Segrave ([EMAIL PROTECTED
In article [EMAIL PROTECTED],
Paul McGuire [EMAIL PROTECTED] wrote:
Jim Segrave [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
In article [EMAIL PROTECTED],
Paul McGuire [EMAIL PROTECTED] wrote:
Not an re solution, but pyparsing makes for an easy-to-follow program.
TransformString
In article [EMAIL PROTECTED],
Paul McGuire [EMAIL PROTECTED] wrote:
Jim Segrave [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I can see that the OP omitted the concept of @||| centering, since the
Python string interpolation forms only support right or left justified
fields
of a large number of
string comparision algorithms. They should not be too difficult to
port to Python.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
great care to
avoid pathological cases.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
In article [EMAIL PROTECTED],
Tim Peters [EMAIL PROTECTED] wrote:
[Jim Segrave]
Actually, presorted lists are not a bad case for heapsort - it's quite
immune to any existing order or lack thereof,
Write a heapsort and time it. It's not a difference in O() behavior,
but more memory movement
),
bg = #%02x%02x%02x % ((row * 4 + col) * 16,
(row * 4 + col) * 16,
(row * 4 + col) * 16),
fg = #ff
).grid(row = row, column = col, sticky = NSEW)
root.mainloop()
--
Jim Segrave
' or an exception in his solution,
it's a simple if statement at the start of the function.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
the more common test, to see if the elements of a sequence are
identical at the time of comparision need a new operator or hand
coding, since most of the time programmers aren't interested in future
equality or not of the structures.
--
Jim Segrave ([EMAIL PROTECTED])
--
http
there
- that's what == does.
If you really think there's a need for a comparision which includes
dealing with aliasing, then it seems to me a python module with a
set of functions for comparisions would make more sense.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman
interval.py
[3, 6, 7, 8, 12, 13, 15] = [[3, 4], [6, 9], [12, 14], [15, 16]]
[3] = [[3, 4]]
[] = []
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
==0:
tmp = val
valinc = val + 1
elif val != valinc:
yield [tmp, valinc]
tmp = val
valinc = val+1
yield [tmp, valinc]
it now works, but returns [0, 0] when passed an empty list, when it
should return nothing at all
--
Jim
= val+1
yield [tmp, valinc]
Still fails when passed an empty list, the initial assignment to tmp
is an IndexError
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
= val
...elif val != valinc:
...yield [tmp, valinc]; tmp = val
...valinc = val+1
...yield [tmp, valinc]
...
list(interv2(inlist))
[[3, 4], [6, 9], [12, 14], [15, 16]]
Fails on an empty list, as tmp is not defined when it hits the yield
--
Jim
__iter__(self):
self.file.seek(0)
while True:
line = self.file.readline()
if line == '': raise StopIteration
nextpos = self.file.tell()
yield line
self.file.seek(nextpos)
--
Jim Segrave ([EMAIL PROTECTED])
--
http
In article [EMAIL PROTECTED],
softwindow [EMAIL PROTECTED] wrote:
[some context restored]
Sometimes you add records but the size of the database does not
change... :-)
really
in which case?
whenever the database is big enough to add them without it's having to
grow :)
--
Jim Segrave
mean the input is
London|country/uk/region/europe/geocoord/32.3244,42.1221244
and you want to convert it to:
London|country/uk/region/europe/geocoord/32.32,42.12
then the above regex will work
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python
in
transit/
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
program normally closes stdin/stdout/stderr
and disconnects from its controlling terminal, so where is its output
going?
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
/Python/Recipe/442500
(see the notes, the demonstration program doesn't work correctly on
Windows, because I forgot the directory separator is a '\'. But the
code itself works to create cascading auto-pop-up menus, or any other
widget you want to pop-up as part of a menu.
--
Jim Segrave
the To: CC: and or Bcc:
headers are empty.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
1
bcc 0 1
...
So the answere is, that it's not required to have any destinations
listed in the headers of the message.
It appears that it's not kosher to have an empty To: header, though
I think that few MUAs will balk at this
--
Jim Segrave ([EMAIL
12: 2 38.75
13: 7 33.50
14: 8 27.50
15: 30 11.75
16: 1 11.50
17: 8 11.75
18: 40 19.75
19: 8 14.25
For all but the first 3 rows, the third column is the average of the
values in the 2nd column for this and the preceding 3 rows.
--
Jim Segrave ([EMAIL PROTECTED
for strings
containing one space or empty strings. Tab characters and multi-spaces
would not match.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
%s set col1 = %%s, col2 = %%s, col3=%%s % (sometable), \
['the', 'cat', 'in the hat'])
Note the need to double the %'s for the parameters to be bound.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
sales
were insufficient to persuade O'Reilly to do an update. As we use Exim
heavily, we have both the 3 and 4 books in our NOC, as well as sending
almost all new staff to Phil Hazel's excellent courses in Cambridge.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org
use eail and do so incorrectly
is astounding and depressing. There's a reason that the source for
sendmail is about 120K lines, exim is nearly 270K lines. Doing it
right is _hard_.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
of the various os.wait functions in the parent to retrieve it.
or
create a pipe before forking and you can pass data back and forth
between the parent and child
or
look at one of the shared memory libraries
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman
newText = filehandle.readline()
textBox.insert(END, newText)
tkinter.createfilehandler(fh, tkinter.READABLE, readfh)
root.mainloop()
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
, z_price) )
I hate to ask, but what happens when I enter a, b, c);DROP DATABASE; as
the entry for z_name? (Or some similar attempt to close the
SQL statement and start a new one). I think you want to google for SQL
injection and think about sanitising user input a bit.
--
Jim Segrave
until the data has been put on
the wire and acknowledged before there's space for the writes.
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
This is impossible, but it happened
b = Checkbutton(root, text = 'Press Me', command = check, variable = v)
b.grid(row = 0, column = 0)
root.mainloop()
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
)
root.mainloop()
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
for a SIGINT, the
second copy prints nothing. Killing the first copy prints OK on the
second one
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
for r in range(0, 9, 3):
print [%s] * 3 % tuple (board[r : r + 3])
print
else:
print Tie
--
Jim Segrave ([EMAIL PROTECTED])
--
http://mail.python.org/mailman/listinfo/python-list
48 matches
Mail list logo