| Who | When |
Messages | |
(not accepting new messages)
|
|
| Timothy Fitz
|
31
|
 |
|
01-21-2005 09:27 AM ET (US)
|
|
Edited by author 01-21-2005 09:28 AM
By Default, SciTE doesn't "just call 'python'", though it looks like it does. Check your python.properties (Options -> Open python.properties) at the very bottom of that file are two lines that have "C:\python23\python.exe" and "C:\python23\pythonw.exe", you can modify to your hearts content. (If you don't have Open python.properties as an option, you're running the single-executable version, the easy solution is to grab the full version)
|
| daf
|
30
|
 |
|
01-20-2005 12:21 PM ET (US)
|
|
Hey, don't you think it would be a good idea to have cElementTree in python standard library?? I find it way more useful than current standard xml lib.. besides it would contribute in making python faster at least in XML processing.
Just want to thank you for your great work, I use this little thing almost everywhere.
|
| Stewart Midwinter
|
29
|
 |
|
01-20-2005 10:50 AM ET (US)
|
|
<smack!> (sound of palm slapping forehead). Now the light goes on. I tested the tkFileDialog from 2.4 by opening it in the SciTE editor, then executing it from there. By default, SciTE just calls "python", and the default python installation for me is 2.3, even if I have 2.4 (and 1.52) installed as well.
I'll go back and run it from a command prompt and see what happens. I'm sure it will work properly then.
Thanks! S
|
Fredrik Lundh
|
28
|
 |
|
01-20-2005 06:52 AM ET (US)
|
|
That SF bug might explain the la-la-land, but it doesn't explain why the exceptions you got under 2.4 were identical to the exceptions I got when I tried to use 2.4's Tkinter with a 2.3 interpreter. Methinks you reported two bugs, one of which was a pilot error.
|
| Stewart Midwinter
|
27
|
 |
|
01-20-2005 12:04 AM ET (US)
|
|
good suggestion to file a bug - someone else had recently noticed the same problem, filed a bug, and a solution. I may be able to patch my own copy of tkFileDialog, or get the tip versio off the CVS tree. The bug is here: https://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=852314 thanks S On 19 Jan 2005 21:16:57 -0000, QT - Fredrik Lundh <qtopic+28-v2dA7ee7u55Jx@quicktopic.com> wrote: > Stewart, running the tkFileDialog and tkFont modules as scripts > gives the same error on my machine (not that it's an error > inside Tkinter itself), but both modules seem to work just fine > if you call the functions from inside a program. Please report > it to the Python developers: > http://sourceforge.net/bugs/?group_id=5470-- Stewart Midwinter stewart@midwinter.ca stewart.midwinter@gmail.com
|
Fredrik Lundh
|
26
|
 |
|
01-19-2005 04:43 PM ET (US)
|
|
Edited by author 01-20-2005 03:13 AM
As far as I can tell, ElementTree is a bit slower with psyco than it is without it. It's simply too much C code involved (pyexpat), and too many calls from C code to Python.
(note that pure-Python parsers are typically 1000-10000 times slower than cElementTree. it's a lot more than just a straightforward translation to C...)
|
Fredrik Lundh
|
25
|
 |
|
01-19-2005 04:16 PM ET (US)
|
|
Edited by author 01-19-2005 04:24 PM
Stewart, running the tkFileDialog and tkFont modules as scripts gives the same error on my machine (not that it's an error inside Tkinter itself) only when I've messed up the paths. I tried running the 2.4 modules using a 2.3 interpreter; doesn't work. With the right versions, everything works just fine.
|
| happy_broccoli
|
24
|
 |
|
01-19-2005 04:04 PM ET (US)
|
|
To Frederik RE: cElementTree
I have generally found that when i go from pure python to c-python, that the cpu performance benefits match those that you would get from applying psyco to the pure python.
Not sure about memory, and of course you get greater portability with c-python. Anyway, it would be nice if you could add psyco to your list of tests.
|
| Stewart Midwinter
|
23
|
 |
|
01-18-2005 09:21 PM ET (US)
|
|
tkFileDialog bug?
Perhaps it's just me, but I'm unable to get the askdirectory function in tkFileDialog.py to work in Python 2.3.4. when invoked using the easygui module's diropenbox method, the tkFileDialog module goes off to la-la land, never to return.
Next, I tried editing the tkFileDialog module directly, adding the following to __main__: getdirectory=askdirectory() print "directory", getdirectory.encode(enc) Same results.
I've also just downloaded and installed Python 2.4 and tried the same function, and in this case an exception is returned:
Traceback (most recent call last): File "tkFileDialog.py", line 202, in ? openfilename=askopenfilename(filetypes=[("all files", "*")]) File "tkFileDialog.py", line 125, in askopenfilename return Open(**options).show() File "C:\Programs\Python24\Lib\lib-tk\tkCommonDialog.py", line 48, in show w = Frame(self.master) File "C:\Programs\Python24\Lib\lib-tk\Tkinter.py", line 2374, in __init__ Widget.__init__(self, master, 'frame', cnf, {}, extra) File "C:\Programs\Python24\Lib\lib-tk\Tkinter.py", line 1855, in __init__ BaseWidget._setup(self, master, cnf) File "C:\Programs\Python24\Lib\lib-tk\Tkinter.py", line 1830, in _setup _default_root = Tk() File "C:\Programs\Python24\Lib\lib-tk\Tkinter.py", line 1569, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) TypeError: create() takes at most 5 arguments (8 given) >Exit code: 1 >python -u "tkFont.py" Traceback (most recent call last): File "tkFont.py", line 190, in ? root = Tkinter.Tk() File "C:\Programs\Python24\Lib\lib-tk\Tkinter.py", line 1569, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) TypeError: create() takes at most 5 arguments (8 given)
what could I be doing wrong?
|
| Tim Cradic
|
22
|
 |
