ing to search for...
ctypes.pythonapi.PyThreadState_SetAsyncExc
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
major-mode. Syntax colouring, indentation
that sort of thing. There is also IM-Python for code navigation, and
bycycle repair man for refactoring support. You can run stuff at the
interactive python prompt from within emacs.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
7;m just learning!).
http://www.wxpython.org/maillist.php
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
appropriate maps for
the modern computing language territory.
I was born and bred on flow charts and I admit they were useful back
in the days when I wrote 1000s of lines of assembler code a week.
Now-a-days a much better map for the the territory is pseudo-code.
Python is pretty much executable pseudo-
def __str__(self):
return "%s(%s)" % (self.__class__.__name__, self.value)
a = NumX(4)
b = NumX(2)
print a,b
print a+b
print (a+b)/2
This prints
Nu
*
resource.getpagesize()
...
>>> print memory_used()
4575232
>>> a=1000*"x"
>>> print memory_used()
14577664
>>>
If anyone knows a (unix) portable way of doing this I'd be interested!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
>>>
You can then add to attributes in the subclasses
class MagicCharacter(Character):
attributes = Character.attributes | set(['spells', 'wand'])
>>> MagicCharacter('name', strength=10, dexterity=5, intelligence=3,
luck=0, spells=1)
QT licence, but
we decided we didn't want to have to incurr the additional expense of
renewing it.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
7;hello')
>>> random.shuffle(L)
>>> L
array('c', 'elohl')
>>> L.tostring()
'elohl'
Which is some way towards a mutable string...
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Christophe <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood a écrit :
> > There is also PyQT which we wrote off as we wanted to write commercial
> > applications too. As it happens we have a commercial QT licence, but
> > we decided we didn't want to have to
look a lot nicer
Eg debian
ii gtk2-engines-gtk-qt 0.7-1 theme engine using Qt for GTK+ 2.x
You get a control panel for GTK apps in the KDE control center also.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
pexpect has a timeout parameter exactly for this case
import os, pexpect, threading
def runyes():
print "Running yes command..."
pexpect.run('yes', timeout=5)
t = threading.Thread(target=runyes)
t.start()
t.join()
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ogram can then either poll the
global flag, or use sem_wait() and sem_trywait() on the semaphore.
Another option is to do nothing in the signal handler, and dedicate
one thread (preferably the initial thread) to wait synchronously for
signals, using sigwait(), and send messages to the other t
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood wrote:
>
> > The only sensible things you can do from a signal handler is set a
> > global flag, or call sem_post on a semaphore, to record the delivery
> > of the signal. The remainder of the pr
es():
... print "Running yes command..."
... pexpect.run('yes', timeout=5)
...
>>> t = threading.Thread(target=runyes)
>>> t.start()
>>> Running yes command...
t.join()
[never returns]
I'd guess at differences between the pexpect versions. You could try
the pexpect from debian/testing easily enough I expect.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
helpful, eg
@echo off
set DEMOHOME=%CD%
set PYTHONHOME=%DEMOHOME%\Python24
set PYTHONPATH=%PYTHONHOME%;%DEMOHOME%\Demo\Python
set PYTHON=%PYTHONHOME%\python.exe
set PYTHONW=%PYTHONHOME%\pythonw.exe
set PATH=%PYTHONHOME%;%PATH%
start "Demo" "%PYTHONW%" "demo.pyw"
, []).append(process)
for process in self.by_pid.values():
try:
parent = self.by_pid[process.parent_pid]
#print "child",process
#print "parent",parent
parent.children.append(process)
ect
Create a temporary file with no directory entries.
Have a look at the functions in the tempfile module, mkstemp() in
particular (the posix way), or NamedTemporaryFile()
http://docs.python.org/lib/module-tempfile.html
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://
tell whether you have a copy or a
hardlink.
>>> import os
>>> file("z", "w").write("test")
>>> os.link("z", "z2")
>>> os.stat("z").st_ino
1685186L
>>> os.stat("z2").st_ino
1685186
our system, might copy the
> file.
The link(2) system call on linux never does that. Eg
>>> import os
>>> file("z", "w").write("test")
>>> os.link("z", "/dev/shm/z")
Traceback (most recent call last):
File "", line 1, in ?
OSError: [Errno 18] Invalid cross-device link
>>
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
closed'
bool indicating the current state of the file object. This is a
read-only attribute; the `close()' method changes the value. It
may not be available on all file-like objects.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ested #9a", True, 4, _test_time_limit,
"nested #9b", True, 5, _spin, 10)
_test_time_limit("nested #10", False, 7, _test_time_limit,
"nested #10a",False, 6, _test_time_limit,
"nested #10b",True, 5, _spin, 10)
#_test_time_limit("nested #11", False, 7, _test_time_limit,
# "nested #11a",True, 4, _test_time_limit,
# "nested #11b",False, 10, _spin, 5)
_test_time_limit("nested #12", False, 7, _test_time_limit,
"nested #12a",False, 6, _test_time_limit,
"nested #12b",False, 10, _spin, 5)
print "All tests OK"
test()
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
If you want 64 bit choose -m64, eg
echo <<'#END' >z.c
#include
int main(void)
{
printf("Hello\n");
return 0;
}
#END
gcc -c -m32 -o z32.o z.c
gcc -c -m64 -o z64.o z.c
file z*.o
gives
z32.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
z64
Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2006-07-03, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> > Alex Martelli <[EMAIL PROTECTED]> wrote:
> >> DarkBlue <[EMAIL PROTECTED]> wrote:
> >> > try for 10 seconds
> >> >if d
for y in range(3):
... a[x][y] = i
... i = i + 1
...
>>> print a[1][1]
5
>>> a[2][1] = 'hello'
>>> print a
[[1, 2, 3], [4, 5, 6], [7, 'hello', 9], [10, 11, 12]]
Numeric/scipy/numpy/whatever-it-is-called-today supports
multidimensional arrays too I think and that may be more appropriate
if you are doing heavy numerical work.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
p://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012
That releases the controlling terminal from your job and it exits
from the process group.
You could probably close / redirect stdin/out/err too. Search for
daemonize.py and you'll find a module which does all this.
--
o.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7aa9000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7aa5000)
/lib/ld-linux.so.2 (0x8000)
If there are any missing things then you need to re-install those
packages.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-woo
this using stdin
>>> cmds="""read A
... read B
... read C
... echo $C $B $A"""
>>> out = Popen(cmds, shell=True, stdin=PIPE)
>>> out.communicate("""one
... two
... three""")
three two one
(None, None)
>>>
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
es of the language, but
otherwise it is a solid book with lots of good stuff in. The section
on programming with TK is very good too - I keep coming back to that
section.
...
I'd recommend the first and the last from your list to start with,
"Dive into Python" and "Progr
user0m1.000s
sys 0m0.036s
$ time python2.4 -c pass
real0m0.015s
user0m0.008s
sys 0m0.007s
Over all I'm very impressed - it is great to have a new implemention
of Python. I'm not sure mono is showing it off to its full extent
though!
--
Nick Crai
svc/bin/dlltool --dllname python24.dll --def python24.def
--output-lib libpython2.4.a
# Move the files into the correct place
mv -i python24.dll python24.def libpython2.4.a /usr/i586-mingw32msvc/lib/
After that lot you can build python extensions with mingw under linux,
using -lpython2.4
--
Nick Cra
27;t help you there.
You want to tell distutils that the compiler is just gcc somehow and
takes the same options. Not sure how you do that.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
d like someone to tell me that PyQT, tkinter or PyGTK does
it all for me, but from my searching on the subject I doubt it is
going to be that easy!
Thanks
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
TheSeeker <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood wrote:
> > Does anyone have some hints / tips / experience with making a cross
> > platform systray icon? It should work on Windows, Gnome and KDE at
> > minimum.
> You might do a search for TaskBarIcon in th
N/Cookbook/Python/Recipe/475155
Thanks anyway
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Tim Golden <[EMAIL PROTECTED]> wrote:
> if os.path.isfile (filepath):
>print filepath
You might get a more accurate result using
os.access(filepath, os.X_OK)
instead of
os.path.isfile(filepath)
Which checks the file is executable
--
Nick Craig-Wood <[
Tim Golden <[EMAIL PROTECTED]> wrote:
> [Nick Craig-Wood]
>
> | Tim Golden <[EMAIL PROTECTED]> wrote:
> | > if os.path.isfile (filepath):
> | >print filepath
> |
> | You might get a more accurate result using
> |
> | os.
s return False for X_OK under
> Win32. I'm happy to submit the patch, but is it worth it?
Wouldn't returning X_OK as true if the file exists be more sensible?
Ie the file might be executable, you'll have to try it, rather than,
no this file is definitely not executable...
-
on-dev about what you've done
Thats what I've done in the past anyway!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ds just fine.
RSI is a complicated disease - there are lots of different forms of it
all caused by different things. You'll need some professional advice
to sort it out.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
)
which is nearly as neat as qw//, but not quite since the split() bit
comes at the end so it doesn't notify you that you have an array of
strings rather than a string.
I don't expect a replacement for %w{}, qw// to ever be added to
python, it is not the python way. And the python way is why I am now
a python programmer not a perl programmer!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
>
> > In python when making __slots__ or module.__all__ you end up typing
> > lists of objects or methods and they turn out like this which is quite
> > a lot of extra typ
Moreover match becomes a string method. No need for extra importing
> re and applying re.compile(). Both can be done in str.match() if
> necessary.
I'm happy with the re module. Having transitioned from perl to python
some time ago now, I find myself using many fewer regexps due to the
much better built in string methods of python. This is a good thing,
because regexps should be used sparingly and they do degenerate into
line noise quite quickly...
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
and .jar, and
openoffice and all of its many extensions.
If you are feeling really paranoid then encrypt it.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
n python.
http://svn.mythtv.org/trac/
A nice extra is that it is written in python.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
late to ''.
None is the traditional value to use for value not present, then you'd
get this for the function
def mainFunction(var, template=None):
if template is None:
template = 'base'
And this for the calling bit
if not_set_properly(template):
template = None
return mainFunction(var, template)
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
urn var * 2
>
But yes, defining a sentinel like this is a good idea.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
-th port?
Also are you running as adminstrator? You may need admin rights to
open a serial port under windows (I'm not sure).
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
eamonisation under unix.
I'm not sure how you do open stdout to /dev/null in python though!
I suspect something like this...
import posix
posix.close(1)
posix.open("/dev/null", posix.O_WRONLY)
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Tue, 28 Nov 2006 04:30:09 -0600, Nick Craig-Wood
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
> >
> > If you run this
> >
> > import os,sys,time
> > print
Mitja Trampus <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood wrote:
> > I'm not sure how you do open stdout to /dev/null in python though!
> > I suspect something like this...
> > import posix
> > posix.close(1)
> > posix.open("/dev/null",
quot;"
end_time = time() + timeout
output = ""
while time() < end_time:
try:
output += p.stdout.read(1024)
except IOError, e:
if e.errno != EAGAIN:
raise
return output
p.stdin.write("ls\n")
print read_output(p)
p.stdin.write("uname -a\n")
print read_output(p)
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
mkdir() works just like its C equivalent, see
> http://docs.python.org/dev/lib/os-file-dir.html:
>
> "Where it is used, the current umask value is first masked out."
>
> Use os.chmod() after os.mkdir() to get the desired permissions.
I think you meant use os.umask(0) befor
st'
Size: 4096Blocks: 8 IO Block: 4096 directory
Device: 806h/2054d Inode: 2453906 Links: 2
Access: (0770/drwxrwx---) Uid: ( 518/ ncw) Gid: ( 518/ ncw)
Access: 2006-12-02 09:48:04.0 +0000
Modify: 2006-12-02 09:48:04.0 +
Change: 2
os.mkdir() ?
>
> No, I didn't. What is the difference/advantage of that approach?
If you use use os.umask(0) then the os.mkdir(dir, perms) will create
the directory with exactly those permissions, no chmod needed.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Löwis <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood schrieb:
> > So it looks like python mkdir() is applying the umask where as
> > /bin/mkdir doesn't. From man 2 mkdir
>
> Actually, mkdir(1) has no chance to not apply the umask: it also
> has to us
or x in range(0,12):
(x + 3) & ~0x3
Which prints 0,4,4,4,4,8,8,8,8,12...
You could also consider the funky
x>>2<<2
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
o read the return code of the command and
its stderr both of which you'll need if you are programming
defensively!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
p://pexpect.sourceforge.net/
>>> import pexpect
>>> p = pexpect.spawn("python")
>>> p.expect(">>>")
0
>>> p.sendline("print 10\n")
10
>>> p.readline()
' print 10\r\n'
>>> p.readline()
'10\r\n&
uages like Python when used in a web environment.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
not
> limited to use the generic *args and **kw.
If you don't want to use a register() function on each class you could
introspect like this (untested) to make the registry :-
registry = {}
for obj in sys.modules[__name__].__dict__.values():
try:
if issubclass(obj, Base):
):
"""Quote all the metacharacters in the args for the unix shell"""
return " ".join([re.sub(r"([^A-Za-z0-9_])", r"\\\1", string) for string in
args])
>>> print quotemeta(['a', "'b", 'c'])
a \'b c
> (or better, subprocess.call).
A good idea!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
to lock up the kernel mode serial driver. If it does lock up it
is a driver bug.
Here you'll find a little program I wrote which, with the help of a
loopback connector, you can check your serial port out
http://www.craig-wood.com/nick/pub/cambert.exe
Run the program from a cmd prompt and it w
oes lock up it
is a driver bug.
Here you'll find a little program I wrote which, with the help of a
loopback connector, you can check your serial port out
http://www.craig-wood.com/nick/pub/cambert.exe
Run the program from a cmd prompt and it will tell you how to use it.
I've broken a lot
ent and accurate style -
this matches the next character which gets added back into the string.
>>> re.sub(r",([^\s])", r", \1", s)
'One, Two, Three, Four, File'
>>>
This shows a fundamental difference between the two methods
>>> t
not post the output.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
as overwritten.
Maybe it is a string you can identify... You'll also want to start
reading the gdb manual on breakpoints and watchpoints at this moment!
Find memory corruptions can be tricky and time consuming.
Valgrind can help also.
Good luck!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
oto err;
}
label[i] = xstrdup(item_cstr);
Py_DECREF(item);
item = 0;
[snip]
err:;
PyErr_Print();
out:;
if (value)
Py_DECREF(value);
if (item)
Py_DECREF(item);
return rc;
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
achine
generating all possible matches at each point.
Luckily the python regexp matcher is written in python, so you have
access to the state machine directly if you want.
Take a look at sre*.py in the python library and you might be able to
work out what to do! I had a brief look myself, and it
looked
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood wrote:
>
> > A regular expression matcher uses a state machine to match strings.
>
> unless it's the kind of regular expression matcher that doesn't use a
> state machine, like the one in Pyt
conversions by hand. It is a bit
tedious but a good editor with macros will let you fly through the
job. I used emacs.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
sys 0m0.068s
> # I used python2.5 and perl 5.8.6
Playing for the other side temporarily, this is nearly twice as fast...
$ time perl -lne 'print if m/destroy/oi' bigfile >pl.out
real0m0.133s
user0m0.120s
sys 0m0.012s
vs
$ time ./z.pl >pl.out.orig
pi in 0.1 seconds and 10,000 digits in 20 seconds.
"""
Standalone Program to calculate PI using python only
Nick Craig-Wood <[EMAIL PROTECTED]>
"""
import sys
from time import time
class FixedPoint
)
def pi_ferguson():
return 4*(3*arctan(_1/4) + arctan(_1/20) + arctan(_1/1985))
def pi_hutton():
return 4*(2*arctan(_1/3) + arctan(_1/7))
def pi_gauss():
return 4*(12*arctan(_1/18) + 8*arctan(_1/57) - 5*arctan(_1/239))
def pi_euler():
return 4*(5*arctan(_1/7) + 2*arctan(_3/79))
t?
You might want to check out this modification to subprocess which does
non-blocking pipes.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554
I personally think something like that should be built into subprocess
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.crai
n the class and the local variables. The compiler doesn't
warn about this - its perfectly legal C++.
In a lot of big C++ programs various conventions are used to try to
help with this - naming all parameters to functions _name rather than
name, or using this->member rather than member. T
c/2.4.2/lib/module-subprocess.html
You'll probably find threading easier though.
http://www.python.org/doc/2.4.2/lib/module-threading.html
But it will use your multiple CPUs less efficiently than fork()-ing.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
__(self):
# FIXME is there a way to convert a long to binary?
content = ""
if self.i:
L = []
i = self.i
while i:
L.append(int(i & 1L))
i >>= 1
L.reverse()
content = str(L)
luca72 <[EMAIL PROTECTED]> wrote:
> Thanks for your help, but it don't solve the problem.
> I receive only the echo and full stop.
Try swapping pins 2 and 3 in the lead.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/
Peter Hansen <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood wrote:
> > luca72 <[EMAIL PROTECTED]> wrote:
> >
> >> Thanks for your help, but it don't solve the problem.
> >> I receive only the echo and full stop.
> >
> > Try swapping
yfile","w")
>>> fn=fd.write
>>> fn.im_self
Traceback (most recent call last):
File "", line 1, in ?
AttributeError: 'builtin_function_or_method' object has no attribute 'im_self'
>>> fn.__self__
>>>
I wonder why?
Is there a canonical way of doing it?
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
d be a little better
> able to use them appropriately.
;-)
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
t; all the changes and be able to determine what parts of the code were
> changed.
>
> If it were opensource that would be even better.
You could try Mercurial
http://www.selenic.com/mercurial/
which aims at being a true bk replacement. Its also written in
python. Its being deve
10 0.39
11 0.4
12 0.4
13 0.39
14 0.4
15 0.4
16 0.39
17 0.4
18 0.39
19 0.41
Note the first iteration is slower as it builds the tuple cache
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
retched up to 4k and M_MMAP_THRESHOLD was set to 4k then
you'd have the perfect memory allocator...
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
rying to achieve and we
can see if we can come up with a more pythonic solution? The fact
that you are running into limits of the language like this as a new
python programmer probably means you aren't thinking in python yet.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
rceforge.net/
Doesn't work on windows. Looks like you are doing OS X though so
should work fine there
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
finished or not, and no way to wait
on more than one Process() at once.
If there is an exception then you should return it to the parent (see
the subprocess module for an example).
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
d
deliver SIGPIPE to the child which may (or may not) kill it. At least
it got some sort of notification.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
here some place I can
> submit this as a feature request? (Python dev?)
The non-blocking subprocess would make a good start for a stdlib
submission.
It should really optionally use ptys under unix too otherwise you'll
never be able to script passwd etc. An interface a bit like pexpect
wpuld be useful too (ie scan for these regexps or timeout and return a
match object).
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
oriented buffer. You don't want block buffering
> on interactive applications.
Pty's probably aren't needed on Windows.
BTW I'd love to see pexpect working on windows and also in the
standard library. It is the proper answer to controlling other
interactive processes IMHO.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
dmoore <[EMAIL PROTECTED]> wrote:
> On Jun 8, 12:30 pm, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> > Windows has a really strange idea of non-blocking IO - it uses
> > something called overlapped io. You or in the FILE_FLAG_OVERLAPPED
> > flag when you create
e()
>>> open('lock.txt').read()
'ho'
>>>
The best cross platform way to create a lock is creating a directory.
It is atomic on both windows and linux anyway.
try:
os.mkdir("lock")
except OSError:
print "locked!"
else:
try:
do_stuff()
finally:
os.rmdir("lock")
(untested)
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
You need flock under unix (this recipe shows windows flock equivalent also)
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
or use the directory idea I posted in another post.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ix locking method. Note that it may not
work if you are writing the lock file to an NFS mount!
Traditionally you write your os.pid() to the file also. You can then
send a signal to the running copy, detect stale lock files etc.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Tim Williams <[EMAIL PROTECTED]> wrote:
> On 18/06/07, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> On Windows the open-a-file-for-writing method works well, but as *nix
> doesn't work the same way then maybe the socket solution is the best
> cross-platform option
ch seperate "type"
a seperate class type and implement the methods for each one. All the
switches will disappear from your code like magic!
Post more details if you want more help!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ceforge.net/tracker/index.php?func=detail&aid=1163563&group_id=5470&atid=105470
> Is there any simple way to fix this damned bug??
Locking, locking and more locking ;-)
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
(defaults)
self._sections = odict()
self._defaults = odict()
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
3.jpg 4.jpg 01.pdf
Which resizes each image to a max dimension of 1000 pixels and then
tiles them into a PDF.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
1301 - 1400 of 1827 matches
Mail list logo