automatic html generation for documentation?

2006-02-24 Thread Lonnie Princehouse
I plan on writing some documentation that will consist of blocks of commentary with interspersed snippets of syntax-colored Python code and the occaisional image. Does anyone know of a package that will take a high level description of what I just described and auto-generate clean-looking web page

Re: Python vs. Lisp -- please explain

2006-02-24 Thread Paul Rubin
[EMAIL PROTECTED] writes: > But Lisp isn't dynamically typed "exactly the way Python is". > Python documents ways to manipulate the internals of objects at > runtime. It is possible to add, change or delete methods and slots > by directly changing the hashtable they're stored in. While CLOS > doe

Re: ls files --> list packer

2006-02-24 Thread kpp9c
cool i just tried: >>> import os >>>snd_filelist = [f for f in os.listdir('/Users/foo/snd') if >>>f.endswith('.aif')] and it worked! and will take a huge bite out of my big script ... which i make by doing an ls in the terminal and editing (boo hoo) one one lc and one import! cool.. that oth

Re: Python vs. Lisp -- please explain

2006-02-24 Thread Torsten Bronger
Hallöchen! Peter Mayne <[EMAIL PROTECTED]> writes: > Torsten Bronger wrote: > > Another example: is Java the bytecode, which is compiled from > Java the language, interpreted or not? Even when the HotSpot > JIT cuts in? It is partly interpreted and partly compiled. That's w

Re: ls files --> list packer

2006-02-24 Thread kpp9c
gosh i could even use other string methods like startswith to take all the files in a given directory which i have organized with a prefix and have them stuffed in different lists ... i think ... snd_filelist = [f for f in os.listdir('/Users/foo/snd') if f.endswith('.aif') & f.startswith('r')] \

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Franz Steinhaeusler
On Thu, 23 Feb 2006 14:46:20 +0100, Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: >Hello, I need a regularexpression, which trims trailing whitespaces. > >While with unix line endings, it works; >but not with Window (Dos) CRLF's: Thank you all for the replies. But I still don't have a solution.

Re: a little more help with python server-side scripting

2006-02-24 Thread Magnus Lycka
John Salerno wrote: > Ok, seems like the verdict is that the server doesn't have mod_python > nor does it detect the .psp extension. It can, however, detect the .py > extension. But does this mean I can simply include Python code in my > HTML files, and then give my HTML files a .py extension?

Re: "Temporary" Variable

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 00:24:25 +, Jeffrey Schwab wrote: > Steven D'Aprano wrote: >> On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: >> >> My comments inserted inline. >> >> >> >>>#!/usr/bin/python >>>#simple guessing game, with numbers >>>import random >>>spam = random.randint(1, 100)

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Martin Franklin
Franz Steinhaeusler wrote: > On Thu, 23 Feb 2006 14:46:20 +0100, Franz Steinhaeusler > <[EMAIL PROTECTED]> wrote: > >> Hello, I need a regularexpression, which trims trailing whitespaces. >> >> While with unix line endings, it works; >> but not with Window (Dos) CRLF's: > > Thank you all for the

Re: spaces at ends of filenames or directory names on Win32

2006-02-24 Thread Steven D'Aprano
On Thu, 23 Feb 2006 17:49:31 -0600, Larry Bates wrote: > Steven D'Aprano wrote: >> On Thu, 23 Feb 2006 14:30:22 -0600, Larry Bates wrote: >> >>> How about not naming files with leading and trailing spaces on >>> the Mac? Seems like a bad habit that needs breaking ;-). >> >> Why is it a bad habi

Re: "Temporary" Variable

2006-02-24 Thread bonono
Steven D'Aprano wrote: > Just out of curiosity, when do you think is the right time to begin > teaching programmers good practice from bad? Before or after they've > learnt bad habits? When you have authority over the coding guideline. Naming things is not something limited to programming and most

Re: PYTHONPATH?

2006-02-24 Thread Diez B. Roggisch
Dr. Pastor wrote: > Several Documents about Python > refer to PYTHONPATH. > I could not find such variable. > (Python 2.4.2, IDLE 1.1.2, Windows XP) > How should/could I nominate a Directory to be > the local Directory? > Thanks for any guidance. It's a so called environment-variable. You can set

