Re: reading one byte from stdin

2008-07-16 Thread Diez B. Roggisch
Mark McDuff schrieb: I'm trying to read one byte from stdin, without the newline. If I try something like: >>> import os, sys >>> os.read(sys.stdin.fileno(),1) I can input a character, but then I have to press enter, which leaves a newline character in the stdin buffer and requires two keypr

Re: Redirecting stdout to another script

2008-07-16 Thread Diez B. Roggisch
Richard Simões schrieb: Hopefully, this explanation will sufficiently clear despite the lack of code. I wrote a python script that takes data via stdin, does stuff with the data, and outputs the result to stdout. A friend wrote a perl script that opens a pipe to my script, feeds it data, and the

Re: Is re.findall guaranteed to be "in order?"

2008-07-16 Thread Fredrik Lundh
Joshua Kugler wrote: Experimenting has shown me that re.findall() will return a list with the matches in the order it found them. "in the order it found them" doesn't really say much, does it? ;-) "findall" and "finditer" both scans the string from left to right, and will return matches in t

Re: About wmi

2008-07-16 Thread Tim Golden
patrol wrote: http://timgolden.me.uk/wmi-project/wmi.py It cannot work either. Oh well. It was only a quick fix! I'll try to get some kind of non-ASCII edition of Windows to test against. As I understand it, the situation is that some WMI exception (ie coming from the underlying WMI/COM subsy

Re: Python internals

2008-07-16 Thread Ben Finney
Peter Anderson <[EMAIL PROTECTED]> writes: > If Python doesn't do it like C and the others then what mechanism does > it use You've already been pointed to it, but here it is again: http://effbot.org/zone/python-objects.htm> -- \ “I may disagree with what you say, but I will defend to

Re: Is this correct behavior for default parameters?

2008-07-16 Thread Fredrik Lundh
Bruce Pearson wrote: The first call to test has the file_list empty but on the second call to test the file_list is no longer empty but contains the values appended in the first call. Is this correct behavior? I'm using python 2.5 yes: http://docs.python.org/ref/function.html "Def

Re: Is there any library that can extract titles from PDFs?

2008-07-16 Thread Fredrik Lundh
ZelluX wrote: I want to write a script which will rename PDFs according to their titles. I want to know if there is any library that can extract titles(the first line of the PDF) from PDFs. Mathieu Fenniak's PyPdf should be able to do this: http://pybrary.net/pyPdf/ (but note that "the f

Re: bad recursion, still works

2008-07-16 Thread iu2
On Jul 16, 2:21 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > iu2 wrote: > > I still don't understand: In each recursive call to flatten, acc > > should be bound to a new [], shouldn't it? Why does the binding happen > > only on the first call to flatten? > > Nope.  In each new call it's (re)boun

Re: Logging to different addressees

2008-07-16 Thread McA
Hi Vinay, thank you for being so patient. On 16 Jul., 01:21, Vinay Sajip <[EMAIL PROTECTED]> wrote: > On Jul 15, 5:17 pm, McA <[EMAIL PROTECTED]> wrote: > > > > If you added the admin sink handler to the root logger, you're done. > > > Isn't that the first thing above? What do you mean? > > I gav

Re: snippet to update local (bazaar, mercurial, svn) versioned source

2008-07-16 Thread Alia Khouri
On Jul 16, 8:34 am, Alia Khouri <[EMAIL PROTECTED]> wrote: > Here's a very simple snippet I use to automatically keep my versioned > sources fresh.. Posted here in case it may be of use to anybody... > > > #!/usr/local/bin/python > import os, sys > > src = '/Users/ak/Code/src' > > # utility functi

How can i use a variable without define it ?

2008-07-16 Thread zhw
How can i use a variable without define it ? I have thought about the __import__ function, but the docs says "the __import__() function does not set the local variable named eggs"。 -- http://mail.python.org/mailman/listinfo/python-list

Re: Amazon: "Practical Django Projects" by James Bennett (June 2008)

2008-07-16 Thread Stefan Scholl
Dave U. Random <[EMAIL PROTECTED]> wrote: > http://snipr.com/PracticalDjango June 2008 is a bit too early. Django isn't ready. -- Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/ -- http://mail.python.org/mailman/listinfo/python-list

Re: iterator clone