|
01-18-2005 09:38 AM ET (US)
|
|
I am using WinXP Pro and Python 2.3.4 with the 11/04 version of win32all and mscvrt.kbhit() isn't responding properly. I also tried Python 2.4 with it's win32all and no difference. When I run the example-2 code, I press the spacebar repeatedly and the spaces show up in front of the "."s, but the periods keep on coming, pushing the spaces and cursor along in front of them. I am wanting to use your Console to instruct the user with dynamic status. I can get the Console to alert me when a key is pressed, but how do I kill the console when I'm through with it? A small example using the event subtypes and attributes, especially "state()", would be greatly appreciated.
|
| Fredrik Lundh
|
21
|
 |
|
01-17-2005 01:53 PM ET (US)
|
|
> I downloaded cElementTree 0.9.2 (python 2.3) and when I call > getchildren() I get a Windows XP Error Message. The call to > this function runs fine when I use ElementTree.
I've confirmed this in 0.9.2, and it will be fixed in the next release. Note that getchildren() is deprecated, and it will be removed in some distant future. Instead, you should simply treat the element node as the sequence it is. (for item in elem, elem.append, elem.remove, len(elem), elem[x], etc)
(if you really need a list, use list(elem)).
</F>
|
| Ryan
|
20
|
 |
|
01-17-2005 01:30 PM ET (US)
|
|
I downloaded cElementTree 0.9.2 (python 2.3) and when I call getchildren() I get a Windows XP Error Message. The call to this function runs fine when I use ElementTree.
Thanks
|
Fredrik Lundh
|
19
|
 |
|
01-15-2005 08:42 AM ET (US)
|
|
tim, if all you need is to check for a key press, you can use Python's standard msvcrt module. see the second example on this page: http://effbot.org/librarybook/msvcrt.htmif you need the console module for other reasons, use the peek method to handle incoming events without blocking.
|
Fredrik Lundh
|
18
|
 |
|
01-14-2005 12:34 PM ET (US)
|
|
findtext doesn't convert anything; "& l t ;" in the original XML file is how "<" is encoded in XML. If you're writing things out as, say, HTML, you have to encode them again, according to the HTML rules.
As long as you stick to ASCII, you can use the cgi.escape function to convert a string to HTML.
|
| Bill Oldroyd
|
17
|
 |
|
01-14-2005 09:29 AM ET (US)
|
|
When I say < to < , I mean & l t ; to < .
:-)
Bill
|
| Bill Oldroyd
|
16
|
 |
|
01-14-2005 09:28 AM ET (US)
|
|
I am using findtext to extract data from one XML instance to another. findtext converts < to < etc., which is most useful when you want text, but it means I have to convert the < back again to < .
Is there any way of avoiding this ?.
Sorry if this is a simple qestion. I find ElementTree very easy to use.
Bill bill.oldroyd@bl.uk
[I am using ElementTree to help create a gateway to convert between NLM Entrez web service for PubMed and a standard HTTP search protocol SRU - if anyone is interested.]
|