Re: A C-like if statement

2006-02-24 Thread Steven D'Aprano
On Thu, 23 Feb 2006 20:41:52 -0600, Terry Hancock wrote: > On Fri, 24 Feb 2006 09:14:53 +1100 > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote: >> There are *reasons* why Python discourages functions with >> side-effects. Side-effects make your code hard to test and >> harder to debug. > > You of co

Re: A C-like if statement

2006-02-24 Thread Steven D'Aprano
On Thu, 23 Feb 2006 16:49:09 -0800, bonono wrote: > > Steven D'Aprano wrote: >> On Thu, 23 Feb 2006 12:04:38 -0700, Bob Greschke wrote: >> >> >> try: >> >>i = a.find("3") >> >>print "It's here: ", i >> >> except NotFound: >> >>print "No 3's here" >> > >> > Nuts. I guess you're right.

Re: ls files --> list packer

2006-02-24 Thread Jeremy Sanders
I V wrote: > snd_filelist = [f for f in os.listdir('/snd/Public/') if > f.endswith('.aiff')] Or even from glob import glob snd_filelist = glob('/snd/Public/*.aiff') Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

python-list/python-dev quoting style

2006-02-24 Thread Michael Hoffman
Does anyone have a script to convert more conventional USENET quoting style like this: John wrote: > Jacob Jingleheimer Schmidt <[EMAIL PROTECTED]> wrote in message-id on 29 February 2004: >> Lambda is the best Python feature ever! > > I disagree. to the commonly used python-dev/python-lis

Exception-handling

2006-02-24 Thread Odd-R.
I have come over a strange problem regarding exceptions This is my code: try: #some operation except Exception, info: #some message except: #?? When executing my code, I get to the last block here. This I find rather strange, because I thought Exception would catch all exceptions. But this

Re: MySQLdb slow on MySQL 5

2006-02-24 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I'm not calling COMMIT at all. Then you must be using autocommit if your records stay in the table. An DB-API 2.0 compliant adapter should turn off autocommit by default! Does MyISAM even support proper commit handling? Oh well, Oracle will probably kill MySQL soon. G

Re: Unexpected timing results

2006-02-24 Thread Magnus Lycka
Steven D'Aprano wrote: > It looks like the time function under Linux at least is very slow. Perhaps you should try doing the same thing in C. Then you can see whether the problem is in the wrapper or in the system call. -- http://mail.python.org/mailman/listinfo/python-list

Re: why don't many test frameworks support file-output?

2006-02-24 Thread Magnus Lycka
kanchy kang wrote: > i browsed the following frameworks briefly: nose, OOBTest, > testosterone, py.test, Sancho ... and found out they do support > imediate screen-output only. Look at TextTest. -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime iso8601 string input

2006-02-24 Thread Magnus Lycka
Rubic wrote: > I can understand why datetime can't handle > arbitrary string inputs, but why not just > simple iso8601 format -- i.e. the default > output format for datetime? Have you actually read the ISO 8601 standard? If you have, you would know that parsing valid ISO 8601 is fairly close to h

Re: A C-like if statement

2006-02-24 Thread bonono
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 16:49:09 -0800, bonono wrote: > > > > > Steven D'Aprano wrote: > >> On Thu, 23 Feb 2006 12:04:38 -0700, Bob Greschke wrote: > >> > >> >> try: > >> >>i = a.find("3") > >> >>print "It's here: ", i > >> >> except NotFound: > >> >>print "No 3's

Re: Exception-handling

2006-02-24 Thread Diez B. Roggisch
Odd-R. wrote: > I have come over a strange problem regarding exceptions > This is my code: > > try: > #some operation > except Exception, info: > #some message > except: > #?? > > When executing my code, I get to the last block here. This > I find rather strange, because I thought Exceptio

How to send an email with non-ascii characters in Python

2006-02-24 Thread Lad
Can anyone give an example how to send email with non-ascii characters( both in subject and body). I would like to use windows-1250 code page Thank you L.B. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to send an email with non-ascii characters in Python