2008-07-16 Thread Yosifov Pavel
On 16 июл, 11:32, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Tue, 15 Jul 2008 19:54:30 -0700, Yosifov Pavel wrote: > > Kay, can you show example of such generator? ReIter, for example, work > > with usual generators. > > > But for "big" iterator, I think is no any good solutions. IMHO

Re: How can i use a variable without define it ?

2008-07-16 Thread Ben Finney
zhw <[EMAIL PROTECTED]> writes: > How can i use a variable without define it ? What do you mean by "use"? That's so vague I can think of many possible interpretations. What do you mean by "variable"? That term carries a lot of baggage that doesn't apply in Python. Can you give a small, complete

Re: reading one byte from stdin

2008-07-16 Thread Fredrik Lundh
Mark McDuff wrote: I'm trying to read one byte from stdin, without the newline. If I try something like: >>> import os, sys >>> os.read(sys.stdin.fileno(),1) I can input a character, but then I have to press enter, which leaves a newline character in the stdin buffer and requires two keypre

RE: isPrime works but UnBoundLocalError when mapping on list

2008-07-16 Thread Andreas Tawn
Terry Reedy wrote: >Wrong. Thank you. >For loop variables continue after the loop exits. This is >intentional. I never knew that and I can't find reference to it in the docs. Can you help me with the reasons for it? Drea -- http://mail.python.org/mailman/listinfo/python-list

Re: Amazon: "Practical Django Projects" by James Bennett (June 2008)

2008-07-16 Thread Fredrik Lundh
Stefan Scholl wrote: Django isn't ready. That's a remarkably ignorant statement. -- http://mail.python.org/mailman/listinfo/python-list

Re: How can i use a variable without define it ?

2008-07-16 Thread zhw
On 7月16日, 下午4时47分, Ben Finney <[EMAIL PROTECTED]> wrote: > zhw <[EMAIL PROTECTED]> writes: > > How can i use a variable without define it ? > > What do you mean by "use"? That's so vague I can think of many > possible interpretations. > > What do you mean by "variable"? That term carries a lot of b

Re: Testing for connection to a website

2008-07-16 Thread Fredrik Lundh
Alexnb wrote: e = '' try: ... except HTTPError, e: print e.code except URLError, e: print e.reason if e == '': print "good to go" footnote: here's a better way to test if an exception was raised or not: try: ... except HTTPError, e: print e.co

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-16 Thread Fredrik Lundh
Andreas Tawn wrote: I never knew that and I can't find reference to it in the docs. the for-in loop does ordinary assignments in the current scope: http://docs.python.org/ref/for.html "Each item in turn is assigned to the target list using the standard rules for assignments, and

Re: How can i use a variable without define it ?

2008-07-16 Thread Ben Finney
zhw <[EMAIL PROTECTED]> writes: > Here is a example that I want to complete: > >>> import sys, new > >>> context={"name":"david", "sex":"male"} Here you have a set of values addressible by name. > >>> sys.modules["foo"] = new.module("foo") Why do you believe you need to create a module object?

Re: How can i use a variable without define it ?

2008-07-16 Thread zhw
On 7月16日, 下午5时35分, Ben Finney <[EMAIL PROTECTED]> wrote: > zhw <[EMAIL PROTECTED]> writes: > > Here is a example that I want to complete: > > >>> import sys, new > > >>> context={"name":"david", "sex":"male"} > > Here you have a set of values addressible by name. > > > >>> sys.modules["foo"] = new.

Re: new itertools functions in Python 2.6

2008-07-16 Thread Mark Dickinson
On Jul 16, 7:20 am, Mensanator <[EMAIL PROTECTED]> wrote: > > > ##  Combinations with replacement > > > ##  - > > > ##  aaa aab aac aad aae abb abc abd abe acc acd ace > > > ##  add ade aee bbb bbc bbd bbe bcc bcd bce bdd bde > > > ##  bee ccc ccd cce cdd cde cee ddd dde

Re: Using McMillan Installer, PyInstall or py2exe cross-platform?

2008-07-16 Thread Paul Boddie
On 15 Jul, 23:00, Hartmut Goebel <[EMAIL PROTECTED]> wrote: > > I started working on cross-pyinstall today. Let us know how you get on! In theory, one should be able to build Python (and derived works) using the mingw32 libraries and a suitable cross-compiler on platforms other than Windows, but I

Re: How can i use a variable without define it ?

