Re: Type-Def-ing Python

2006-04-27 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > Brett Cannon's thesis in which he tweaks the compiler and shows that > type-defing python would not help the compiler achieve a 5% performace > increase. > > Brett Cannon, "Localized Type Inference of Atomic Types in Python": > http://www.ocf.berkeley.edu/~bac/t

Re: Speed of shutil.copy vs os.system("copy src dest") in win32

2006-04-27 Thread Tim Roberts
"Russell Warren" <[EMAIL PROTECTED]> wrote: >I just did a comparison of the copying speed of shutil.copy against the >speed of a direct windows copy using os.system. I copied a file that >was 1083 KB. > >I'm very interested to see that the shutil.copy copyfileobj >implementation of hacking throug

Re: list of functions question

2006-04-27 Thread Tim Roberts
val bykoski <[EMAIL PROTECTED]> wrote: > >Hi The List: > I have a modeling app where i'm detecting events (in temporal >dynamics) applying a set of (boolean) functions - kind of: > >event_list = "f1 f2 etc".split() # each fi detects a specific event >i have defs for functions fi, or simple bool

Re: Importing modules through directory shortcuts on Windows

2006-04-27 Thread Roger Upole
You can use win32file.DeviceIoControl to link directories. I can post some code to do so if anyone's interested. Roger "Brian Quinlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Recently, I became responsible for maintaining some Python code, which was > organized as f

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, bruno at modulix <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> bruno at modulix <[EMAIL PROTECTED]> wrote: >> >> >>>Lawrence D'Oliveiro wrote: >>> >(snip) I suppose this is an instance of the more general rule:

RE: Speed of shutil.copy vs os.system("copy src dest") in win32

2006-04-27 Thread Tim Golden
[Russell Warren] | I just did a comparison of the copying speed of shutil.copy | against the | speed of a direct windows copy using os.system. I copied a file that | was 1083 KB. | | I'm very interested to see that the shutil.copy copyfileobj | implementation of hacking through the file and wri

Re: OOP / language design question

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Duncan Booth <[EMAIL PROTECTED]> wrote: >Carl Banks wrote: > >> You know, Python's __init__ has almost the same semantics as C++ >> constructors (they both initialize something that's already been >> allocated in memory, and neither can return a substitute object).

Re: OOP / language design question

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Carl Banks" <[EMAIL PROTECTED]> wrote: >bruno at modulix wrote: >> [EMAIL PROTECTED] wrote: >> > I was wondering, why you always have to remember to call bases' >> > constructors >> >> >> s/constructors/__init__/ >> >> the __init__() method is *not* the construct

Direct acces to db unify on unix sco

2006-04-27 Thread luca72
Is it possible or i must use odbc? Rergards Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Sandra-24 a écrit : >> Lawrence D'Oliveiro wrote: >> >>>In article <[EMAIL PROTECTED]>, >>> "Sandra-24" <[EMAIL PROTECTED]> wrote: >>> >>> Now that is a clever little trick. I never would have guessed you can >>>

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, bruno at modulix <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> bruno at modulix <[EMAIL PROTECTED]> wrote: >> >> >>>Lawrence D'Oliveiro wrote: >>>(snip) >>> I think you're taking Python's OO-ness too seriously.

Re: Can one query full name (or version) of selected packages at pypi?

2006-04-27 Thread Tim Golden
[Caleb Hattingh] > My big problem, being in South Africa, is > that I have to get any distros on cover CDs or order from > distro-resellers, and they never have Testing or Unstable. Broadband > hasn't exactly hit the local market, although things might be looking > up in a few years or so. I ha

Re: begging for a tree implementation

2006-04-27 Thread Ant
Did you not read the first post? > All the nice methods would be appreciated (getLeaves, isLeaf, isRoot, > depthfirst, breadthfirst,...) -- http://mail.python.org/mailman/listinfo/python-list

Re: Events in Python?