2006-02-24 Thread Sybren Stuvel
Lad enlightened us with: > Can anyone give an example how to send email with non-ascii > characters( both in subject and body). I would like to use > windows-1250 code page I'd use Latin-1 or UTF-8, since they are both cross-platform instead of windows-specific... Sybren -- The problem with the

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Steven D'Aprano
On Thu, 23 Feb 2006 15:13:01 +0100, Franz Steinhaeusler wrote: >>why not use string methods strip, rstrip and lstrip >> > > because this removes only the last spaces, r > 'erewr\r\nafjdskl ' r.rstrip() > 'erewr\r\nafjdskl' > > I want: > 'erewr\r\nafjdskl' > > or for unix l

Re: Unexpected timing results

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 10:11:18 +0100, Magnus Lycka wrote: > Steven D'Aprano wrote: >> It looks like the time function under Linux at least is very slow. > > Perhaps you should try doing the same thing in C. > Then you can see whether the problem is in the > wrapper or in the system call. Good idea

Re: ls files --> list packer

2006-02-24 Thread Singletoned
Try using The Path module: http://www.jorendorff.com/articles/python/path/. I wrote a little script to traverse a directory structure which you could use. (You just pass a function to it and it runs it on each file in the directory. You want it to run on each directory instead, so I've changed i

Re: Exception-handling

2006-02-24 Thread Rene Pijlman
Odd-R.: >I thought Exception would catch all exceptions. Try this: import sys try: pass # your code here except: e = sys.exc_value() Either to catch everything, or to get a hold on e. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: How to send an email with non-ascii characters in Python

2006-02-24 Thread Lad
Sybren, and can give me an example of Python code that can send such email?? -- http://mail.python.org/mailman/listinfo/python-list

Re: Unexpected timing results

2006-02-24 Thread Roel Schroeven
Steven D'Aprano schreef: > On Fri, 24 Feb 2006 10:11:18 +0100, Magnus Lycka wrote: > >> Steven D'Aprano wrote: >>> It looks like the time function under Linux at least is very slow. >> Perhaps you should try doing the same thing in C. >> Then you can see whether the problem is in the >> wrapper or

Re: "Temporary" Variable

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 01:50:40 -0800, bonono wrote: > Steven D'Aprano wrote: >> Just out of curiosity, when do you think is the right time to begin >> teaching programmers good practice from bad? Before or after they've >> learnt bad habits? > > When you have authority over the coding guideline.

Re: PYTHONPATH?

2006-02-24 Thread Magnus Lycka
Dr. Pastor wrote: > Several Documents about Python refer to PYTHONPATH. If you need to import libraries into Python, that don't reside in the standard locations in your Python installation, you need to define a PYTHONPATH environment variable in the operating system, which points out this director

Re: ls files --> list packer

2006-02-24 Thread Magnus Lycka
kpp9c wrote: > that other sillyness i mentioned is not strickly required ... just > dreaming but i know involves some kind of os walk type thing prolly ... os.walk isn't exactly rocket science... Something similar to this? >>> import os >>> for dir, dirs, files in os.walk('.'): ... txt_fil

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-24 Thread Magnus Lycka
Paul Probert wrote: > Yes, I'm doing this: > . > oldtime=time.time() > time.sleep(1) > newtime=time.time() > dt=newtime-oldtime > if dt > 2: > print 'dt=',dt,' time=',time.strftime('%Y_%m_%d_%Hh_%Mm_%Ss') > Its happening roug

Re: A C-like if statement

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 02:02:02 -0800, bonono wrote: >> "test".index("a") >> > Traceback (most recent call last): >> > File "", line 1, in -toplevel- >> > "test".index("a") >> > ValueError: substring not found >> "test".find("a") >> > -1 >> >> >> Did you have a point? >> > It was abou

Re: Unexpected timing results

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 10:51:09 +, Roel Schroeven wrote: [snip] > I think it looks like the problem is in the system call. Thank you Roel for going the extra mile. I appreciate the unexpected bonus. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHONPATH?