2008-07-16 Thread Cristina Yenyxe González García
Hello. 2008/7/16 zhw <[EMAIL PROTECTED]>: > On 7月16日, 下午5时35分, Ben Finney <[EMAIL PROTECTED]> > wrote: >> zhw <[EMAIL PROTECTED]> writes: >> > Here is a example that I want to complete: >> > >>> import sys, new >> > >>> context={"name":"david", "sex":"male"} >> >> Here you have a set of values add

Re: Modify a string's value

2008-07-16 Thread s0suk3
On Jul 15, 11:55 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > I just came across this unusual situation where I'd like to modify a > > string passed to a function > > Again: Why? The normal way to do this is to create a new string and > return that. > Yes, usually, bu

RE: Logging in __del__()

2008-07-16 Thread Robert Rawlins
Hi Vinay, > Python uses reference counting with a cycle detector, but the > detector's behaviour is different if there are finalizers (__del__) - > see > > http://www.python.org/doc/ext/refcounts.html > Thank you for the link, that certainly explains a great deal. So, am I right to assume that

Re: How can i use a variable without define it ?

2008-07-16 Thread Chris
On Jul 16, 11:06 am, zhw <[EMAIL PROTECTED]> wrote: > On 7月16日, 下午4时47分, Ben Finney <[EMAIL PROTECTED]> > wrote: > > > > > zhw <[EMAIL PROTECTED]> writes: > > > How can i use a variable without define it ? > > > What do you mean by "use"? That's so vague I can think of many > > possible interpretat

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-16 Thread Tim Golden
Andreas Tawn wrote: Terry Reedy wrote: Wrong. Thank you. For loop variables continue after the loop exits. This is intentional. I never knew that and I can't find reference to it in the docs. Interesting starting point. It never occurred to me that they might not. (So I didn't look for an

Get current class namespace.

2008-07-16 Thread Robert Rawlins
Guys, What's the simplest way to access a classes namespace from within itself. I want to use it in a custom __repr__() method so it prints the current namespace for the class like package.module.class. Suggestions? I'm sure there is a simple enough method built in to help me here, I've jus

Re: Get current class namespace.

2008-07-16 Thread Fredrik Lundh
Robert Rawlins wrote: What’s the simplest way to access a classes namespace from within itself. I want to use it in a custom __repr__() method so it prints the current namespace for the class like package.module.class. Name or namespace? You can access the class name from an instance via th

Re: bad recursion, still works

2008-07-16 Thread Jeff
On Jul 15, 7:21 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > iu2 wrote: > > I still don't understand: In each recursive call to flatten, acc > > should be bound to a new [], shouldn't it? Why does the binding happen > > only on the first call to flatten? > > Nope.  In each new call it's (re)boun

Re: bad recursion, still works

2008-07-16 Thread oj
On Jul 16, 1:09 pm, Jeff <[EMAIL PROTECTED]> wrote: > On Jul 15, 7:21 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > > > iu2 wrote: > > > I still don't understand: In each recursive call to flatten, acc > > > should be bound to a new [], shouldn't it? Why does the binding happen > > > only on the

Re: How can i use a variable without define it ?

2008-07-16 Thread Ben Finney
zhw <[EMAIL PROTECTED]> writes: > On 7月16日, 下午5时35分, Ben Finney <[EMAIL PROTECTED]> > wrote: > > What problem are you trying to solve? > > I an sorry, I can't tell you. Perhaps I'm not being clear: What *programming* problem are you trying to solve? I ask because it seems you are focussed to mu

RE: isPrime works but UnBoundLocalError when mapping on list

2008-07-16 Thread Andreas Tawn
> Andreas Tawn wrote: > > Terry Reedy wrote: > >> Wrong. > > Thank you. > > > >> For loop variables continue after the loop exits. This is > >> intentional. > > I never knew that and I can't find reference to it in the docs. > > Interesting starting point. It never occurred to me > that they

Re: About wmi

2008-07-16 Thread patrol
On 7月16日, 下午3时29分, Tim Golden <[EMAIL PROTECTED]> wrote: > patrol wrote: > >>http://timgolden.me.uk/wmi-project/wmi.py > > > It cannot work either. > > Oh well. It was only a quick fix! I'll try > to get some kind of non-ASCII edition of Windows > to test against. As I understand it, the situation

Re: Python internals

2008-07-16 Thread Scott David Daniels
Peter Anderson wrote: Thanks everyone! Just a quick correction - "as the original poster is" is a bit of a jump that does not reflect my original question. I DO understand how C and other programming languages handle variables internally (the bits of actual memory reserved, etc. etc.) and that