2006-04-27 Thread Ben Sizer
[EMAIL PROTECTED] wrote: > It seems like Python doesn't have a "standard" implementation of an > event or messaging system. That is really what I was curious about. I > wanted to check before I implemented something of my own. What are you comparing it to? Does Java have standard event or messagin

Re: not quite 1252

2006-04-27 Thread John Machin
On 27/04/2006 12:49 AM, Anton Vredegoor wrote: > Fredrik Lundh wrote: > >> Anton Vredegoor wrote: >> >>> I'm trying to import text from an open office document (save as .sxw and >>> read the data from content.xml inside the sxw-archive using >>> elementtree and such tools). >>> >>> The encoding t

Re: OOP / language design question

2006-04-27 Thread Duncan Booth
Lawrence D'Oliveiro wrote: >>In other words, the object is constructed in Python before any >>__init__ is called, but in C++ it isn't constructed until after all >>the base class constructors have returned. > > But if "construction" is what a constructor does, then you're wrong. > I may be wrong

RE: Importing modules through directory shortcuts on Windows

2006-04-27 Thread Tim Golden
[Roger Upole] | You can use win32file.DeviceIoControl to link directories. | I can post some code to do so if anyone's interested. I'd certainly be interested... Thanks TJG This e-mail has been scanned for all viruses by S

Re: Events in Python?

2006-04-27 Thread Ben C
On 2006-04-26, nikie <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> Here is another non-pythonic question from the Java Developer. (I beg >> for forgiveness...) >> >> Does Python have a mechanism for events/event-driven programming? >> >> I'm not necessarily talking about just GUIs eith

Re: Pyrex installation on windows XP: step-by-step guide