2006-02-24 Thread Tombo
Said obscure dialog is here: My Computer > Properties > Advanced (tab) > Environment Variables You probably want a new system variable. You can check the value by starting a new terminal window and typing: echo %PYTHONPATH% Cheers Tombo Diez B. Roggisch wrote: > Dr. Pastor wrote: > > > Several

Re: Python vs. Lisp -- please explain

2006-02-24 Thread Paul Boddie
Torsten Bronger wrote: > > Peter Mayne <[EMAIL PROTECTED]> writes: > > What kind of implications are useful to you? > > Speed, ease of programming, necessity to learn/use a secondary > language, issues with distributing, portability. Indeed. Given the various convenient arguments about what "inter

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Franz Steinhaeusler
On Thu, 23 Feb 2006 17:41:47 +, Martin Franklin <[EMAIL PROTECTED]> wrote: >Franz Steinhaeusler wrote: >> On Thu, 23 Feb 2006 13:54:50 +, Martin Franklin >> <[EMAIL PROTECTED]> wrote: >> >>> r="erewr\r\nafjdskl " 'erewr\r\nafjdskl' 2) Unix >>> r="erewr

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Franz Steinhaeusler
On Fri, 24 Feb 2006 12:36:01 +0100, Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: >if n > 1: if n > 0: (of course) :-) -- Franz Steinhaeusler -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickling/unpickling Cookie.SimpleCookie fails with protocol=2

2006-02-24 Thread Georg Brandl
Erwin S. Andreasen wrote: > Pickling a Cookie.SimpleCookie (or SmartCookie) when using protocol=2 > seems to do something very strange. Protocol 0/1 work fine: > > $ python2.4 > Python 2.4.2 (#2, Nov 20 2005, 17:04:48) > [GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2 > Type "help",

Re: Using ElementTree to tidy up an XML string to my liking

2006-02-24 Thread [EMAIL PROTECTED]
Yes I am but, I'm using a DOM Serializer in Firefox which for some reason turns myCamelNames into MYCAMELNAMES for the nodenames. I'll therefore need to control the case-spelling of these things as I'm formatting the XML string. -- http://mail.python.org/mailman/listinfo/python-list

Re: A C-like if statement

2006-02-24 Thread Kent Johnson
Steven D'Aprano wrote: > Now that's a Python wart: using >>> for the prompt for interactive > sessions. It makes it ambiguous when posting code in email or newsgroups, > especially once the code gets quoted a few times. So change it. My pythonstartup.py contains: import sys sys.ps1 = ' >>> ' sys.

Re: A C-like if statement

2006-02-24 Thread Antoon Pardon
Op 2006-02-23, Roy Smith schreef <[EMAIL PROTECTED]>: > Bob Greschke <[EMAIL PROTECTED]> wrote: >>I miss being able to do something like this in Python >> >>1f (I = a.find("3")) != -1: >>print "It's here: ", I >>else: >>print "No 3's here" >> >>where I gets assigned the index returned by fi

KPanelApplet using Python

2006-02-24 Thread Varun Hiremath
Hi, I was wondering if there is any way to make KDE PanelApplets using Python. I have made a small window using Qt, kdeui nad kdecore libs. Now I want to add it to the KDE kicker. Can I get any help regarding this matter. Thank you. -- --- Varun Hire

Re: MySQLdb slow on MySQL 5

2006-02-24 Thread Gerhard Häring
Magnus Lycka wrote: > [EMAIL PROTECTED] wrote: > > I'm not calling COMMIT at all. > > Then you must be using autocommit if your records stay in > the table. An DB-API 2.0 compliant adapter should turn off > autocommit by default! Does MyISAM even support proper > commit handling? [...] No, it d

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread John Zenger
Franz Steinhaeusler wrote: > > Thank you all for the replies. > But I still don't have a solution. > > Of course with more lines it is possible, > but it would be fine to have a "oneliner". re.sub(r"\s+[\n\r]+", lambda x: x.expand("\g<0>"). \ lstrip(" \t\f\v"),text).rstrip() ...where "tex

Re: KPanelApplet using Python

2006-02-24 Thread wjzrules
I am not a Python expert, but I am using KDE on my workstation at home and a big Python fan ;) A couple of days ago I was thinking the same and found how to create systray apps for Windows! You can make this kind of apps with wxPython. When I was at home and behind my KDE desktop I tried the Wind