Re: Why is this blowing the stack, thought it was tail-recursive...

2008-07-16 Thread Lie
On Jul 13, 8:44 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Jul 13, 7:56 am, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > On Sat, 12 Jul 2008 19:25:18 -0400, Terry Reedy wrote: > > > ssecorp wrote: > > >> def fib(n): > > >>     def fibt(a, b, n): > > >>         if n <=

Re: Need Python Programmer (preferentially in Los Angeles)

2008-07-16 Thread Scott David Daniels
robnhood00 wrote: I need a python programmer that can integrate graphics into an existing python application. The application is a basic application and the job should be pretty easy for an experienced Python programmer. Los Angeles programmer is preferred but this can obviously be done from an

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-16 Thread Fredrik Lundh
Andreas Tawn wrote: I don't have experience of too many other languages, but in C++ (and I guess C)... That's invalid C (you cannot declare variables in the "for" statement itself, at least not in C89). And back in the old days, some C++ compilers did in fact leak declarations from "for" lo

Re: bad recursion, still works

2008-07-16 Thread Fredrik Lundh
Jeff wrote: Is this avoidable by using a call to list() in the definition instead? No. Default values are *always* evaluated when, and only when, the "def" statement is executed; see: http://docs.python.org/ref/function.html Also note that "def" is an executable statement in Python, a

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-16 Thread Ken Hartling
Thanks .. but I want to find out if the system is "running on 64bit" even when the interpreter is a 32-bit build executable ("what python was built on"). platform.architecture() and platform() in general seems to only be looking at the build executable and what it was built for on windows (sorry, I

Securing mobile Python code

2008-07-16 Thread Mads Kristensen
Hi guys and girls. I am currently developing an execution environment for mobile Python code. To that end I have developed a system called Scavenger based on Stackless Python. The biggest problem when working with mobile code is of course security - especially when working with a language such

python's YENC.DECODE -> weird output

2008-07-16 Thread John Savage
I save posts from a midi music newsgroup, some are encoded with yenc encoding. This gave me an opportunity to try out the decoders in Python. The UU decoder works okay, but my YENC effort gives results unexpected: import yenc, sys fd1=open(sys.argv[1],'r') #yenc.encode(sys.argv[1],"

Re: Logging to different addressees

2008-07-16 Thread Vinay Sajip
On Jul 16, 8:55 am, McA <[EMAIL PROTECTED]> wrote: > Thank you for that snippet. That means, that the root-logger does > inherit > EVERY message (if it fits to the level and isn't filtered) and the > inheritage chain is build by the chosen logger names, e.g. > messages tologging.getLogger('tree.lea

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-16 Thread Fredrik Lundh
Ken Hartling wrote: > Thanks .. but I want to find out if the system is "running on 64bit" > even when the interpreter is a 32-bit build executable ("what python > was built on"). platform.architecture() and platform() in general > seems to only be looking at the build executable You can pass i

Playing stereo wav files in Python

2008-07-16 Thread AM
-Hello all, I am trying to play stereo wavefiles in python with no success. I can play mono wavefiles, using either pygames mixer library, python's winsound library or wxPython's wx.Sound library, but i cannot get stereo wavefiles to play in any of these. Normally i wouldn't care and covert the f

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-16 Thread Tim Golden
Fredrik Lundh wrote: Ken Hartling wrote: > Thanks .. but I want to find out if the system is "running on 64bit" > even when the interpreter is a 32-bit build executable ("what python > was built on"). platform.architecture() and platform() in general > seems to only be looking at the build

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-16 Thread Fredrik Lundh
Tim Golden wrote: This is included in the latest pywin32-211 as well: import win32process print win32process.IsWow64Process () on the other hand, "ctypes" is only an import away if you have a current Python... -- http://mail.python.org/mailman/listinfo/python-list

Regular expression

2008-07-16 Thread Beema shafreen
Hi all, How do I write a regular expression for this kind of sequences >gi|158028609|gb|ABW08583.1| CG8385-PF, isoform F [Drosophila melanogaster] MGNVFANLFKGLFGKKEMRILMVGLDAAGKTTILYKLKLGEIVTTIPTIGFNVETVE thanks -- Beema Shafreen -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression

2008-07-16 Thread Fredrik Lundh
Beema shafreen wrote: How do I write a regular expression for this kind of sequences >gi|158028609|gb|ABW08583.1| CG8385-PF, isoform F [Drosophila melanogaster] MGNVFANLFKGLFGKKEMRILMVGLDAAGKTTILYKLKLGEIVTTIPTIGFNVETVE line.split("|") ? it's a bit hard to come up with a working RE with only

Best Python packages?

2008-07-16 Thread Ben Sizer
Although the standard library in Python is great, there are undoubtedly some great packages available from 3rd parties, and I've encountered a few almost by accident. However, I don't know how a user would become aware of many of these. http://pypi.python.org/pypi/ presumably lists most of the dece

Re: Logging to different addressees

2008-07-16 Thread McA
On 16 Jul., 15:38, Vinay Sajip <[EMAIL PROTECTED]> wrote: > On Jul 16, 8:55 am, McA <[EMAIL PROTECTED]> wrote: > > > messages tologging.getLogger('tree.leave') would also show up > > inlogging.getLogger('tree') automatically? > > Yes. Ok. > > > Hope not to bother. > > Use the propagate flag, whi

Re: Best Python packages?

2008-07-16 Thread Fredrik Lundh
Ben Sizer wrote: make my development a lot easier. Knowing what kind of development you do might help, of course. Some libraries are excellent in some contexts and suck badly in others... Looking at things that larger projects and distributions use can also be a good idea. For example, i

Re: About wmi

2008-07-16 Thread Tim Golden
patrol wrote: > The errors are in the following: > > Traceback (most recent call last): > File "D:\My Documents\code\python\wmi\test.py", line 5, in > c = wmi.WMI ("non-existent computer") > File "C:\Python25\lib\wmi.py", line 1199, in connect > handle_com_error (error_info) > File

Re: Logging in __del__()

2008-07-16 Thread Marc 'BlackJack' Rintsch
On Wed, 16 Jul 2008 12:38:50 +0100, Robert Rawlins wrote: > So, am I right to assume that python will still handle its garbage disposal > if I implement __del__(), it just handles circular references in a slightly > different way, but to the same effect. Right? No. Circular references in objects

Angle brackets in command-line arguments?

2008-07-16 Thread Keith Hughitt
Hi all, I am using someone else's script which expects input in the form of: ./script.py arg2 I was wondering if the angle-brackets here have a special meaning? It seems like they specify an input and output stream to use in place of the console. I could not find anything in the python man

Custom 'Float' class. Am I right here?

2008-07-16 Thread Prashant Saxena
import sys class Float(float): """ Custom float datatype with addtional attributes. """ def __new__(self, value=0.0, #default value name='', # string range=(0.0, 1.0) # tuple )

Re: Angle brackets in command-line arguments?

2008-07-16 Thread Marc 'BlackJack' Rintsch
On Wed, 16 Jul 2008 07:53:56 -0700, Keith Hughitt wrote: > I am using someone else's script which expects input in the form of: > > ./script.py arg2 > > I was wondering if the angle-brackets here have a special meaning? It > seems like they specify an input and output stream to use in plac

Re: Angle brackets in command-line arguments?

2008-07-16 Thread Fredrik Lundh
Keith Hughitt wrote: I am using someone else's script which expects input in the form of: ./script.py arg2 is a common notation for "replace with argument value", so it could be that they're just expecting you to type: ./script.py arg1 arg2 Alternatively, they meant ./scri

Re: Angle brackets in command-line arguments?

2008-07-16 Thread Gary Herron
Keith Hughitt wrote: Hi all, I am using someone else's script which expects input in the form of: ./script.py arg2 I was wondering if the angle-brackets here have a special meaning? It seems like they specify an input and output stream to use in place of the console. I could not find any

poplib 100% cpu usage

2008-07-16 Thread Oli Schacher
Hi all I wrote a multithreaded script that polls mails from several pop/imap accounts. To fetch the messages I'm using the getmail classes ( http://pyropus.ca/software/getmail/ ) , those classes use the poplib for the real pop transaction. When I run my script for a few hours cpu usage goes

Re: Angle brackets in command-line arguments?

2008-07-16 Thread Keith Hughitt
On Jul 16, 11:16 am, Gary Herron <[EMAIL PROTECTED]> wrote: > Keith Hughitt wrote: > > Hi all, > > > I am using someone else's script which expects input in the form of: > > >      ./script.py arg2 > > > I was wondering if the angle-brackets here have a special meaning? It > > seems like > > they

Re: MySQL Insert

2008-07-16 Thread maestroQC
Thanks to all for your time and patience with this! The insert is working fine based on the suggestions in this thread. I now have another problem that should be resolved with a regular expression to remove currency formatting before inserting into the db. -- http://mail.python.org/mailman/listinf

Setting Message Importance using SMTP Mail

2008-07-16 Thread Whyatt
Hi all, I'm trying to create a message using SMTP Mail through Python with a message Importance of either 0 (Low) or 2 (High). If I do outer.Add_header('Importance', '0') it is ignored. If I do uter.Replace_header('Importance', '0') I get the error below. Traceback (most recent call last): Fil

Re: About wmi

2008-07-16 Thread patrol
On 7月16日, 下午10时39分, Tim Golden <[EMAIL PROTECTED]> wrote: > patrol wrote: > > The errors are in the following: > > > Traceback (most recent call last): > > File "D:\My Documents\code\python\wmi\test.py", line 5, in > > c = wmi.WMI ("non-existent computer") > > File "C:\Python25\lib\wmi.py"

Re: About wmi

2008-07-16 Thread Tim Golden
patrol wrote: > -2147023174 > 'RPC \xb7\xfe\xce\xf1\xc6\xf7\xb2\xbb\xbf\xc9\xd3\xc3\xa1\xa3' > None > None > > -- > import pythoncom > import win32com.client > > > try: > win32com.client.GetObject ("winmgmts://blahblah") > exc

Is there any interest in working on an application?

2008-07-16 Thread Ron Longo
Hello, I have an python application which I've been developing for several years (off and on, mostly off for lack of time) which I'm considering putting up to open source if I can find other developers interested in contributing. The application is a web publisher/information outliner. (See an

Re: Regular expression

2008-07-16 Thread bearophileHUGS
On Jul 16, 4:14 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Beema shafreen wrote: > > How do I write a regular expression for this kind of sequences > > > >gi|158028609|gb|ABW08583.1| CG8385-PF, isoform F [Drosophila melanogaster] > > MGNVFANLFKGLFGKKEMRILMVGLDAAGKTTILYKLKLGEIVTTIPTIGFNVETVE >

Re: About wmi

2008-07-16 Thread Tim Golden
Assuming that the error comes back in the sys.stdout encoding, the following version *should* work ok. I still haven't got a non-English set up to test it on, but it certainly does return a Unicode error message. http://timgolden.me.uk/wmi-project/wmi.py The usual test case, if you wouldn't min

Eclipse, Pydev, question

2008-07-16 Thread Ken Starks
I have a small project for further development in eclipse, using the pyDev plug-in. I am working on foo.py and bar.pyc is also in the directory. bar.py is not in the directory; it is someone else's (confidential) file, and I don't get the python source. Can I run bar.pyc from eclipse ? -- http:

Re: how to match whole word

2008-07-16 Thread Peng Yu
On Jul 15, 10:29 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > Peng Yu wrote: > > Hi, > > > The following code snippet is from /usr/bin/rpl. I would like the it > > to match a word, for example, "abc" in ":abc:". But the current one > > would not match "abc" in ":abc:". I tried to modify it myself.

Framework recommendations for web service?

2008-07-16 Thread Phillip B Oldham
We're looking at the next phase of development for our webapp, and the main focus will be to move the core from the app to a web service so other systems can use the data we've gathered (we're thinking along the lines of the XML API of Highrise from 37Signals). Its possible that we'll extend the s

Re: how to match whole word

2008-07-16 Thread Fredrik Lundh
Peng Yu wrote: I didn't read the docs and tried the following code. regex = re.compile(r"\A" + re.escape(old_str) + r"\Z", opts.ignore_case and re.I or 0) But I'm not sure why it is not working. as the documentation says, \A and \Z matches at the beginning/end of a *string*, not a word.

Re: About wmi

2008-07-16 Thread patrol
On 7月16日, 下午11时59分, Tim Golden <[EMAIL PROTECTED]> wrote: > patrol wrote: > > -2147023174 > > 'RPC \xb7\xfe\xce\xf1\xc6\xf7\xb2\xbb\xbf\xc9\xd3\xc3\xa1\xa3' > > None > > None > > > -- > > import pythoncom > > import win32com.client

Re: About wmi

2008-07-16 Thread patrol
On 7月17日, 上午12时16分, Tim Golden <[EMAIL PROTECTED]> wrote: > Assuming that the error comes back in the sys.stdout encoding, the following > version *should* work ok. I still haven't got a non-English set up to test it > on, but it certainly does return a Unicode error message. > > http://timgolden

Re: Best Python packages?

2008-07-16 Thread Dennis Cote
Ben Sizer wrote: I'd love to have some way of finding out what hidden gems are out there in the Python world If they were easy to find, they wouldn't be "hidden gems". :-) Dennis Cote -- http://mail.python.org/mailman/listinfo/python-list

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-16 Thread norseman
> > I need to know if I'm running on 32bit or 64bit ... so far I haven't > > come up with how to get this info via python. sys.platform returns > > what python was built on ... but not what the current system is. > > > > I thought platform.uname() or just platform.processor() would have > > done

Re: how can i save my command prompt screen?

2008-07-16 Thread norseman
Ty hensons wrote: > how can i save my command prompt screen? == That by itself leaves lots of questions. Taken literally to be the "box" then: In Microsoft use the "Print Screen" followed by mspaint and Edit/paste (Or SHIFT-PrintScreen if whole

Re: how can i save my command prompt screen?

2008-07-16 Thread Mike Driscoll
On Jul 16, 12:28 pm, norseman <[EMAIL PROTECTED]> wrote: > Ty hensons wrote: > >  > how can i save my command prompt screen? > > == > > That by itself leaves lots of questions.  Taken literally to be the > "box" then: > > In Microsoft use the "Print Scree

For_loops hurt my brain.

2008-07-16 Thread bsagert
This script uses a simple for loop to zip some files. However I am repeating code that cries out for a nested loop. My two lists of files_to_be_zipped (spare and seekfacts) are of uneven length so I can't seem to decipher the "for_logic". I would appreciate any help. Thanks, Bill import zipfile im

Re: About wmi

2008-07-16 Thread Tim Golden
patrol wrote: import wmi wmi.WMI('non-existent computer') > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\lib\wmi.py", line 1199, in connect > handle_com_error (error_info) > File "C:\Python25\lib\wmi.py", line 184, in handle_com_error > excep

Is there any component-oriented (non-MVC) web framework available for Python?

2008-07-16 Thread Alis
Hi Is there any component-oriented (non-MVC) web framework available for Python? That is something like Apache Wicket, Tapestry or JSF, but I need it to be in Python. Regards, Ali -- http://mail.python.org/mailman/listinfo/python-list

Uploading an image using PUT

2008-07-16 Thread noelob
Hi All, Let me start by saying that's I'm relatively new to Python, so please be gentle! I need to up upload a file to a Tomcat web app using httplib. The web app requires the following: Files need to be split into 100kb (102400b) and each file segment loaded using the PUT request. It is also a r

Re: For_loops hurt my brain.

2008-07-16 Thread Dan
On Jul 16, 1:42 pm, [EMAIL PROTECTED] wrote: > This script uses a simple for loop to zip some files. However I am > repeating code that cries out for a nested loop. My two lists of > files_to_be_zipped (spare and seekfacts) are of uneven length so I > can't seem to decipher the "for_logic". I would

Re: Converting from local -> UTC

2008-07-16 Thread Keith Hughitt
Thanks Gabriel! That helps clear things up for me. The above method works very well. I only have one remaining question: How can I pass a datetime object to MySQL?' So far, what I've been doing is building the query as a string, for example: query = "INSERT INTO image VALUES(%d, %d, %s, '%s')" %

Re: Is there any component-oriented (non-MVC) web framework available for Python?

2008-07-16 Thread Phillip B Oldham
On Jul 16, 6:48 pm, Alis <[EMAIL PROTECTED]> wrote: > Hi > > Is there any component-oriented (non-MVC) web framework available for > Python? > > That is something like Apache Wicket, Tapestry or JSF, but I need it > to be in Python. > > Regards, > Ali Have you looked at kamaelia? http://kamaelia.

Re: bad recursion, still works

2008-07-16 Thread Peter Pearson
On Wed, 16 Jul 2008 15:20:23 +0200, Fredrik Lundh wrote: [snip] > Hope this helps more than it confuses. Absolutely. It is wonderfully enlightening. Many thanks. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing for connection to a website

2008-07-16 Thread Alexnb
Fredrik Lundh wrote: > > Alexnb wrote: > >> e = '' > >> try: >> ... >> except HTTPError, e: >> print e.code >> except URLError, e: >> print e.reason >> >> if e == '': >> print "good to go" > > footnote: here's a better way to test if an exception was raised or not: > >

Re: Is re.findall guaranteed to be "in order?"

2008-07-16 Thread Joshua Kugler
Fredrik Lundh wrote: > Joshua Kugler wrote: > >> Experimenting has shown me that re.findall() will return a list with the >> matches in the order it found them. > > "in the order it found them" doesn't really say much, does it? ;-) > > "findall" and "finditer" both scans the string from left to

py2exe issues with pictures and icons

2008-07-16 Thread Alexnb
Hello I am sure most of you are familiar with py2exe. I am having a bit of a problem. See the program has a few pictures involved and the .ico it uses for the windows. However, the pictures are stored in the same directory as the source, something like: C:\Docs and settings\me\My docs\python\prog

Re: Framework recommendations for web service?

2008-07-16 Thread Joshua Kugler
Phillip B Oldham wrote: > So, can anyone suggest a lightweight python framework which just does > the essentials? web.py is pretty slim (not to be confused with web2py). Pylons isn't very large, depending on what you call "essential." j -- http://mail.python.org/mailman/listinfo/python-list

Re: Framework recommendations for web service?

2008-07-16 Thread Ivan Ven Osdel
>What we *do* need is a lightweight, simple framework that will allow >us to create a RESTful interface and throw code together fast. We'll >probably go with SQLObject (unless we can extract the ORM from django >- lazy evaluation would be very useful), and we're just looking for >something fast and

Re: Framework recommendations for web service?

2008-07-16 Thread Ivan Ven Osdel
>I don't think RESTful interfaces are built in but I know people have >succesfully built RESTful apps on top of CherryPy. Also plans >for REST in >CherryPy 3 look promising. Here is a post I ran across from one of the >contributers. >"Hey there, >CherryPy 3 is currently under brainstorming bef

New to Python - Accessing Lotus Notes

2008-07-16 Thread KDawg44
Hi, We have a Lotus Notes Database that tracks time spent on projects. What I would like to do is develop a Time Tracker in Python that communicates with the server. This would pull projects in and allow a use to start a timer as he/she works on a given project. The user would then be able to co

Re: About wmi

2008-07-16 Thread Tim Golden
patrol wrote: > On 7月17日, 上午12时16分, Tim Golden <[EMAIL PROTECTED]> wrote: >> Assuming that the error comes back in the sys.stdout encoding, the following >> version *should* work ok. I still haven't got a non-English set up to test >> it on, but it certainly does return a Unicode error message. >

Re: py2exe issues with pictures and icons

2008-07-16 Thread Mike Driscoll
On Jul 16, 1:37 pm, Alexnb <[EMAIL PROTECTED]> wrote: > Hello > > I am sure most of you are familiar with py2exe. I am having a bit of a > problem. See the program has a few pictures involved and the .ico it uses > for the windows. However, the pictures are stored in the same directory as > the sou

Re: New to Python - Accessing Lotus Notes

2008-07-16 Thread Mike Driscoll
On Jul 16, 2:11 pm, KDawg44 <[EMAIL PROTECTED]> wrote: > Hi, > > We have a Lotus Notes Database that tracks time spent on projects. > What I would like to do is develop a Time Tracker in Python that > communicates with the server.  This would pull projects in and allow a > use to start a timer as h

Re: py2exe issues with pictures and icons

2008-07-16 Thread Alexnb
Mike Driscoll wrote: > > On Jul 16, 1:37 pm, Alexnb <[EMAIL PROTECTED]> wrote: >> Hello >> >> I am sure most of you are familiar with py2exe. I am having a bit of a >> problem. See the program has a few pictures involved and the .ico it uses >> for the windows. However, the pictures are stored

Re: py2exe issues with pictures and icons

2008-07-16 Thread Alexnb
Alexnb wrote: > > > > Mike Driscoll wrote: >> >> On Jul 16, 1:37 pm, Alexnb <[EMAIL PROTECTED]> wrote: >>> Hello >>> >>> I am sure most of you are familiar with py2exe. I am having a bit of a >>> problem. See the program has a few pictures involved and the .ico it >>> uses >>> for the window

  1   2   >