2006-04-27 Thread Julien Fiore
Thanks for your remark, Sturlamolden. Is there a free version of the "Visual C++ 2003" compiler available on the web? I have found "Visual C++ 2005 Express edition" (http://msdn.microsoft.com/vstudio/express/visualc/). According to Micrsoft, it replaces VC++2003 (http://msdn.microsoft.com/visualc/

RE: blob problems in pysqlite

2006-04-27 Thread Tim Golden
[EMAIL PROTECTED] | I'm trying to use cPickle.loads(data) (code attached), and I get a: | "TypeError: loads() argument 1 must be string, not list" | | Is there a workaround for this? I've tried converting the | List of files | to a String before cPickling it, but the same result (expected). OK,

Re: OOP / language design question

2006-04-27 Thread Carl Banks
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > "Carl Banks" <[EMAIL PROTECTED]> wrote: > > >bruno at modulix wrote: > >> [EMAIL PROTECTED] wrote: > >> > I was wondering, why you always have to remember to call bases' > >> > constructors > >> > >> > >> s/constructors/__init__/ > >

Re: list of functions question

2006-04-27 Thread John Machin
On 27/04/2006 10:38 AM, val bykoski wrote: > Hi The List: > I have a modeling app where i'm detecting events (in temporal > dynamics) applying a set of (boolean) functions - kind of: > > event_list = "f1 f2 etc".split() # each fi detects a specific event > i have defs for functions fi, or simp

Re: begging for a tree implementation

2006-04-27 Thread Ant
I was looking for a tree implementation a while back, but got no real pointers. Seems that there are no tree data model modules out there - which surprises me, since it is such a fundamental data structure. I ended up using a very basic tree data class - I didn't need all of the methods you mentio

Re: blob problems in pysqlite

2006-04-27 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: Excellent. Got that working. Now, how to get the pickled data out of the database? I'm trying to use cPickle.loads(data) (code attached), and I get a: "TypeError: loads() argument 1 must be string, not list" [...] [...] c.execute("select Images from FileURLInfo where URL

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-27 Thread bruno at modulix
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > >>Sandra-24 a écrit : >> >>>Lawrence D'Oliveiro wrote: >>> >>> In article <[EMAIL PROTECTED]>, "Sandra-24" <[EMAIL PROTECTED]> wrote: >Now that is a clever

Re: OOP / language design question

2006-04-27 Thread bruno at modulix
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > "Carl Banks" <[EMAIL PROTECTED]> wrote: > > >>bruno at modulix wrote: >> >>>[EMAIL PROTECTED] wrote: >>> I was wondering, why you always have to remember to call bases' constructors >>> >>> >>>s/constructors/__init__/ >>> >>>

Re: begging for a tree implementation

2006-04-27 Thread Diez B. Roggisch
> I may start a tree data structure project - it's something I've been > thinking about for a while, and now it's clear that it's not just me > who uses trees as data structures! Oh, people do use them. It's just to easy to cough one up when you need it - either as nested tuples, lists, dicts or a

Re: begging for a tree implementation

2006-04-27 Thread Fredrik Lundh
Diez B. Roggisch wrote: > This is not to discourage you - just don't expect people to greet you as the > next messiah who finally brought one of CS most fundamental data structures > to Python... :) xml.etree was added to Python 2.5 before christmas :-) -- http://mail.python.org/mailman/li

How to align the text of a Listbox to the right

2006-04-27 Thread Leonardo da Vinci
Greetings gentlemen and ladies, I have a question: in Tkinter, how to align a Listbox entry (i.e. a line of text) to the right? Google did not show up the answer to my request. Thanks very much. L -- http://mail.python.org/mailman/listinfo/python-list

Re: bug in modulus?

2006-04-27 Thread Christophe
[EMAIL PROTECTED] a écrit : > I think there might be something wrong with the implementation of > modulus. > > Negative float values close to 0.0 break the identity "0 <= abs(a % b) > < abs(b)". > > print 0.0 % 2.0 # => 0.0 > print -1e-010 % 2.0 # =>1.99 > > which is correct, but

can anyone advise me

2006-04-27 Thread micklee74
why the output of this code : x = 0 while x < 10: z = 0 print x x = x + 1 while z < x: print z, z = z + 1 is 0 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6

how to free the big list memory

2006-04-27 Thread kyo guan
Python version 2.4.3 >>> l=range(50*1024*100) after this code, you can see the python nearly using about 80MB. then I do this >>> del l after this, the python still using more then 60MB, Why the python don't free my memory? Is there any way to force the python free my memory? Thanks. Kyo.

Re: blob problems in pysqlite

2006-04-27 Thread aldonnelley
Woohoo! You rock, Gerhard. That's inspired. I'm sure I can sort this out now. Both you and Tim have been an enormous help. Cheers, Al. (Oh, and Tim: tip noted. I feel bad about not posting complete code- I do normally (not in python), but can't for this one. Thanks for wading your way through it

Re: help

2006-04-27 Thread NavyJay
For such a simple task, I would use MATLAB. http://www.mathworks.com/products/matlab/ However, if you have to do generic programming in addition to this, I would use Python with the libraries ImageMagick or Python Image Library (PIL). Just search for them and you'll have all the examples you need

Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-27 Thread conny . ledin
This is so great!!! I know i have alot of work left to do and i probobly wont make it in time which means that i can only get the grade E on the assignment... But at this stage it feels like ill be happy with any grade i get, just to have this behind me. Programming is apparently not my thing. It f

Re: how to free the big list memory

2006-04-27 Thread harold
pydoc gc.collect pydoc xrange -- http://mail.python.org/mailman/listinfo/python-list

Re: can anyone advise me

2006-04-27 Thread Dan Sommers
On 27 Apr 2006 02:48:46 -0700, [EMAIL PROTECTED] wrote: > why the output of this code : > x = 0 > while x < 10: > z = 0 > print x > x = x + 1 > while z < x: > print z, > z = z + 1 > is > 0 Okay, that was x, from the print statement

Re: can anyone advise me

2006-04-27 Thread Peter Otten
[EMAIL PROTECTED] wrote: > why the output of this code : > x = 0 > while x < 10: > z = 0 > print x > x = x + 1 > while z < x: > print z, > z = z + 1 > > is > > 0 > 0 1 > 0 1 2 > 0 1 2 3 > 0 1 2 3 4 > 0 1 2 3 4 5 > 0 1 2 3 4 5 6 > 0

Re: can anyone advise me

2006-04-27 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > why the output of this code : > x = 0 > while x < 10: > z = 0 > print x > x = x + 1 > while z < x: > print z, > z = z + 1 > > is > > 0 > 0 1 > 0 1 2 > 0 1 2 3 > 0 1 2 3 4 > 0 1 2 3 4 5 > 0 1 2 3 4 5 6 > 0 1

Re: can anyone advise me

2006-04-27 Thread looping
try something like this: x = 0 while x < 10: z = 0 print '-' + str(x) + '-' x = x + 1 while z < x: print '.' + str(z) + '.', z = z + 1 -- http://mail.python.org/mailman/listinfo/python-list

help

2006-04-27 Thread kalyanigoli
Hi! I am a new user to python. I want to draw a 2D graph with coordinates data as input. In the graph i want to fill some area and also include image maps. Can any one suggest which is the best library to use and some links for examples. Thanks in advance. Your help will be most appreciated.

[no subject]

2006-04-27 Thread carlosperezs
Hallo !!! I am new in Python and my doubts are basics.I would like to a window appears when press a button. This window would have only an advise. Therefore it would be a simple window. I don't know which window to choose. Thank you. --oOo

[no subject]

2006-04-27 Thread UMASANKAR LAKSHMANAN
hi, I want some simple program for : timer thread running program in timer thread how to get notified when program is closed Thanks in advance Regards Ums UMASANKAR L. 704-B, SHIVARANJANI APARTMENTS 213, NAGAPRABHA CHAMBERS ITI LAYOUT, BSK III STAGE 3rd MAIN, 4th CROSS NEAR

midipy.py on linux

2006-04-27 Thread Will Hurt
Hi Ive been using midipy in my blender3d python scripts on windowsXP, now im trying to run them from ubuntu and i cant find the midipy.py module compiled for linux anywhere. Is it possible to complie it under linux and how would i go about doing it --or-- Is there another module which does the sam

Re: can anyone advise me

2006-04-27 Thread micklee74
Dan Sommers wrote: > On 27 Apr 2006 02:48:46 -0700, > [EMAIL PROTECTED] wrote: > > > why the output of this code : > > x = 0 > > while x < 10: > > z = 0 > > print x > > x = x + 1 > > while z < x: > > print z, > > z = z + 1 > > > is >

Re: Inherit from array

2006-04-27 Thread TG
Hmm ... I'm definitely not a python wizard, but it seems to be quite a special case that breaks the rules ... unpythonic, isn't it ? Has anyone seen a PEP on this subject ? Just in case a troll reads this message : i'm not saying python sucks or has huge design flaws here ... -- http://mail.pyt

Re: begging for a tree implementation

2006-04-27 Thread Ant
Damn! Missed the boat ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: A QFB agent: how to catch C-level crashes and last Python stack ?

2006-04-27 Thread Thomas Heller
robert wrote: > When employing complex UI libs (wx, win32ui, ..) and other extension > libs, nice "only Python stack traces" remain a myth. > > Currently I'm hunting again a rare C-level crash bug of a Python based > Windows app with rare user reports - and still in the dark (I get > snippets o

Re: Packing a list of lists with struct.pack()

2006-04-27 Thread Fredrik Lundh
Panos Laganakos wrote: > What I don't understand is what are you doing with *(...), this is > supposed to pack its contents as a list? the *arg form treats each value in the arg sequence as a separate argument. for example, arg = 1, 2, 3 function(*arg) is the same thing as function

Re: MinGW and Python

2006-04-27 Thread sturlamolden
Martin v. Löwis wrote: > That's not how I read it. To me, it says: it can be used by other > parts of Windows itself (i.e. system-level components), but it is not > intended to be used by third-party applications (such as Python), > as these are not system-level components. That is correct. And

searching for an article on name-binding

2006-04-27 Thread Gerard Flanagan
Hello I'm trying to find a webpage I remember reading which contained a layman's description of how Python binds names to objects. It used some ASCII-art illustrations where an arrow represented a 'binding'. Anyone got a link for that? (Google's not my friend!) Thanks Gerard -- http://mail.pyt

Re: Inherit from array

2006-04-27 Thread bruno at modulix
TG wrote: > Hmm ... I'm definitely not a python wizard, but it seems to be quite a > special case that breaks the rules ... Yes and no. The primary use case for __new__ was to allow subclassing of immutable types. array.array is not immutable, but it's still a special case, in that it enforce typ

Re: searching for an article on name-binding

2006-04-27 Thread Fredrik Lundh
Gerard Flanagan wrote: > I'm trying to find a webpage I remember reading which contained a > layman's description of how Python binds names to objects. It used some > ASCII-art illustrations where an arrow represented a 'binding'. Anyone > got a link for that? (Google's not my friend!) http://www

urllib.urlopen() with pages that requires cookies.

2006-04-27 Thread Øyvind Østlund
I am trying to visit a limited amount of web pages that requires cookies. I will get redirected if my application does not handle them. I am using urllib.urlopen() to visit the pages right now. And I need a push in the right direction to find out how to deal with pages that requires cookies. Anyone

Re: MinGW and Python

2006-04-27 Thread sturlamolden
Martin v. Löwis wrote: > > Nonetheless, Cygwin applications are not generally considered native > > Win32 applications because of the dependency on CYGWIN1.DLL and the > > related environment. > - Is winword.exe not a native Win32 library because it uses "MSO.DLL"? > - A cygwin application does

Re: MinGW and Python

2006-04-27 Thread sturlamolden
Martin v. Löwis wrote: > > Nonetheless, Cygwin applications are not generally considered native > > Win32 applications because of the dependency on CYGWIN1.DLL and the > > related environment. > - Is winword.exe not a native Win32 library because it uses "MSO.DLL"? > - A cygwin application does

Re: can anyone advise me

2006-04-27 Thread egbert
On Thu, Apr 27, 2006 at 02:48:46AM -0700, [EMAIL PROTECTED] wrote: > why the output of this code : > x = 0 > while x < 10: > z = 0 > print x > x = x + 1 > while z < x: > print z, > z = z + 1 > > is > > 0 > 0 1 > 0 1 2 > 0 1 2 3 > 0 1

Re: MinGW and Python

2006-04-27 Thread sturlamolden
Martin v. Löwis wrote: > > Nonetheless, Cygwin applications are not generally considered native > > Win32 applications because of the dependency on CYGWIN1.DLL and the > > related environment. > - Is winword.exe not a native Win32 library because it uses "MSO.DLL"? > - A cygwin application does

Re: MinGW and Python

2006-04-27 Thread Gerhard Häring
sturlamolden wrote: > [...] The problem is actually *licensing issues* related to CYGWIN1.DLL. It > cannot always be linked. CYGWIN1.DLL can only be used for Open Source > development. [...] Of course Redhat offers an alternative license that does not have the GPL restrictions: http://www.redhat.

RELEASED Python 2.5 (alpha 2)

2006-04-27 Thread Anthony Baxter
On behalf of the Python development team and the Python community, I'm happy to announce the second alpha release of Python 2.5. This is an *alpha* release of Python 2.5. As such, it is not suitable for a production environment. It is being released to solicit feedback and hopefully discover bugs,

Unpacking a list of strings

2006-04-27 Thread Panos Laganakos
Is there some other practice than reading all the strings and slicing them later? They're stored in the form of: List Group[10]: char[17] name; So I thought of doing: unpacked = unpack('%s' % (10*17), data) And then slicing the list by a step of 17. Is there some way to have unpack return a

Re: print names of dictionaries

2006-04-27 Thread Philippe Martin
Hi, I do not know if there is a way to overload the instantiation of all objects in Python but I thought of something like this to fetch any object with its name: g_dict = {} def create_object (v,s): p = v g_dict[s] = id(p) return p #ex object = create_object ([1,2,3,4], 'A LIST') Ph

Re: print names of dictionaries

2006-04-27 Thread Philippe Martin
OK, totally dumb ! g_dict[s] = p Philippe Martin wrote: > Hi, > > I do not know if there is a way to overload the instantiation of all > objects in Python but I thought of something like this to fetch any object > with its name: > > g_dict = {} > > > def create_object (v,s): >p = v >

Re: list of functions question

2006-04-27 Thread Kent Johnson
val bykoski wrote: > Hi The List: >I have a modeling app where i'm detecting events (in temporal > dynamics) applying a set of (boolean) functions - kind of: > > event_list = "f1 f2 etc".split() # each fi detects a specific event > i have defs for functions fi, or simple boolean expressions

Re: can this be done without eval/exec?

2006-04-27 Thread Kent Johnson
Schüle Daniel wrote: > and now the obvious one (as I thought at first) > > >>> lst=[] > >>> for i in range(10): > ... lst.append(lambda:i) > ... > >>> lst[0]() > 9 > >>> i > 9 > >>> > > I think I understand where the problem comes from > lambda:i seems not to be fully evalutated > it jus

Re: How to align the text of a Listbox to the right

2006-04-27 Thread Eric Brunel
On 27 Apr 2006 02:35:50 -0700, Leonardo da Vinci <[EMAIL PROTECTED]> wrote: > Greetings gentlemen and ladies, > I have a question: in Tkinter, how to align a Listbox entry (i.e. a > line of text) to the right? In a real Listbox, the answer is simple: you can't. What are you trying to do? Maybe

Re: Packing a list of lists with struct.pack()

2006-04-27 Thread Panos Laganakos
Unfortunately I'm familiar with the generator concept, I'll look into it though, 'cause it saved me at least once already :) Thanks mate. -- http://mail.python.org/mailman/listinfo/python-list

Re: searching for an article on name-binding

2006-04-27 Thread Gerard Flanagan
Fredrik Lundh wrote: > Gerard Flanagan wrote: > > > I'm trying to find a webpage I remember reading which contained a > > layman's description of how Python binds names to objects. It used some > > ASCII-art illustrations where an arrow represented a 'binding'. Anyone > > got a link for that? (Go

Re: How to align the text of a Listbox to the right

2006-04-27 Thread Leonardo da Vinci
I have to use a Listbox that shows a list of entries. Every entry is a char string quite long in size and I cannot set "width" to a large value due to limitations of screen resolution. The rightmost part is more important, so I thought that I could show only the end of the string by aligning the fi

Re: Twisted and Tkinter

2006-04-27 Thread [EMAIL PROTECTED]
Posting that error message would be helpful -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib.urlopen() with pages that requires cookies.

2006-04-27 Thread Fredrik Lundh
Øyvind Østlund wrote: > I am trying to visit a limited amount of web pages that requires cookies. I > will get redirected if my application does not handle them. I am using > urllib.urlopen() to visit the pages right now. And I need a push in the > right direction to find out how to deal with page

String Exceptions (PEP 352)

2006-04-27 Thread Thomas Guettler
Hi, I like python because it is compatible to old versions. That's way I think string exceptions should not be deprecated. I use string exceptions if the condition for an assertion is to complex: if foo and bar and i>10: raise "if foo and bar i must not be greater than 10" This way I can e

Re: Twisted and Tkinter

2006-04-27 Thread Chris
Sorry. The error message is normally AttributeError: 'NoneType' object has no attribute 'sendLine'" [EMAIL PROTECTED] wrote: > Posting that error message would be helpful -- http://mail.python.org/mailman/listinfo/python-list

Re: String Exceptions (PEP 352)

2006-04-27 Thread infidel
You could also use the "assert" statement: >>> if foo and bar: ... assert i <= 10, "if foo and bar then i must not be greater than 10" ... -- http://mail.python.org/mailman/listinfo/python-list

Re: String Exceptions (PEP 352)

2006-04-27 Thread bruno at modulix
Thomas Guettler wrote: > Hi, > > I like python because it is compatible to old versions. That's way I think > string exceptions should not be deprecated. > > I use string exceptions if the condition for an assertion is > to complex: > > if foo and bar and i>10: > raise "if foo and bar i must

Re: Twisted and Tkinter

2006-04-27 Thread Fredrik Lundh
"Chris" wrot: > Sorry. The error message is normally AttributeError: 'NoneType' object > has no attribute 'sendLine'" please post the *entire* traceback, including the part that lists filenames, line numbers, and source code lines. -- http://mail.python.org/mailman/listinfo/python-list

Re: String Exceptions (PEP 352)

2006-04-27 Thread bruno at modulix
bruno at modulix wrote: > Thomas Guettler wrote: > >>Hi, >> >>I like python because it is compatible to old versions. That's way I think >>string exceptions should not be deprecated. >> >>I use string exceptions if the condition for an assertion is >>to complex: >> >>if foo and bar and i>10: >>

Re: Editing a function in-memory and in-place

2006-04-27 Thread bruno at modulix
Peter Otten wrote: (snip) > > Can you cheat and just assign another known good func_code object? def hello(): print "hello" > ... def world(): print "world" > ... def use_it(hello=hello, world=world): > ... hello() > ... world() > ... use_it() > hello > world world.func

Re: begging for a tree implementation

2006-04-27 Thread Diez B. Roggisch
Fredrik Lundh wrote: > Diez B. Roggisch wrote: > >> This is not to discourage you - just don't expect people to greet you as >> the next messiah who finally brought one of CS most fundamental data >> structures to Python... :) > > xml.etree was added to Python 2.5 before christmas :-) Can't wai

A fix to bluepin

2006-04-27 Thread Fulvio
Hello List, I'm very beginner on programming, I''m studing some fix on the Bluez's bluepin, which is rather vague to control the given input. Code /start: = def main(*args): if len(sys.argv) < 2: print "ERR" sys.exit

Re: urllib.urlopen() with pages that requires cookies.

2006-04-27 Thread mwt
Fredrik Lundh wrote: > Øyvind Østlund wrote: > > > I am trying to visit a limited amount of web pages that requires cookies. I > > will get redirected if my application does not handle them. I am using > > urllib.urlopen() to visit the pages right now. And I need a push in the > > right direction

writing some lines after reading goes wrong on windows?

2006-04-27 Thread yichao.zhang
Hi all I can not write anything if I have read something. the code as: Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on win32 IDLE 1.1.3 >>> a=open('d:\\a','r+') >>> a >>> a.read() '11\n22\n33\n' >>> a.seek(0) >>> a.read(1) '1' >>> a.write("a") >>> a.seek(0) >>> a.read()

finding IP address of computer

2006-04-27 Thread Chris
How do I find and print to screen the IP address of the computer my python program is working on? -- http://mail.python.org/mailman/listinfo/python-list

Re: begging for a tree implementation

2006-04-27 Thread DogWalker
Micah wrote: > I'm looking for a simple tree implementation: 0-n children, 1 root. > All the nice methods would be appreciated (getLeaves, isLeaf, isRoot, > depthfirst, breadthfirst,...) That's really all I need. I could code > one up, but it would take time to debug, and i'm really short on tim

Re: Unpacking a list of strings

2006-04-27 Thread Alex Martelli
Panos Laganakos <[EMAIL PROTECTED]> wrote: > Is there some other practice than reading all the strings and slicing > them later? > > They're stored in the form of: > List Group[10]: > char[17] name; > > So I thought of doing: > unpacked = unpack('%s' % (10*17), data) > > And then slicing th

Re: finding IP address of computer

2006-04-27 Thread Gregor Horvath
Chris schrieb: > How do I find and print to screen the IP address of the computer my > python program is working on? > IP adresses are bound to network interfaces not to computers. One Computer can have multiple network interfaces. -- Servus, Gregor http://www.gregor-horvath.com -- http://

Re: finding IP address of computer

2006-04-27 Thread BartlebyScrivener
One way: >>> import socket >>> socket.getaddrinfo(socket.gethostname(), None)[0][4][0] It was the first google hit -- http://mail.python.org/mailman/listinfo/python-list

Get all attributes of a com object

2006-04-27 Thread eicwo01
Without to know the names, is it possible to dump all attributes of a com object? from win32com.adsi import * objDom = ADsOpenObject("LDAP:/ ... print ???"all attributes"??? of objDom Thanks Wolfgang -- http://mail.python.org/mailman/listinfo/python-list

Re: not quite 1252

2006-04-27 Thread Anton Vredegoor
John Machin wrote: > Firstly, this should be 'content.xml', not 'contents.xml'. Right, the code doesn't do *anything* :-( Thanks for pointing that out. At least it doesn't do much harm either :-| > Secondly, as pointed out by Sergei, the data is encoded by OOo as UTF-8 > e.g. what is '\x94' in

Re: finding IP address of computer

2006-04-27 Thread Chris
hehe, works a charm, cheers mate. -- http://mail.python.org/mailman/listinfo/python-list

Re: Twisted and Tkinter

2006-04-27 Thread Chris
Exception in Tkinter callback Traceback (most recent call last): File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) TypeError: unbound method sendMessage() must be called with ChatFactory instance as first argument (got nothing instead) I have simplifie

ILOG Server integration

2006-04-27 Thread adam
Does anybody have experiences of Python and ILOG Server (distribution framework) integration? I need to access to a server application "exposed" through ILOG Server. Thanks Vieri -- http://mail.python.org/mailman/listinfo/python-list

Re: Get all attributes of a com object

2006-04-27 Thread bruno at modulix
eicwo01 wrote: > Without to know the names, is it possible to dump all attributes of a > com object? > from win32com.adsi import * from module import * is Bad(tm) > objDom = ADsOpenObject("LDAP:/ ... > print ???"all attributes"??? of objDom Look at dir() and the inspect module. -- bruno dest

pytiff for windows

2006-04-27 Thread Iain King
Does anyone have a link for a compiled-for-windows version of pytiff? (or alternatively tell me how to get PIL to save a multipage tiff). Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: writing some lines after reading goes wrong on windows?

2006-04-27 Thread harveysthomas
If you are opening a file for read and write access use "rb+" or "wb+". Seeking and subsequent read/write will then work fine. Without the "b", Windows opens the file in its "text" mode. Don't seek on files opened in "text" mode. -- http://mail.python.org/mailman/listinfo/python-list

Re: Twisted and Tkinter

2006-04-27 Thread Fredrik Lundh
Chris wrote: > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__ > return self.func(*args) > TypeError: unbound method sendMessage() must be called with ChatFactory > instance as first argument (got nothing i

Re: Type-Def-ing Python

2006-04-27 Thread Aahz
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: ><[EMAIL PROTECTED]> wrote: > ... >> Brett Cannon's thesis in which he tweaks the compiler and shows that >> type-defing python would not help the compiler achieve a 5% performace >> increase. >> >> Brett Cannon, "Localized

how do I make a class global?

2006-04-27 Thread Tom Brown
Hi, I thought it would be nifty to create a class that created other classes for me. The method below shows what I would like to do. The problem is that the class the method creates is local to the method. Is it possible to make the class visible in the global scope so I can import the module s

gcc errors

2006-04-27 Thread Chris Pesarchick
I installed the Universal Mac OSX binary for Python 2.4.3 When I execute 'python setup.py install' for any of my applications that I need to build, I get errors like the following: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk - fno-strict-aliasing -Wno-long-double -no-cpp-

Re: pytiff for windows

2006-04-27 Thread Michele Petrazzo
Iain King wrote: <-cut pytiff-> > (or alternatively tell me how to get PIL to save a multipage tiff). > PIL can't. If you need to work with multi-page images (tiff and others), you can use freeimagepy (freeimagepy.sf.net) >>> import FreeImagePy as FIPY lst_names = ("/tmp/f1.png", >>> "/tmp/f2

  1   2   3   >