Re: A C-like if statement

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 06:45:41 -0500, Kent Johnson wrote: > Steven D'Aprano wrote: >> Now that's a Python wart: using >>> for the prompt for interactive >> sessions. It makes it ambiguous when posting code in email or newsgroups, >> especially once the code gets quoted a few times. > > So change it

Re: "Temporary" Variable

2006-02-24 Thread Jeffrey Schwab
Steven D'Aprano wrote: > On Fri, 24 Feb 2006 00:24:25 +, Jeffrey Schwab wrote: > > >>Steven D'Aprano wrote: >> >>>On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: >>> >>>My comments inserted inline. >>> >>> >>> >>> #!/usr/bin/python #simple guessing game, with numbers import

Re: A C-like if statement

2006-02-24 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Side-effects aren't always bad (import, for example, does all its work by > side-effect). But they are generally frowned upon, and in functional > languages they are verboten. How do you do any I/O in a functional langu

Re: datetime iso8601 string input

2006-02-24 Thread Rubic
Magnus, Thanks for your reply. I wasn't clear in my prior post. Rather than support the entire range of iso8601 formats, how about *just* the format that datetime emits? Call it the parse_datetime() function. Then it would be possible to take the output string of a datetime object and read it

problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread per9000
Dear Black Knight, I have no quarrel with you sir Knight, but I must import your parents. SHORT VERSION: I tried three variants of "from ../brave.py import sir_robin", one works. I want to use it in a py-file to execute command-line-style and that does not work. Can someone please give me, not

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread Kent Johnson
per9000 wrote: from raw2nice_def import raw2nice > -- > > When I tried putting this into a program to execute command-line-style: > > from raw2nice_def.py import raw2nice > > output: > >>"C:\another_bridge\python\python.exe" rawhtml2nicehtml_template.py > > ['raw2nice_def.py', 'ra

Re: A C-like if statement

2006-02-24 Thread Rene Pijlman
Roy Smith: >How do you do any I/O in a functional language if side effects are >verboten? The user is a function. Output is its parameter, input its return value. The user is not allowed to maintain state ;-) >For that matter, how does a functional program ever stop running? By returning to t

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread Tim Williams (gmail)
On 24 Feb 2006 05:10:37 -0800, per9000 <[EMAIL PROTECTED]> wrote: SHORT VERSION:I tried three variants of "from ../brave.py import sir_robin", oneworks. I want to use it in a py-file to execute command-line-style andthat does not work.Can someone please give me, not a bucket with the desert(s) on t

Re: A C-like if statement

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 08:03:49 -0500, Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> Side-effects aren't always bad (import, for example, does all its work by >> side-effect). But they are generally frowned upon, and in functional >> languages

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread Carsten Haese
On Fri, 2006-02-24 at 08:10, per9000 wrote: > Dear Black Knight, > > I have no quarrel with you sir Knight, but I must import your parents. > > > SHORT VERSION: > > I tried three variants of "from ../brave.py import sir_robin", one > works. I want to use it in a py-file to execute command-line-

Re: A C-like if statement

2006-02-24 Thread Diez B. Roggisch
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> Side-effects aren't always bad (import, for example, does all its work by >> side-effect). But they are generally frowned upon, and in functional >> languages they are verboten. > > How do you d

Re: [ANN] httpy 0.9.0 -- a sane and robust HTTP library for Python

