Re: Logging all activity on a tty/pty?

2005-08-23 Thread Adriaan Renting
I only do this on Linux, and it will probably not work on all versions of Unix, not even to mention Windows, but I basically have used the code of Pexpect and removed the part that does the expecting. ;-) The author of the Pexpect module also has clearly documented potential pitfalls in his FAQ.

FileIO problem

2005-08-23 Thread Layin'_Low
i'm havin a problem with this simple program. i need the output of this loop to be written to a file but i dont know how to do it!! this is what i have right now: gclas = raw_input("What is the class:") count = 0 while count != 1000: count = count + 1 print "Admin forceclass " , count , gc

Re: where does __class__ come from?

2005-08-23 Thread Adriaan Renting
You might find the chapter 3.3 (in my python 2.3.4, it's "Special Method names") in the reference manual useful, it is the only place I have found sofar that describes most of these special methods. It does however not contain __class__. I don't know where in the reference manual to find it's de

Externally-defined properties?

2005-08-23 Thread Terry Hancock
Frankly, I was surprised this worked at all, but I tried creating a property outside of a class (i.e. at the module level), and it seems to behave as a property: >>> def get_x(ob): ... global x ... return str(x) ... >>> def set_x(ob, value): ... global x ... x = int(value) ... >>>

Re: Jargons of Info Tech industry

2005-08-23 Thread Richard Bos
l v <[EMAIL PROTECTED]> wrote: > Mike Schilling wrote: > > A formatting-only subset of HTML would be useful for both e-mail and Usenet > > posts. > > I would *agree* (your news reader may bold that last word) It had bloody better not. You're cross-posting this to a C newsgroup, where *ptr* 4

shelve non-transparency

2005-08-23 Thread Paul Rubin
class x: pass z = x() z.a = 'a' d = {'a': z} for i in range(5): print id(d['a']) prints the same id 5 times as you'd expect. d = shelve('filename') d['a'] = z for i in range(5): print id(d['a']) prints five different id's. So, for example, y = d['

Re: loop in python

2005-08-23 Thread Terry Hancock
On Tuesday 23 August 2005 05:35 am, bruno modulix wrote: > km wrote: > >>If you want a fast language, try Holden. I've just invented it. > >>Unfortunately it gets the answer to every problem wrong unless the > >>answer is 42, but boy it runs quickly. The code for the whole > >>interpreter (it's

Re: How to get a unique id for bound methods?

2005-08-23 Thread Fredrik Lundh
Russell E. Owen wrote: > Having looked at it again, it is familiar. I copied it when I wrote my > own code. I avoided using at the time both because the initial > underscore suggested it was a private method and because it introduces > an extra function call. > > _register has the same weakness th

Re: Sorta noob question - file vs. open?

2005-08-23 Thread Fredrik Lundh
Peter A.Schott wrote: > Been reading the docs saying that file should replace open in our code, > but this > doesn't seem to work: what docs? "open" is the preferred way to open a file. "file" is a type constructor. in contemporary python, they happen to map to the same callable, but that's no

Re: list insertion

2005-08-23 Thread Jordan Rastrick
What you've posted looks right, more or less. To get any sort of meaningful feedback, you really need to post a full version of your code, including the print statements, what's being printed, and why you think this shows the code is not working. What you've shown is far too little for anybody els

Re: Eve from Adams' Ribs

2005-08-23 Thread Godwin
yes i did hear about sqlobject but as u said it doesn't support oracle yet. Thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: Eve from Adams' Ribs

2005-08-23 Thread Godwin
Thanx for the links , i loved the "monty lingua" module u gave me before. -- http://mail.python.org/mailman/listinfo/python-list

Re: Eve from Adams' Ribs

2005-08-23 Thread Godwin
www.devx.com/dbzone/Article/22093 U've made a point and i have seen that approach in the above article. But i was curious about creating python classes and code on fly. The only way i could do it was by using exec function. Is there a standard way of doing it. What are the plus points of such kind

RE: Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Robert Brewer
Adam Atlas wrote: > Never mind... I've found a workable solution: > http://mail.python.org/pipermail/python-list/2001-August/062214.html > > Robert, thanks, I'll still check that out for any future projects; but > for my current purpose, it seems overkill. But I don't know for sure; > assuming Bas

RE: Doubt C and Python

2005-08-23 Thread Delaney, Timothy (Tim)
Terry Hancock wrote: >* The claim that a Human can optimize code better than > the compiler assumes a very smart and talented Human, > and/or a very dumb compiler. Compilers are getting smarter, > and since a lot more people find the need to program, the >

Re: Jargons of Info Tech industry

2005-08-23 Thread Mike Meyer
"Mike Schilling" <[EMAIL PROTECTED]> writes: > "l v" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Xah Lee wrote: >>> (circa 1996), and email should be text only (anti-MIME, circa 1995), >> >> I think e-mail should be text only. I have both my email and news readers >> set to

list insertion

2005-08-23 Thread Randy Bush
i am trying to insert into a singly linked list hold = self.next self.next = DaClass(value) self.next.next = hold but i suspect (from print statement insertions) that the result is not as i expect. as the concept and code should be very common, as i am too old for pride, i thought i

Re: Logging all activity on a tty/pty?

2005-08-23 Thread Grant Edwards
On 2005-08-23, Dan Stromberg <[EMAIL PROTECTED]> wrote: > > Is there a way, using python, to (voluntarily) log all activity in a > given shell, in a way that should work on pretty much all *ix's with a > port of python? Yes. Assuming the Unix implimentation has ptys. -- Grant Edwards

Re: Doubt C and Python

2005-08-23 Thread Terry Hancock
On Tuesday 23 August 2005 06:28 am, Will McGugan wrote: > praba kar wrote: > >I want to know the link between c and python. > >Some people with C background use Python instead > > of programming in C.why? For the same reason that people acquainted with assembly language nevertheless ch

Re: how to deal with space between numbers

2005-08-23 Thread Bengt Richter
On Tue, 23 Aug 2005 19:20:15 +0200, Mohammed Altaj <[EMAIL PROTECTED]> wrote: > >Dear All > >This is my problem again , I tried to sort it out , but i couldn't , I >am reading data from file using readlines , my input like : > >0 1 2 4 >1 2 4 >2 3 >3 4 > >What i am doing is , starting with the f

Re: The ONLY thing that prevents me from using Python

2005-08-23 Thread Chris Smith
> "Kevin" == Kevin <[EMAIL PROTECTED]> writes: Kevin> I have been using java (jsp/servlets), vb/asp and perl for Kevin> a few years. Almost all my projects are web site Kevin> development related, and many of my clients' web sites are Kevin> hosted on those shared web hosting

Anyone recognize this numeric storage format - similar to "float", but not quite

2005-08-23 Thread geskerrett
We are working on a project to decipher a record structure of an old accounting system that originates from the late80's mid-90's. We have come across a number format that appears to be a "float" but doesn't match any of the more standard implementations. so we are hoping this is a recognizable num

Re: Sequential XML parsing with xml.sax

2005-08-23 Thread peter
Hi. Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > The API reference isn't clear on whether parseString can only handle > > discrete bits of valid XML > > the documentation says that "parse" expects an XML document, > and that "parseString" is the same thing, but parses from a buffer. OK,

Inline::Python, pyperl, etc.

2005-08-23 Thread Eli Stevens (WG.c)
The group I work with is trying to be language agnostic between Python and perl. We are trying to make it so that we are able to call our various APIs from one language or the other without having to care* what language the API was written in. I've been looking into: Inline::Python 0.22 http:

Re: Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Adam Atlas
Never mind... I've found a workable solution: http://mail.python.org/pipermail/python-list/2001-August/062214.html Robert, thanks, I'll still check that out for any future projects; but for my current purpose, it seems overkill. But I don't know for sure; assuming BaseHTTPServer is good enough for

Re: while c = f.read(1)

2005-08-23 Thread Magnus Lycka
Antoon Pardon wrote: > Such a PEP would have no chance of being accepted, since > it would break to much existing code. What's the point of this thread then? > But how can you do this when somewhere else '' is used as > an indication for an EOF. If that's your problem, I guess that's what you sh

RE: Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Robert Brewer
Adam Atlas wrote: > Is there any built-in way for BaseHTTPServer to handle multiple > connections at once, e.g. with threads? If not, can this existing > module be easily extended to do this, or will I have to do lower-level > socket things (and probably thus have to write my own HTTP code)? Do yo

Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Adam Atlas
Is there any built-in way for BaseHTTPServer to handle multiple connections at once, e.g. with threads? If not, can this existing module be easily extended to do this, or will I have to do lower-level socket things (and probably thus have to write my own HTTP code)? Thanks. Adam -- http://mail.

Re: Lightweight Python distribute it in under 2MBs for Win32

2005-08-23 Thread fred.dixon
long delay on reply due to pc death. i made a simple gui that picked paragraphs from a file with wxpython. using py2exe i bundled the program then packaged it with INNO install. it was 3megs. now its about 4 megs after a revision. I give you the source if you want. it uses python 241 and the lates

Re: Machine Name

2005-08-23 Thread Steve Holden
Harlin Seritt wrote: > How does one get the machine name with Python that the actual script is > running on? Obviously, one could parse the hosts file but I was > wondering if there was a quick way to get it done? > > thanks, > > Harlin Seritt > >>> from socket import gethostname >>> gethost

Re: Sorta noob question - file vs. open?

2005-08-23 Thread Steve Holden
Peter A.Schott wrote: > Been reading the docs saying that file should replace open in our code, but > this > doesn't seem to work: > > # Open file for writing, write something, close file > MyFile = file("MyFile.txt", "w") > MyFile.write("This is a test.") > MyFile.close() > > However, using: >

Logging all activity on a tty/pty?

2005-08-23 Thread Dan Stromberg
Is there a way, using python, to (voluntarily) log all activity in a given shell, in a way that should work on pretty much all *ix's with a port of python? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to 'touch' a file?

2005-08-23 Thread Bengt Richter
On Tue, 23 Aug 2005 08:23:40 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Fredrik Lundh wrote: >> Peter Hansen wrote: >> >>>You've quoted selectively. He also said "Unix-style 'touch'", from >>>which one could quite legitimately infer >> >> nope. read his post again. > >Sigh. You're being

Machine Name

2005-08-23 Thread Harlin Seritt
How does one get the machine name with Python that the actual script is running on? Obviously, one could parse the hosts file but I was wondering if there was a quick way to get it done? thanks, Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading just a few lines from a text file

2005-08-23 Thread John Machin
[EMAIL PROTECTED] wrote: > I have a text file with many hundreds of lines of data. The data of > interest to me, however, resides at the bottom of the file, in the last > 20 lines. Right now, I read the entire file and discard the stuff I > don't need. I'd like to speed up my program by reading onl

Re: Sorta noob question - file vs. open?

2005-08-23 Thread Jason Drew
Both your code snippets above work should work OK. If it seems like a file isn't being written, maybe you should specify its full path so you are sure about where to check for it. On the file-or-open question, the Python docs state, "The intent is for open() to continue to be preferred for use as

Re: Sorta noob question - file vs. open?

2005-08-23 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, Peter A. Schott <[EMAIL PROTECTED]> wrote: >Been reading the docs saying that file should replace open in our code, but >this >doesn't seem to work: > ># Open file for writing, write something, close file >MyFile = file("MyFile.txt", "w") >MyFile.write("This is a

Re: How to get a unique id for bound methods?

2005-08-23 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Russell E. Owen wrote: > The current issue is associated with Tkinter. I'm trying to create a tk callback function that calls a python "function" (any python callable entity). To do that, I have to cr

Re: pipes like perl

2005-08-23 Thread max(01)*
max(01)* wrote: > infidel wrote: > >> Here's one technique I use to run an external command in a particular >> module: >> >> stdin, stdout, stderr = os.popen3(cmd) >> stdin.close() >> results = stdout.readlines() >> stdout.close() >> errors = stderr.readline

Re: Sorta noob question - file vs. open?

2005-08-23 Thread Scott David Daniels
Peter A. Schott wrote: > Been reading the docs saying that file should replace open in our code, but > this > doesn't seem to work: This was really a misstatement; open is still preferred. file is now a built in class, and its constructor is the same as open. I think the current docs have been f

Re: Reading just a few lines from a text file

2005-08-23 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Right now my code reads as follows: > > infile=file(FileName) > for line in reversed(infile.readlines()): #Search from the bottom up Not sure if python does some tricks here - but for me that seems to be uneccesary shuffling around of data. Better do for line in reve

Re: while c = f.read(1)

2005-08-23 Thread John Machin
Greg McIntyre wrote: > John Machin wrote: > >>How about >>for c in f.read(): >>? >>Note that this reads the whole file into memory (changing \r\n to \n on >>Windows) ... performance-wise for large files you've spent some memory >>but clawed back the rather large CPU time spent doing f.read(1)

Re: how to deal with space between numbers

2005-08-23 Thread Diez B. Roggisch
> Thanks a lot for your valuable answer, i like the way you code , but i > would like to use my own, so if it is possible for you and if you have > time, please could you fix my code, so that i can do what i want. > Because i am using the this out put to another one , and i have the same > proble

Sorta noob question - file vs. open?

2005-08-23 Thread Peter A.Schott
Been reading the docs saying that file should replace open in our code, but this doesn't seem to work: # Open file for writing, write something, close file MyFile = file("MyFile.txt", "w") MyFile.write("This is a test.") MyFile.close() However, using: MyFile = open("MyFile.txt", "w") MyFile.write

Re: High Level FTP library

2005-08-23 Thread Peter A.Schott
I've used the ftputil package before with some success. It's not bad, but it really depends on what you're trying to do. If you write a couple of custom functions to get you started, you should be able to put those in a module and re-use as needed. I know that I had to code my own stuff to handl

ftplib - issues with some files not completing?

2005-08-23 Thread Peter A.Schott
Any tips/tricks on how to ensure that I've got the complete file before closing the local file? I think my code is basically correct and works more than 99% of the time, but it still has an occasional issue with an encrypted file where it doesn't receive the whole file and I can't decrypt it. Sho

Re: how to deal with space between numbers

2005-08-23 Thread Terry Reedy
Your input data file must be formatted in such a way that the program, knowing the format, can separate one number from another. There are two basic ways to do this. 1. Separate the numbers with non-digit characters, such as spaces. (Other characters such as commas are also used, but are more

Re: Reading just a few lines from a text file

2005-08-23 Thread tkpmep
Right now my code reads as follows: infile=file(FileName) for line in reversed(infile.readlines()): #Search from the bottom up if int(line.split()[0]) == MyDate: Data= float(line.split()[-1]) break infile.close() I have to read about 10,000 files, each with data. I'm l

Re: Jargons of Info Tech industry

2005-08-23 Thread Ulrich Hobelmann
Roger Leigh wrote: >> At least he noticed that tar sucks. There's nothing better than tarring >> your backup back to disk, only to notice that the pathnames were "too >> long." Great! > > That's been fixed for quite some time, though. The current GNU tar > (1.15.1) writes POSIX.1-2001 (PAX) a

Re: split function

2005-08-23 Thread Bengt Richter
On Mon, 22 Aug 2005 22:14:55 +0200, Mohammed Altaj <[EMAIL PROTECTED]> wrote: > >Dear all > >Sorry , I confused between two things , what i said in the last e-mail i >already managed to do using C code , But what i need to do using python >is : my input data : > >0 2 3 4 >1 2 4 >2 3 >3 4 > >what

Re: Sandboxes

2005-08-23 Thread Diez B. Roggisch
> Basically I just want a language to allow users to write macros, > interact with application objects, set property values, sequence > operations, supporting loops and branch logic and so forth. > > Something along the lines of a drawing program that allowed uers to > write and/or download scr

Re: Reading just a few lines from a text file

2005-08-23 Thread Paul McGuire
Are you sure this is really slowing down your program? "Many hundreds of lines" is not nearly enough to start Python breathing hard. I have been really impressed with just how quickly Python is able to do file input and processing, zipping through whole megs of data in just seconds. How are you

Re: Reading just a few lines from a text file

2005-08-23 Thread [EMAIL PROTECTED]
I just did strace on "tail -20 ". Apparently, it does seek to the end and reads enough data to cover 20 lines. I guess it is calculating this "size" by counting 20 new lines .You may try to do the same thing. Thanks, Raghu. -- http://mail.python.org/mailman/listinfo/python-list

Re:how to deal with space between numbers

2005-08-23 Thread Mohammed Altaj
> > >Read my answers to your two previous posts. >(in short : use str.split() - but *do* read my answers if you want to >save you a lot of pain) > > > > > > > Thanks a lot for your valuable answer, i like the way you code , but i would like to use my own, so if it is possible for you and if

Re: Reading just a few lines from a text file

2005-08-23 Thread rafi
[EMAIL PROTECTED] wrote: > I have a text file with many hundreds of lines of data. The data of > interest to me, however, resides at the bottom of the file, in the last > 20 lines. Right now, I read the entire file and discard the stuff I > don't need. I'd like to speed up my program by reading onl

Reading just a few lines from a text file

2005-08-23 Thread tkpmep
I have a text file with many hundreds of lines of data. The data of interest to me, however, resides at the bottom of the file, in the last 20 lines. Right now, I read the entire file and discard the stuff I don't need. I'd like to speed up my program by reading only the last 20 lines. How do I do

Re: Nested Regex Conditionals

2005-08-23 Thread Paul McGuire
This works (note relocated right paren at (?(second) ): #!/usr/bin/env python import re original_pattern = re.compile(r""" (?P(first)) (?(first) (?P(second)) ) (?(second) (?P(third)) ) """, re.VERBOSE) pattern = re.compile(r""" (?P(first))

Re: setlocale() in a module/extension library

2005-08-23 Thread Martin v. Löwis
Damien Elmes wrote: > My question is this: it would be nice if every user of my library > didn't need to add the above two lines to their code. But on the other > hand, I'm unsure of the implications of modifying the locale from > within a module, and it doesn't seem very clean. Would calling > set

Re: Jargons of Info Tech industry

2005-08-23 Thread Roger Leigh
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ulrich Hobelmann <[EMAIL PROTECTED]> writes: > Keith Thompson wrote: >> "Xah Lee" <[EMAIL PROTECTED]> writes: >> [the usual] > At least he noticed that tar sucks. There's nothing better than tarring > your backup back to disk, only to notice that t

Re: where does __class__ come from?

2005-08-23 Thread Diez B. Roggisch
> Where does __class__ come from, what does it mean and what else is > being hidden? > > I am used to using dir(...) to figure out what I can play with. > Clearly that does not always work... :-( Your question has benn answered - let me just add this from the dir()-docs: Note: Because dir() is s

Twisted Conch for emulating a terminal?

2005-08-23 Thread John F.
I'm trying to figure out how to emulate a terminal with twisted conch (I want to be able to send the client information with the 'write' command in freebsd). I have played with ssshsimpleclient.py on the twistedmatrix site and it works but I need to keep the connection open, not just execute a sin

Re: how to deal with space between numbers

2005-08-23 Thread rafi
bruno modulix wrote: > Mohammed Altaj wrote: > >>Dear All >> >>This is my problem again , > > (snip) > Read my answers to your two previous posts. > (in short : use str.split() - but *do* read my answers if you want to > save you a lot of pain) especially when several persons replied to you...

Line Removal strategy

2005-08-23 Thread PyPK
Hi I am looking for a simple algorithm for removing straight lines in a given Image using something like an PIL or simpler. -- http://mail.python.org/mailman/listinfo/python-list

Re: pipes like perl

2005-08-23 Thread max(01)*
infidel wrote: > Here's one technique I use to run an external command in a particular > module: > > stdin, stdout, stderr = os.popen3(cmd) > stdin.close() > results = stdout.readlines() > stdout.close() > errors = stderr.readlines() > stderr.close()

Re: How to get a unique id for bound methods?

2005-08-23 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Russell E. Owen wrote: > The current issue is associated with Tkinter. I'm trying to create a tk callback function that calls a python "function" (any python callable entity). To do that, I have to cr

Re: py-serial + CSV

2005-08-23 Thread McBooCzech
Sergei, I do not realy understand your comment??? Am I missing something? BTW, is there some possibility to address lists like: print words [1; 3; 5] instead of print words[1], words[3], words[5] Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: High Level FTP library

2005-08-23 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, "Paulo Pinto" <[EMAIL PROTECTED]> wrote: >Hello, > >Is there any Python library similar to NET::FTP from Perl? >ftplib seems too lowlevel. > >I already found a few, but would like to get one that is >endorsed by the community. Try urllib or urllib2; these are incl

Re: setlocale() in a module/extension library

2005-08-23 Thread Jarek Zgoda
Damien Elmes napisał(a): > My question is this: it would be nice if every user of my library > didn't need to add the above two lines to their code. But on the other > hand, I'm unsure of the implications of modifying the locale from > within a module, and it doesn't seem very clean. Would calling

setlocale() in a module/extension library

2005-08-23 Thread Damien Elmes
Hi folks, I've got a module + C extension which provides on screen display support in X, via libxosd (http://repose.cx/pyosd). I've recently had a report of trouble where a Russian user was unable to display any Russian text. I've managed to resolve the issue by inserting the following two lines

Re: Sequential XML parsing with xml.sax

2005-08-23 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > The API reference isn't clear on whether parseString can only handle > discrete bits of valid XML the documentation says that "parse" expects an XML document, and that "parseString" is the same thing, but parses from a buffer. it's probably easier to pass a BZ2File ins

Re: Doubt C and Python

2005-08-23 Thread Wouter van Ooijen (www.voti.nl)
>For me, the choice is typically among C++, Perl, Python, and Java. The >arguments for Python relative to these languages are: > add: I develop on my platform (which happens to be XP, but that is irrelevant), I put the Python source on my website, and I never worry about the platform my users wi

Re: Doubt C and Python

2005-08-23 Thread Wouter van Ooijen (www.voti.nl)
> I want to know the link between c and python. Apart from the fact that the inner part of Python is written in C I know no link? > Some people with C background use Python instead >of programming in C.why? I use Python when my time is most valuable (in most cases it is), in the very few

Sequential XML parsing with xml.sax

2005-08-23 Thread peter
Hi hi. I'm trying to do sequential decompression of a bzipped XML file and feed it to a SAX parser with the following code. remotefh = urllib.urlopen('file:///home/peter/catalog.rdf.bz2') decompressor = bz2.BZ2Decompressor() handler = CatalogueDocumentHandler(sys.stdout) chunksize = 2048 data = r

Re: Jargons of Info Tech industry

2005-08-23 Thread Ulrich Hobelmann
l v wrote: > Xah Lee wrote: >> (circa 1996), and email should be text only (anti-MIME, circa 1995), > > I think e-mail should be text only. I have both my email and news > readers set to display in plain text only. It prevents the marketeers Be generous in what you accept and conservative in

Re: where does __class__ come from?

2005-08-23 Thread [EMAIL PROTECTED]
see http://docs.python.org/lib/specialattrs.html -- http://mail.python.org/mailman/listinfo/python-list

Re: py-serial + CSV

2005-08-23 Thread Sergei Organov
Steve Holden <[EMAIL PROTECTED]> writes: > McBooCzech wrote: [...] > > $GPRMC,174525.617,A,5026.1080,N,01521.6724,E,0.0,005.8,230805,,*0A > > etc > > > [...] > > s = serial.Serial(port=0,baudrate=4800, timeout=20) > > while 1: > > line = s.readline() > > words = line.split(',') > >

where does __class__ come from?

2005-08-23 Thread patrick . m . lahey
Newbie here... Ok, the following code: class Base: _count = 0 def __init__(self): self.__class__._count += 1 print dir(self) x = Base() the output is: ['__doc__', '__init__', '__module__', '_count'] Notice that __class__ is no where to be seen! Where does __class__ co

Re: pipes like perl

2005-08-23 Thread max(01)*
bruno modulix wrote: > max(01)* wrote: > >>hi. > > > (snip) > > >>it doesn't work, since "*do_something*" and *do_something_more* are >>always executed (it seems like >> >>MYPIPE = os.popen("*some_system_command*", "r") >> >>does not raise any exception even if *some_system_command* does not >

Re: DeprecationWarning: Non-ASCII character '\xf3'

2005-08-23 Thread Benjamin Niemann
jau wrote: > Hi co-listers! > > I have been off Python for 2 years and now, that i'm used to Eclipse and > Java, I decided to start a project with Python to refresh skills this > time using Eclipse and TrueStudio. But now, two things can be occured > since the last time i used it. > > the first

Re: DeprecationWarning: Non-ASCII character '\xf3'

2005-08-23 Thread Fredrik Lundh
"jau" <[EMAIL PROTECTED]> wrote: > print "hello world" > > i get this output > > hello world > sys:1: DeprecationWarning: Non-ASCII character '\xf3' in file > C:\Workspace\J&J\src\es\jau\main.py on line 2, but no encoding declared; > see http://www.python.org/peps/pep-0263.html for details > > the

Re: py-serial + CSV

2005-08-23 Thread Steve Holden
McBooCzech wrote: > Sorry, I did not mentioned the data flow from the serial port is > permanent/continuous (as long as the GPS receiver is connected to the > serial port). The input data are commning every second, they are comma > separated and they are looking like: > > $GPGGA,174525.617,5026.10

Re: py-serial + CSV

2005-08-23 Thread McBooCzech
Sorry, I did not mentioned the data flow from the serial port is permanent/continuous (as long as the GPS receiver is connected to the serial port). The input data are commning every second, they are comma separated and they are looking like: $GPGGA,174525.617,5026.1080,N,01521.6724,E,1,05,1.8,306

Re: pipes like perl

2005-08-23 Thread infidel
Here's one technique I use to run an external command in a particular module: stdin, stdout, stderr = os.popen3(cmd) stdin.close() results = stdout.readlines() stdout.close() errors = stderr.readlines() stderr.close() if errors: r

Re: pipes like perl

2005-08-23 Thread bruno modulix
max(01)* wrote: > hi. (snip) > it doesn't work, since "*do_something*" and *do_something_more* are > always executed (it seems like > > MYPIPE = os.popen("*some_system_command*", "r") > > does not raise any exception even if *some_system_command* does not > exist/work... > > any help? http://

Re: how to deal with space between numbers

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear All > > This is my problem again , (snip) > > I managed to do all these things , but i did it in the way that i am > reading my data as strings ( no space between numbers) something like > > 0124 > 124 > 23 > 34 > > what i would like to know or to do is , how can i

DeprecationWarning: Non-ASCII character '\xf3'

2005-08-23 Thread jau
Hi co-listers! I have been off Python for 2 years and now, that i'm used to Eclipse and Java, I decided to start a project with Python to refresh skills this time using Eclipse and TrueStudio. But now, two things can be occured since the last time i used it. the first one, something concerning

Re: split function

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear all > > Sorry , I confused between two things , what i said in the last e-mail i > already managed to do using C code , But what i need to do using python > is : my input data : > > 0 2 3 4 > 1 2 4 > 2 3 > 3 4 > > what i suppose to do is , using the first line and

Re: while c = f.read(1)

2005-08-23 Thread Bengt Richter
On 22 Aug 2005 02:48:24 -0700, Paul Rubin wrote: >"Greg McIntyre" <[EMAIL PROTECTED]> writes: >> while c = f.read(1): >> # ... >> >> I couldn't find any general PEPs along these lines, only specific ones >> (e.g. 308 re. an if-then-else expression). > >I often e

pipes like perl

2005-08-23 Thread max(01)*
hi. in perl i can do this: ... if (open (MYPIPE, "*some_system_command* |")) { ... *do_something* ... while ($answer = ) { print $answer; } ... *do_something_more* ... } else { ... *do_something_else* ... } ...

how to deal with space between numbers

2005-08-23 Thread Mohammed Altaj
Dear All This is my problem again , I tried to sort it out , but i couldn't , I am reading data from file using readlines , my input like : 0 1 2 4 1 2 4 2 3 3 4 What i am doing is , starting with the first element in the first line ( which is 0 in this case )and do search in the other lines

Re: while c = f.read(1)

2005-08-23 Thread Steve Holden
Dennis Lee Bieber wrote: > On Tue, 23 Aug 2005 12:15:36 +0200, Magnus Lycka <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>If you want the behaviour of Python to change, you should >>write a PEP. It always felt natural to me to interpret empty >>as false, but I could be

Re: High Level FTP library

2005-08-23 Thread Gregory Piñero
I reccomend ftputil (http://www.sschwarzer.net/python/python_software.html) also.  I went through the same thing you did about 2 months ago and ftputil was the best I found.  Here's a short script I wrote using ftputil: http://www.blendedtechnologies.com/instant-gratification-for-a-home-web-develop

Re: Jargons of Info Tech industry

2005-08-23 Thread l v
Mike Schilling wrote: > "l v" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Xah Lee wrote: >> >>>(circa 1996), and email should be text only (anti-MIME, circa 1995), >> >>I think e-mail should be text only. I have both my email and news readers >>set to display in plain text

Re: split function

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear All > > What i want to do is , my input is like > 0 2 > 0 3 > 0 4 > 1 2 > 1 4 > 2 3 > 3 4 > > I am comparing and put the number in group , like ,the first three lines > , all has zero as first input for each line, so the out put should look > like > 0 2 3 4 > and so o

Re: High Level FTP library

2005-08-23 Thread [EMAIL PROTECTED]
Paulo Pinto wrote: > Hello, > > Is there any Python library similar to NET::FTP from Perl? > ftplib seems too lowlevel. > > I already found a few, but would like to get one that is > endorsed by the community. > > Thanks, > Paulo Have you looked at ftputil? http://www.sschwarzer.net/python/pytho

Limited XML tidy

2005-08-23 Thread Toby White
I have a program which produces well-formed XML documents, but takes several hours if not days to do so. It would be useful to be able to take the incomplete output and manipulate it as XML. Clearly, however, the incomplete output will not be well- formed, so before being able to manipulate it I

Re: Jargons of Info Tech industry

2005-08-23 Thread Rich Teer
On Tue, 23 Aug 2005, Mike Schilling wrote: > A formatting-only subset of HTML would be useful for both e-mail and Usenet > posts. Nope; plain text for both mediums is, IMHO, th eonly way to go. -- Rich Teer, SCNA, SCSA, OpenSolaris CAB member President, Rite Online Inc. Voice: +1 (250) 979-16

Re: Jargons of Info Tech industry

2005-08-23 Thread axel
In comp.lang.perl.misc Chris Hills <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, jan V > <[EMAIL PROTECTED]> writes >>> +---+ .:\:\:/:/:. >>> | PLEASE DO NOT |:.:\:\:/:/:.: >>> | FEED THE TROLLS | :=.'

Limited XML tidy

2005-08-23 Thread Toby White
I have a program which produces well-formed XML documents, but takes several hours if not days to do so. It would be useful to be able to take the incomplete output and manipulate it as XML. Clearly, however, the incomplete output will not be well- formed, so before being able to manipulate it I

python asp page keeps state across queries !?!?

2005-08-23 Thread nicolas_riesch
I am writing asp pages in python, running on IIS 5 on Windows. I notice that variables outside functions keep their value across queries. I don't know if it is normal. Here is a little script that demonstrates it: -- problem.asp - <[EMAIL PROTECTED]> <% try

  1   2   >