2006-02-24 Thread Rene Pijlman
Chad Whitacre: >I am pleased to announce the first public release of httpy -- a sane and >robust HTTP library for Python. With httpy, you write "responders," and >put them on the network with "couplers." Here is a trivial responder: > > import httpy > > class Responder: > def respond(requ

Re: KPanelApplet using Python

2006-02-24 Thread [EMAIL PROTECTED]
Another way to do it is to use ksystraycmd which is included with your KDE. Some usage info is covered in my tutorial: http://xmelegance.org/customising-window-behaviour/html/customising-window-behaviour.html Rich. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread per9000
Thanks, I added an environment variable PYTHONPATH and added the holy folder with my script in. Works just perfectly. But still: is there a way around this? (It is a lot easier to add "../../" in my code than make everyone else add this variable). /per9000 -- http://mail.python.org/mailman/lis

How to tell an object's class?

2006-02-24 Thread Edward K. Ream
Hi, I would like to create a dictionary of all the classes that exist while my app is running. This is the best I can do: def defineClassesDict (self): self.allClassesDict = {} for z in gc.get_objects(): t = type(z) if t == types.ClassType: name

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Sion Arrowsmith
Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: >On Thu, 23 Feb 2006 13:54:50 +, Martin Franklin >>why not use string methods strip, rstrip and lstrip >because this removes only the last spaces, > [given r = 'erewr\r\nafjdskl '] >I want: >'erewr\r\nafjdskl' os.linesep.join(l.rstrip() f

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-24 Thread Peter Hansen
Magnus Lycka wrote: > With an operating system such as Windows, this is > probably something you can expect to happen, although > I'm surprised if such long lag times as 200 s are typical. No way. I mean, I'm the biggest critic of Windows operating systems when used in realtime environments (at

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread plahey
You don't _need_ to go the PYTHONPATH route (although that works). Re-read Carsten's post (particularly step 1, see section 6.1.1). You can use: sys.path.append('..') from brave import sir_robin -- http://mail.python.org/mailman/listinfo/python-list

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread Carsten Haese
On Fri, 2006-02-24 at 09:10, per9000 wrote: > Thanks, > > I added an environment variable PYTHONPATH and added the holy folder > with my script in. Works just perfectly. > > But still: is there a way around this? (It is a lot easier to add > "../../" in my code than make everyone else add this va

Re: datetime iso8601 string input

2006-02-24 Thread Peter Hansen
Rubic wrote: > Thanks for your reply. I wasn't clear in my > prior post. Rather than support the entire > range of iso8601 formats, how about *just* the > format that datetime emits? Call it the > parse_datetime() function. Then it would be > possible to take the output string of a datetime > o

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-24 Thread Paul Probert
Grant Edwards wrote: >Time to dowload a linux CD then, eh? > > > We are looking at that very seriously. The big hurdle is that we run a lot of laboratory hardware that has no support under linux. A world where there is no more Kazaa or sasser seems like it would be wonderful, though. Paul Pr

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Tim Williams (gmail)
On 24/02/06, John Zenger <[EMAIL PROTECTED]> wrote: Franz Steinhaeusler wrote:>> Thank you all for the replies.> But I still don't have a solution.>re.sub(r"\s+[\n\r]+", lambda x: x.expand("\g<0>"). \ lstrip(" \t\f\v"),text).rstrip() But I think your code is a lot easier to read.  :) How about:

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-24 Thread Claudio Grondi
Claudio Grondi wrote: > Paul Probert wrote: > >> Peter Hansen wrote: >> >>> Are you saying that you believe the time.sleep(1) call is actually >>> blocking for 200 seconds? > With such rare occurrence it is very hard to tell what is going on. > Usually I put such strange things on a list of curi

Re: make a class instance from a string ?

2006-02-24 Thread Mike Woodhouse
Is there anything particularly bad with obj = eval(classname + "()") ? It appears to work, but I'm a noobie so I could be missing something nasty, in which any edication would be gratefully received. Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: a little more help with python server-side scripting

2006-02-24 Thread John Salerno
Magnus Lycka wrote: > The other option is ASP. You have been given information about > that already. Be aware that ASP does not imply VBScript. You can > use Python in ASP as long as that's enabled. It seems to be exactly > what you are asking for, so I don't understand why you seem to reject > it

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-24 Thread Paul Probert
Dennis Lee Bieber wrote: >On Thu, 23 Feb 2006 15:56:09 -0600, Paul Probert <[EMAIL PROTECTED]> >declaimed the following in comp.lang.python: > > > > >> Thanks for the reply. I should have mentioned, this happens to just >>about every machine in our collection of about 20 machines. Each is of a

Re: pyserial

2006-02-24 Thread Mimi
Thanks Peter, because you have understood my need: a little understanding of readlines() function. # Following snippets of code is running in infinitive loop, but it is not necessary too be worried about processor utilization because the readline waits for the data on the serial port and th

Re: Python vs. Lisp -- please explain

2006-02-24 Thread Kay Schluehr
Torsten Bronger wrote: > Hallöchen! > > "Paul Boddie" <[EMAIL PROTECTED]> writes: > > > Kay Schluehr wrote: > > > >> I would say yes, it is still "proper Python" in that each RPython > >> program is also a CPython program. > > > > I suppose it depends on which direction you're coming from, in > >

Re: pyserial

2006-02-24 Thread Mimi
thanks philippe, Hi will take care for the that. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread per9000
...and there was much rejoicing... Even better, thanks - you guys are the best. import string, time, sys sys.path.append("../../py_scripts") Works just nice, and yes, I removed the env.variable before I tried it :-D /Per9000 -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickling/unpickling Cookie.SimpleCookie fails with protocol=2

2006-02-24 Thread Erwin S. Andreasen
"Erwin S. Andreasen" <[EMAIL PROTECTED]> writes: > Pickling a Cookie.SimpleCookie (or SmartCookie) when using protocol=2 > seems to do something very strange. Protocol 0/1 work fine: Oh well, it seems that it's a well-known bug that has been around for more than 2 years: http://sourceforge.net/t

Re: datetime iso8601 string input

2006-02-24 Thread Rubic
Yeah, it's a trivial function that's rewritten for each new project that passes datetime objects as strings <0.2 wink>. On the basis of it being a trivial convenience, I could propose removing hundreds of "redundant" functions from the library. ;-) Never mind. I'll drop it. Jeff Bauer Rubicon,

Re: a little more help with python server-side scripting

2006-02-24 Thread Kent Johnson
John Salerno wrote: > Magnus Lycka wrote: > >> The other option is ASP. You have been given information about >> that already. Be aware that ASP does not imply VBScript. You can >> use Python in ASP as long as that's enabled. It seems to be exactly >> what you are asking for, so I don't understand

Re: Tkinter canvas size determination

2006-02-24 Thread Dean Allen Provins
Cameron: Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Dean Allen Provins <[EMAIL PROTECTED]> wrote: > >>I need to determine the size of a canvas while the process is running. >>Does anyone know of a technique that will let me do that? > > . >

Re: Python vs. Lisp -- please explain

2006-02-24 Thread Torsten Bronger
Hallöchen! "Kay Schluehr" <[EMAIL PROTECTED]> writes: > Torsten Bronger wrote: > >> [...] >> >> I'm still afraid of the following scenario: Eventually, people >> might regard "RPython plus type declarations" (or something >> similar) as first-class Python because it's faster and runs on >> more i

[ANNOUNCE] Mod_python 3.2.8 (security)

2006-02-24 Thread Gregory (Grisha) Trubetskoy
The Apache Software Foundation and The Apache HTTP Server Project are pleased to announce the release of version 3.2.8 of mod_python. This release addresses a vulnerability in mod_python's FileSession object whereby a carefully crafted session cookie could potentially permit an attacker to execut

Re: Tkinter canvas size determination

2006-02-24 Thread Martin Franklin
Dean Allen Provins wrote: > Cameron: > > Cameron Laird wrote: >> In article <[EMAIL PROTECTED]>, >> Dean Allen Provins <[EMAIL PROTECTED]> wrote: >> >>> I need to determine the size of a canvas while the process is running. >>> Does anyone know of a technique that will let me do that? >>

chrtohex

2006-02-24 Thread luca72
Hello again my friends here's my new problem. How i can translate chr in to hex or int to integer value? Best Regards Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: pyFltk-1.1

2006-02-24 Thread kpd
Andreas, Congratulations, it's a well polished release. For those not familiar with FLTK, there are many examples in the Python24/pytfltk/test directory. -- http://mail.python.org/mailman/listinfo/python-list

Regular expression fun. Repeated matching of a group Q

2006-02-24 Thread matteosartori
Hi all, I've spent all morning trying to work this one out: I've got the following string: 04/01/2006Wednesday 09:1412:4412:5017:5808:14 from which I'm attempting to extract the date, and the five times from into a list. Only the very last time is guaranteed to be there so it should also wo

Re: chrtohex

2006-02-24 Thread Diez B. Roggisch
luca72 wrote: > Hello again my friends > > here's my new problem. > > How i can translate chr in to hex or int to integer value? print "%x" % ord('a') Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: a little more help with python server-side scripting

2006-02-24 Thread John Salerno
Kent Johnson wrote: > John Salerno wrote: >> Magnus Lycka wrote: >> >>> The other option is ASP. You have been given information about >>> that already. Be aware that ASP does not imply VBScript. You can >>> use Python in ASP as long as that's enabled. It seems to be exactly >>> what you are asking

Re: why don't many test frameworks support file-output?

2006-02-24 Thread Scott David Daniels
kanchy kang wrote: > > I don't think redirecting stdout to a file is a good resolution. Nobody is suggesting: python program.py >output or program.py >output What is being suggested is: import sys import module original, sys.stdout = sys.stdout, open('output', 'w') t

Re: a little more help with python server-side scripting

2006-02-24 Thread Kent Johnson
John Salerno wrote: > Kent Johnson wrote: > >> John Salerno wrote: >> >>> Magnus Lycka wrote: >>> The other option is ASP. You have been given information about that already. Be aware that ASP does not imply VBScript. You can use Python in ASP as long as that's enabled. It seems to

Re: chrtohex

2006-02-24 Thread [EMAIL PROTECTED]
Or: py> print hex(ord('a')) 0x61 py> print int(ord('a')) 97 -- http://mail.python.org/mailman/listinfo/python-list

stop a doctest execution

2006-02-24 Thread Tarek Ziadé
Hello, is there a simple way to stop a doctest execution within its code ? my use case is to abort the execution of part of the doc, given an arbitrary condition. That could be: existence of a third party package or whatever. Adding tests throughout the doctest does not look good. Maybe it's ti

Re: make a class instance from a string ?

2006-02-24 Thread Scott David Daniels
Mike Woodhouse wrote: > Is there anything particularly bad with > obj = eval(classname + "()") > It appears to work, but I'm a noobie so I could be missing something > nasty, in which any edication would be gratefully received. It is a little too indirect. Usually wanting to use "eval" or "

Re: Regular expression fun. Repeated matching of a group Q

2006-02-24 Thread johnzenger
There's more to re than just sub. How about: sanesplit = re.split(r"||", text) date = sanesplit[1] times = times = [time for time in sanesplit if re.match("\d\d:\d\d", time)] ... then "date" contains the date at the beginning of the line and "times" contains all your times. -- http://mail.pyth

Re: a little more help with python server-side scripting

2006-02-24 Thread Magnus Lycka
John Salerno wrote: > Maybe I'm misunderstanding what is meant when you say to use ASP. I'm > thinking that it involves having to learn another language (such as C# > with ASP.NET), instead of writing my code in Python. Is that not the case? Nope. Just like CGI, ASP is language agnostic. It's a

Re: make a class instance from a string ?

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 06:37:27 -0800, Mike Woodhouse wrote: > Is there anything particularly bad with > > obj = eval(classname + "()") > > ? > > It appears to work, but I'm a noobie so I could be missing something > nasty, in which any edication would be gratefully received. In your own code, th

Re: a little more help with python server-side scripting

2006-02-24 Thread Gerard Flanagan
John Salerno wrote: > Kent Johnson wrote: > > John Salerno wrote: > >> Magnus Lycka wrote: > >> > >>> The other option is ASP. You have been given information about > >>> that already. Be aware that ASP does not imply VBScript. You can > >>> use Python in ASP as long as that's enabled. It seems to

  1   2   3   >