Re: [Tutor] [unclassified] Re: Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
> In my first example, clamdscan should return 1 when the EICAR string is > found -- process.wait() gets 256 instead. In the second, clamdscan > returns 2 if an error occurs, such as trying to scan a non-existent > file, but 512 is returned. > > No doubt there is a reason why the exit code is get

Re: [Tutor] Linux variable to Python

2005-05-13 Thread Danny Yoo
On Fri, 13 May 2005, Alberto Troiano wrote: > Here is an example of what I want to do: > > I run over Linux shell the following command: > > [EMAIL PROTECTED] root]# fec=cam`date +%Y%m%d%H%M%S`.jpg > [EMAIL PROTECTED] root]# echo $fec > cam2005051255702.jpg > [EMAIL PROTECTED] root]# mv hola.txt

Re: [Tutor] Simple string processing problem

2005-05-13 Thread Danny Yoo
On 13 May 2005 [EMAIL PROTECTED] wrote: > Your help has made me realise the problem is more complex than I first > though though...I've included a small sample of an actual file I need to > process. The structure is the same as in the full versions though; some > lowercase, some uppercase, then

Re: [Tutor] Testing for commandline args

2005-05-13 Thread Danny Yoo
> > If I have arguments, the "different stuff" happens beautifully, thank > you very much. If I don't have arguments I get this: > > if sys.argv[1]: > IndexError: list index out of range] > > So I'm doing something wrong. I looked at getopt, but that seemed to be > doing what I was already doing,

Re: [Tutor] How to verify all things are equal to one another

2005-05-15 Thread Danny Yoo
> > Suppose I have several variables, e.g.: a, b, c, d, e, f, g. > > > > I would like to be able to see if they're all the same, I don't care > > what the value is, as long as they're equal. If they're all equal to > > 0, or to "spam", or to ["cleese", "idle", "gilliam"], as long as > > they're the

Re: [Tutor] Why use apply()?

2005-05-15 Thread Danny Yoo
On Thu, 12 May 2005, Bernard Lebel wrote: > Just a generic question: why one would use apply()? > > In Learning Python, on page 357, there is an example of generating an > instance using apply(): > > class A: > def __init__( self, number ): > self.number = number > > a = apply

Re: [Tutor] Pipe variable to external command (solved)

2005-05-15 Thread Danny Yoo
> Here is what the code I settled on looks like: > > ### > working = email.message_from_file(open(emailfile)) > > clamav = popen2.Popen3(clamav_cmd,1) > clamav.tochild.write(working.as_string()) > clamav.tochild.close() > clamav_result = clamav.fromchild.read().lstrip('stream: ') > clamav.fromchi

Re: [Tutor] Objects in List

2005-05-16 Thread Danny Yoo
Hi Danie, The enumerate() function takes a list of elements, and returns a list of (index, element) pairs. For example: ## >>> names = ["wilma", "fred", "betty", "barney"] >>> for p in enumerate(names): ... print p ... (0, 'wilma') (1, 'fred') (2, 'betty') (3, 'barney') ## Note th

Re: [Tutor] Objects in List (fwd)

2005-05-17 Thread Danny Yoo
> Hi Danny > > Thanks, it works - I must read the documentation more carefully! > > Would you mind if I knok on your door again with futher Python hick-ups? Hi Danie, It's probably a better idea to send your questions to Tutor. The reason is to allow the community to get involved. Also, I have

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Alberto Troiano wrote: > I'm working on Python 2.2 over Linux REd Hat 9.0 and here is the code I > have [code cut] > First I'd like to know if this code can be shorter or more efficient (if > you have the time) Yes. But let's look at the errors first. > Second the err

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Alberto Troiano wrote: > I'm sending the errors MySQLdb gives me when I try to install it. It's > hola.txt file > I'm doing python setup.py build and inside hola.txt you can see what it says > I have installed Linux Red Hat with ALL packages Hi Alberto, [Side note: please

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Alberto Troiano wrote: > Sorry about the question marks (MSN addiction :)) > > Didn't work and as I suspected it was already installed. Hi Alberto, I'm still thinking that the MySQL development packages are either damaged or mixed up, since the error message says that it c

Re: [Tutor] Perl equivalent of $#var

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Smith, Jeff wrote: > Is there a more Pythonic way to get the Perl equivalent of > $#var > other than > len(var) - 1 Hi Jeff, Just out of curiosity, where do you use Perl's $#var? Can you show us the context of its use? If we see context, it might help us fin

Re: [Tutor] ASCII characters

2005-05-24 Thread Danny Yoo
On Tue, 24 May 2005, Kent Johnson wrote: > D. Hartley wrote: > > I have a question: what is the "opposite" of hex()? (i.e., like ord > > and chr). If I have > > > > '0x73', how can I get back to 115 or s? > > I don't know a really clean way to do this because '0x73' is not a legal > input value

Re: [Tutor] xml

2005-05-24 Thread Danny Yoo
On Tue, 24 May 2005, D. Hartley wrote: > I looked at the page for ElementTree that Max sent out, but I can't > understand what it's even talking about. Hello Denise, ElementTree is a third-party module by the Effbot for handling some of the drudgery that is XML parsing: http://effbot.org

Re: [Tutor] Are Empty "Placeholder" Functions possible?

2005-05-26 Thread Danny Yoo
> Is there a way to create an empty function definition with no lines of > code in it? In my coding style I will often do this ( in other languages > ) for RAD just to remind myself that I will need to implement the > function later. Hi Nick, I agree with the others; using the no-op statement '

Re: [Tutor] Expression order problem

2005-05-26 Thread Danny Yoo
On Thu, 26 May 2005, William O'Higgins wrote: > I am running into problems with script evaluation order - specifically, > the Python interpreter seems to read and execute scripts line by line. Hi William, Ah! This happens to me too; one common idiom to avoid definition-order issues like this

Re: [Tutor] pattern matching problem

2005-05-26 Thread Danny Yoo
On 26 May 2005 [EMAIL PROTECTED] wrote: > I have to write a function that will return the index of a line like this: > > gvcdgvcgdvagTVTVTVTVTVTHUXHYGSXUHXSU > > where it first becomes capital letters. I've had about a hundred > different ideas of the best way to do this, but always seem to hit

Re: [Tutor] Program to lock folders under win32

2005-05-26 Thread Danny Yoo
On Thu, 26 May 2005, Mark Kels wrote: > I want to make a program to lock folders (so the user can only access > them if he knows the password) under win32, the only problem is that I > have no idea how to start or what to do. Do you guys have any ideas of > how to do it? Hi Mark, Out of curios

Re: [Tutor] pattern matching problem

2005-05-26 Thread Danny Yoo
On 26 May 2005 [EMAIL PROTECTED] wrote: > One of the worst I think was doing loads of real spazzy stuff trying to > split whole files in to lists of letters and use string methods to find > the first uppercase one. Hi Chris, An approach like this might work. Rather than read the whole thing i

Re: [Tutor] os.spawnlp and os.spawnlpe

2005-05-29 Thread Danny Yoo
On Sun, 29 May 2005, Jonas Melian wrote: > which is the difference between os.spawnlp and os.spawnlpe? With an > example, please. I don't understand it. Hi Jonas, The difference is that the one that ends with an 'e' allows us to make the spawned process use an entirely clean Unix shell environ

Re: [Tutor] skip some directories

2005-05-30 Thread Danny Yoo
On Mon, 30 May 2005, Jonas Melian wrote: > I'm trying to working with some directories only > > import os > dirName = "/usr/share/fonts/" > dirBase = ['misc','TTF','Type1','CID','100dpi','75dpi'] # directories to > skip > > for root, dirs, files in os.walk(dirName): > for end in dirBase: >

Re: [Tutor] Frozen Binaries

2005-05-30 Thread Danny Yoo
On Mon, 30 May 2005, Chuck Allison wrote: > Could someone please give me the quick lowdown on creating frozen > binaries? Thanks. Hi Chuck, On Windows, the 'py2exe' program's probably the most straightforward of the freezers: http://py2exe.sf.net That page has a complete toy example

Re: [Tutor] Planning a program with algorithm?

2005-05-30 Thread Danny Yoo
On Mon, 30 May 2005, Andrei wrote: > . , hotmail.com> writes: > > > But, I don't know how to plan a prog. with algorithm. > > For small programs there's little value in planning - in fact, you'll > probably end up wasting time. As far as individual algorithms go, it's > usually best to go with

Re: [Tutor] skip some directories

2005-05-31 Thread Danny Yoo
> At the end, i found the way of make it: > > dirBase = ['misc','TTF','Type1','CID','100dpi','75dpi','encodings', 'util'] > > for root, dirs, files in os.walk(dirName): > print dirs # for checking all directories that i have at beginning > for name in dirs: > if name in dirBase:

Re: [Tutor] Strange IndexError

2005-06-01 Thread Danny Yoo
On Wed, 1 Jun 2005, Willi Richert wrote: > in my code I get in rare occasions an IndexError which is > incomprehensible to me in that situation, where I do a simple > comparison: > > NeedBrain.py:233: RuntimeWarning: tp_compare didn't return -1 or -2 for > exception > self._isNearMarker = self

Re: [Tutor] IDLE not working?

2005-06-01 Thread Danny Yoo
On Wed, 1 Jun 2005, Jeff Peery wrote: > Hello, I upgraded python to 2.4 and now my IDLE isn't working. There is > an error indicating something is wrong with my configuration file for > the IDLE settings. Any suggestions for how to solve this problem would > be much appreciated. thanks. Hi Jeff

Re: [Tutor] imbedding python into another program?

2005-06-01 Thread Danny Yoo
On Wed, 1 Jun 2005, Jeff Peery wrote: > hello, is it possible to add something like the python IDLE into another > program Hi Jeff, Getting IDLE to work within wxPython is technically possible, but probably a little tricky, since it'll involve getting the GUI event loops to cooperate. I belie

Re: [Tutor] List processing

2005-06-01 Thread Danny Yoo
On 1 Jun 2005 [EMAIL PROTECTED] wrote: > I have a load of files I need to process. [text cut] > So basically its a table, separated with tabs. What I need to do is make > a new file where all the entries in the table are those where the values > in columns 1 and 5 were present as a pair more t

Re: [Tutor] imbedding python into another program?

2005-06-01 Thread Danny Yoo
On Wed, 1 Jun 2005, Jeff Peery wrote: > ok, thanks! that helps. I have an application that reads a data file, > crunches some numbers, and spits out some graphs. In addition to this I > would also like users to be able to write small python scripts to > operate on the data that is available wi

Re: [Tutor] Strange IndexError

2005-06-02 Thread Danny Yoo
On Thu, 2 Jun 2005, Willi Richert wrote: > my app is a Pyrobot (http://emergent.brynmawr.edu/~dblank/pyro/) > simulation which connects to PlayerStage (playerstage.sf.net) to > simulate three Pioneer robots. These are controlled using NeedBrain.py. > In parallel to the three NeedBrains there is

Re: [Tutor] insering into lists through slices

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, venkata subramanian wrote: > I am a newbie to Python (that's very guessable). > I simply fail to understand the semantics of the following piece of code. > #assuming ls=[1,2,3,4] > >>>ls[1:1]=[5,6] > #then ls becomes > >>> ls > [1, 5, 6, 2, 3, 4] > > i would be hap

Re: [Tutor] insering into lists through slices

2005-06-03 Thread Danny Yoo
> (For the gory details on what is allowed on the right hand side of an ^ > assignment, you can take a quick look at the Reference Manual: Hi Venkata, Gaaa, I don't know my left from my right. *grin* I meant to say "left" hand side, since

Re: [Tutor] Building an SQL query

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, Gabriel Farrell wrote: > def sqlNice(valueList): > count = 1 > y = '(' > for x in valueList: > x = x.replace("'", "''") > y = y + "'" + x + "'" > if count < len(valueList): > y = y + ', ' > count = count + 1 > y = y

Re: [Tutor] python and apache....

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, Taylor, Chris wrote: > How do I execute a python script on my apache server? > > *(I am attempting to install google's sitemap generator... Hi Chris, This is more of an Apache configuration question, so you may get better help by asking on an Apache-specific forum. It's no

Re: [Tutor] Postgresql+Python -tutorial?

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, Alan G wrote: > > I've been using MySQL up this day, but would like to convert my > > program to use Postgresql. > > I'm curious. Why? > Is there some advantage to Postgres over MySql? Hi Alan, Yes. The 'MySQL Gotchas' page details specifically some of the tricky areas th

Re: [Tutor] Class reference problem?

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, [EMAIL PROTECTED] wrote: > for item in function1(args): > object = class() > if (function2(item)): > if (condition): > object.variable = value > object.function() > print object # debug > print object #debug > > T

Re: [Tutor] how to generate random numbers in Python

2005-06-04 Thread Danny Yoo
On Fri, 3 Jun 2005, Xiaoxia Xu wrote: > I tried to use a Python library module random() to generate some noise > to my data. But the interpreter gave me an error message saying > NameError: name 'random' is not defined. I thought this error is > because I don't have the pertinent library includ

Re: [Tutor] CPAN for python

2005-06-06 Thread Danny Yoo
On Mon, 6 Jun 2005, Ron Nixon wrote: > Is there a site like Perl's CPAN for Python? I've seen the stuff at > ActiveState. Anything else? Hi Ron, Yes, there is a system called 'PyPI': http://www.python.org/pypi I hope this helps! ___ Tutor mai

Re: [Tutor] repr()

2005-06-07 Thread Danny Yoo
> Okay then I run > > s = repr( myFunc() ) > print s > > Wich returns > > 'None' Hi Bernard, Ok, what do you expect to see instead of 'None'? I ask this to make sure I understand the situation better. Best of wishes? ___ Tutor maillist - Tutor@py

Re: [Tutor] repr()

2005-06-07 Thread Danny Yoo
On Tue, 7 Jun 2005, Bernard Lebel wrote: > The real question is, then, is there a way I can print the code of a > function as a string? Something like > > 'def myFunction: print "hello"' Hi Bernard, Ah, ok. You can use 'inspect': http://www.python.org/doc/lib/inspect-source.html Fo

Re: [Tutor] remove from python

2005-06-07 Thread Danny Yoo
On Tue, 7 Jun 2005, The Johnsons wrote: > how can i get my email address removed, I'm receiving way too many > emails Hi Raywood1, You have a few options. You may want to see if just turning the Tutor mailing list setting to "Digest Mode" might help. You can do this through: http://mail

Re: [Tutor] Strange IndexError

2005-06-13 Thread Danny Yoo
On Mon, 13 Jun 2005, Willi Richert wrote: > I used the same Pyro code, but this time with the release versions of > player and stage. This time python crashed with a segfault: Hi Willi, If you see a segfault like this, it's almost definitely a bug in a third-party module. It is possible that

Re: [Tutor] can't see emacs timer in action

2005-06-14 Thread Danny Yoo
On Tue, 14 Jun 2005, Pujo Aji wrote: > I tried this code in emacs. > for i in range(3): > time.sleep(1) > print i > > It shows the result but total result not second per second. Hi Pujo, In Emacs, you may want to first start up a Python subprocess by using the keystroke: C-c ! and t

Re: [Tutor] can't see emacs timer in action

2005-06-14 Thread Danny Yoo
On Wed, 15 Jun 2005, Pujo Aji wrote: > Thanks Danny, > > Btw, I use xemacs now does it has folding class and method capabilities? Hi Pujo, [Note: in replies, please make sure to put tutor@python.org in CC.] According to: http://groups.google.ca/group/comp.lang.python/msg/956f1c2d37f93995?

Re: [Tutor] Buttons automatically executing

2005-06-15 Thread Danny Yoo
On Wed, 15 Jun 2005, Phillip Hart wrote: > Thanks for taking the time to read this. > > Excuse me if this falls under the boundaries of a "newbie" question, as > I am a self-taught programmer. Hi Phillip, It's a "newbie" question. But that's perfectly ok. *grin* > While using Tkinter to cr

Re: [Tutor] calling perl from python code

2005-06-20 Thread Danny Yoo
On Mon, 20 Jun 2005, Shuying Wang wrote: > Can anyone recommend a library that will let me call perl functions from > python? I have a python dictionary that I would like to convert to a > perl hash for some function. Hi Shuying, Sure! You may want to look at the PyPerl project: http://w

Re: [Tutor] loading an image into a Postgre database

2005-06-21 Thread Danny Yoo
On Tue, 21 Jun 2005, Mike Hansen wrote: > I'm having trouble loading an image into a Postgre database. The code is > below as well as the traceback in the apache log. Is something up with > my sqlStatement? Do I need to use something other than %s? How can I > avoid that type error? Hi Mike,

Re: [Tutor] loading an image into a Postgre database

2005-06-21 Thread Danny Yoo
> Thankfully, you don't have to change much to fix the formatting bug. The > only thing you'll need to do is let the SQL cursor do the value formatting > for you: > > ## > sqlStatement = """INSERT INTO images (image) > VALUES (%s); > cur.execute(sqlStatement, (data_obj)) > ##

Re: [Tutor] question about programmers

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005 [EMAIL PROTECTED] wrote: > What's the average age of a python user? This is my only question about > programmers themselves. Hi Catdude, We actually had a small thread about this a few months back. The subject line "O.T." from that thread didn't make it particularly eas

[Tutor] age of python programmers

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Danny Yoo wrote: > > > On Wed, 22 Jun 2005 [EMAIL PROTECTED] wrote: > > > What's the average age of a python user? This is my only question about > > programmers themselves. > > The message threading doesn't work perfectly, but j

Re: [Tutor] List of regular expressions

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Shidan wrote: > Hi I have a list of regular expression patterns like such: > > thelist = ['^594694.*','^689.*','^241.*', >'^241(0[3-9]|1[0145]|2[0-9]|3[0-9]|41|5[1-37]|6[138]|75|8[014579]).*'] > > > Now I want to iterate thru each of these like: > > for pattern in thelis

Re: [Tutor] loading an image into a Postgre database

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Mike Hansen wrote: > Thanks Danny. That did the trick. I think I had thought about putting > the variables in the execute statement, but I didn't run across any > examples. I'll need to read the DB API 2.0 docs some more. Hi Mike, No problem; it's actually a really common

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Ed Singleton wrote: > Yeah I think curses looks like it will do what I want. It doesn't > look particularly easy to use (the [y,x] format is going to trip me up > a lot) but I think I could write myself a simple interface to it that > would make it simpler for me to use. H

Re: [Tutor] Lists in List question

2005-06-23 Thread Danny Yoo
On Thu, 23 Jun 2005, Phillip Hart wrote: > I've been using lists within lists for several functions, but have been > unable, in loop form, to extract data from them or, in loop for, apply data > to them. [cut] Hi Phillip, Can you try checking for indentation? Your code came out indented all o

Re: [Tutor] CGIXMLRPCRequestHandler doesn't actually work, does it?

2005-06-24 Thread Danny Yoo
> The example code in the python online documentation calls a non-existant > "div" function, so it was obviously a typing exercise, not actual code > that anyone ever tested. Hi Ron, Ah, ok, I see. Check the bottom of: http://www.python.org/doc/lib/simple-xmlrpc-servers.html for a worki

Re: [Tutor] CGIXMLRPCRequestHandler doesn't actually work, does it?

2005-06-24 Thread Danny Yoo
> > has is a documentation bug: the intent is clearly to compare and contrast > > SimpleXMLRPCServer and CGIXMLRPCRequestHandler, so the code should be > > using the same example. The fact that it isn't is confusing, and should > > be fixed. I'll send a bug report now. http://python.org/sf/122

Re: [Tutor] MineSweeper

2005-06-25 Thread Danny Yoo
On Sat, 25 Jun 2005, Alberto Troiano wrote: > My doubt is that I want to be able to allow the user to put how many > bombs they want and how any spaces (how big is the board) so I will have > to create buttons dinamically, but in doing this the reference to the > buttons will be lost How do I kn

Re: [Tutor] wxPython shaped window

2005-06-25 Thread Danny Yoo
On Sat, 25 Jun 2005, Adam Bark wrote: > Is it possible to put controls into a shaped window in wxPython. I have > tried putting a button on the demo and it becomes the exact size and > shape of the window. Also when I tried to bind it to an action it > wouldn't even start. Hi Adam, You might w

Re: [Tutor] clob and string conversion

2005-06-25 Thread Danny Yoo
On Sat, 25 Jun 2005, Ming Xue wrote: > I am trying to access oracle9i with cx_Oracle package. One of the column > is clob and when I tried clob.read() I got non-text output. I know the > real data is text. Can somebody show me how to convert clob to string in > python? Hi Ming, This seems real

Re: [Tutor] Alternative File I/O for Tuples

2005-06-25 Thread Danny Yoo
> I would like to see something more like when the file is printed: > > AustinJames704-111-1234 > AustinJanet704-111-1234 > etc. > > Is this a simple task, or am I jumping into deep water? :) Hi Don, Not too bad; I think you'll looking for "String Formatting": http://www.p

Re: [Tutor] Alternative File I/O for Tuples

2005-06-25 Thread Danny Yoo
> In your example, it looks like every row is ten characters long. A ^^^ Hi Don, Gaa, that's why I'm so bad at matrix math. I meant "column", not "row". Sorry about that. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Alternative File I/O for Tuples (fwd)

2005-06-26 Thread Danny Yoo
-- Forwarded message -- Date: Sun, 26 Jun 2005 14:29:22 -0400 From: Don Parris <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Alternative File I/O for Tuples On Sat, 25 Jun 2005 22:52:08 -0700 (PDT) Danny Yoo <[EMAIL PROTECTED]>

[Tutor] Help - im a beinner in using python (fwd)

2005-06-27 Thread Danny Yoo
[I am forwarding this to the main Tutor list. Enas, if you're not subscribed already to the Tutor list, visit: http://mail.python.org/mailman/listinfo/tutor Once you're subscribed, you can freely post questions to the Python-tutor mailing list at the email address 'tutor@python.org'.]

Re: [Tutor] Improving printouts from IDLE

2005-06-27 Thread Danny Yoo
On Mon, 27 Jun 2005, Richard Lyons wrote: > What is the specific code that allows the IDLE window to be printed to > notepad (in Windows XP)? Hi Richard, The relevant code that does the "Print Window" command lives in the IOBinding submodule of IDLE, within the print_window() method: http://c

Re: [Tutor] How to send an array of clusters from python to labview??

2005-06-27 Thread Danny Yoo
On Mon, 27 Jun 2005, john taylor wrote: > i am using win32com to call labview from python over COM. i want to set > the value of a control element in a VI per SetControlValue(), and the > control in the VI is an array of cluster, which has the structure > (integer, integer, string). > > >>> aoc

Re: [Tutor] CGI Tutorial

2005-06-27 Thread Danny Yoo
On Mon, 27 Jun 2005, Gooch, John wrote: > Are there any tutorials on the Python CGI module? I think I found enough > fragments to get form data, but I need a way for the Python script to > tell whether it is being run in a web server environment or from the > command line. > What I am thinking

Re: [Tutor] Cookielib - CookieJar objects

2005-06-28 Thread Danny Yoo
On Wed, 29 Jun 2005, Peter Szinek wrote: > Hello Denise, > > How about this: > > myjar = cookielib.CookieJar() > for cookie in myjar: > print cookie.value > > In this case the above code should print a single 'B'. Yes, whenever the documentation talks about something being "iterable", the

Re: [Tutor] Jimage reader. How to find the pixels?

2005-06-30 Thread Danny Yoo
On Thu, 30 Jun 2005, Joseph Quigley wrote: > I've been looking a lot for a mod that will automatically find the > pixels in an image but I can't find one. Do you know of one? imageop and > imghdr don't have anything like that. Thanks, Hi Joseph, You might want to try the Python Imaging Library

Re: [Tutor] would pickle or cpickle help?

2005-06-30 Thread Danny Yoo
> Could I use something like cpickle to store the dictionary once it is > made so I would not have to make it each time? I have never tried to > use pickle so I am bit fuzzy on what it can store and what it can't. > Also would it really buy me anything...it only takes a second or two to > make t

Re: [Tutor] OT self-implementation?

2005-07-03 Thread Danny Yoo
> > (*)One of the hardest malicious bugs I've seen was by a disgruntled > > employee who deliberately inserted a bug into the C source of the > > companies compiler. He then recompiled the compiler (using the working > > compiler) to produce a faulty compiler. He then removed his bugs in > > the so

Re: [Tutor] OT self-implementation?

2005-07-03 Thread Danny Yoo
> > Now's not the time in my life to start a comp. sci. degree. So, my > > questions are: > > > > 1) What would be good terms to google for to find an explanation of > > how the seeming magic doesn't violate all reason? Hi Michael, The idea is that we can use _ourselves_ as the initial compiler

Re: [Tutor] How do I make Python calculate square roots?

2005-07-03 Thread Danny Yoo
On Sat, 2 Jul 2005, Reed L. O'Brien wrote: > > Does anyone know how to make Python calculate square roots? > > > Raise to the 1/2 power. > > >>> 4**.5 > 2.0 > >>> 16**.5 > 4.0 > >>> 81**.5 > 9.0 By the way, if you need to take the square roots of negative numbers, then the 'sqrt' function

Re: [Tutor] search through a list

2005-07-04 Thread Danny Yoo
> #this function returns the number of lines on record for each log file. > def line_finder(LogsInDir, flag): > flag=flag.strip() > return_next=False > for line in LogsInDir: > if return_next: > return line.strip() > else: > if line.strip() == flag: >

Re: [Tutor] Confused about error message

2005-07-04 Thread Danny Yoo
On Sun, 3 Jul 2005, gelsey torres wrote: > I'm new to Python and computer programming in general. Eventually I got > sick of just reading my programming books and typing code from them into > the interpreter, so I decided to write a script that will grab files > from websites and save them to th

Re: [Tutor] I sure do love cookies.

2005-07-04 Thread Danny Yoo
On Fri, 1 Jul 2005, D. Hartley wrote: > Anyone have a good (*simple*) tutorial on making/sending cookies via > python? (i.e., not receiving/messing with them). Hi Denise, I did find one tutorial here that might help with the receiving side of things: http://www.voidspace.org.uk/python/art

[Tutor] update (fwd)

2005-07-04 Thread Danny Yoo
-- Forwarded message -- Date: Mon, 04 Jul 2005 12:55:45 -0700 From: nephish <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: update Hey, i did what you said, added print lines to debug my line_finder function, and it was finding everythin ok, just itera

Re: [Tutor] Case ?

2005-07-05 Thread Danny Yoo
On Tue, 5 Jul 2005, Mike Cheponis wrote: > Why does Python not have a "case" statement, like C? Hi Mike, It's a proposed enhancement: http://www.python.org/peps/pep-0275.html That being said, a dispatch-table approach, using a dictionary, works well in Python because it's not hard to u

Re: [Tutor] Case ? (fwd)

2005-07-06 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 6 Jul 2005 00:01:52 -0700 (PDT) From: Mike Cheponis <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Case ? On Tue, 5 Jul 2005, Danny Yoo wrote: > On Tue, 5 Jul 2005, Mike Cheponis wrote: > >>

Re: [Tutor] (no subject)

2005-07-06 Thread Danny Yoo
On Wed, 6 Jul 2005, Michael Huster wrote: > In python under windows, how can I create and access a file on the > Desktop? The following do NOT work: fp = open(r'Desktop\myFile','r') fp > = open(r'\Desktop\myFile','r') fp = open(r'c:\Desktop\myFile','r') fp = > open(r'c:\Windows\Desktop\myFile','

Re: [Tutor] Case ? (fwd)

2005-07-06 Thread Danny Yoo
> > It's a proposed enhancement: > > > >http://www.python.org/peps/pep-0275.html > > Since this didn't come out in Python 2.4, is it "automatically" > re-considered for 2.5 ? Hello! It's still in the "open" set of peps: http://www.python.org/peps/ so there's no guarantee that PEP 275

Re: [Tutor] file io: reading an int32 at the end of a file?

2005-07-06 Thread Danny Yoo
On Wed, 6 Jul 2005, Marcus Goldfish wrote: > I have a file format that ends in a 4-byte (int32) number. I would like > to read this value in python on a WinXP machine with something like: > > fname = 'somefile' > f = open(fname, 'rb') > f.seek(-4,2) > offset = f.read() > > ... but this doesn't

Re: [Tutor] What's wrong with this code?

2005-07-07 Thread Danny Yoo
Hi Nathan, Other folks are pointing out why you're getting certain error messages. You may also want to consider breaking up the long second-half of the program into into its own set of functions. I believe that the second half could look something like this: ## while menu_choice != 9:

Re: [Tutor] Why does invalid syntax pop up?

2005-07-07 Thread Danny Yoo
On Thu, 7 Jul 2005, Nathan Pinno wrote: > Why does invalid syntax popup? [text cut] Hi Nathan, What does the SyntaxError look like? Copy-and-paste that error message and bring it to the Tutor list. One thing we want to help you do is recognize what the SyntaxError is really trying to say,

Re: [Tutor] Why does invalid syntax pop up?

2005-07-07 Thread Danny Yoo
On Thu, 7 Jul 2005, Nathan Pinno wrote: > Here is another error message: > > Traceback (most recent call last): > File "D:\password.py", line 69, in ? > main_menu() > NameError: name 'main_menu' is not defined Hi Nathan, The error message is correct: there is no "main_menu()"

Re: [Tutor] Why does invalid syntax pop up?

2005-07-08 Thread Danny Yoo
> Error Message: > Traceback (most recent call last): > File "D:\password.py", line 73, in ? > add_login_command() > TypeError: add_login_command() takes exactly 2 arguments (0 given) > > How do I fix it so that it runs properly, and any other errors that have > to be fixed?

Re: [Tutor] Why does invalid syntax pop up? (fwd)

2005-07-08 Thread Danny Yoo
our message to the rest of the mailing list now. Good luck!] -- Forwarded message -- Date: Fri, 8 Jul 2005 16:08:53 -0600 From: Nathan Pinno <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Why does invalid syntax pop up? Here's another:

Re: [Tutor] What's the invalid syntax? [What's the error mesaage?]

2005-07-09 Thread Danny Yoo
On Sat, 9 Jul 2005, Nathan Pinno wrote: > What's the invalid syntax? > > Here's the code (Part of my Guess the Numbers game): > > if a0 == x0 and a1 == x1 and a2 == x2 and a3 == x3: > print "Congratulations! Way to go?" > answer = raw input("Play again: (Y)es or (

Re: [Tutor] Can I use def without ( ) at the end?

2005-07-09 Thread Danny Yoo
On Sat, 9 Jul 2005, Nathan Pinno wrote: > Also, I just wanted to know because I'm using it in my Giant Computer > program for the menus, so I don't have to keep re-typing them. Hi Nathan, Wait; Nathan, are you using the IDLE Python programming environment to edit your programs? I just want

Re: [Tutor] please help

2005-07-10 Thread Danny Yoo
On Sun, 10 Jul 2005, Srinivas Iyyer wrote: > I have a file that looks like this: > > // > AB32456\tTransaction from India > \t 43 \t 34 > \t 34 \t 65 > \t 12 \t 35 > // [some lines cut] > What I have to do: > // > AB32456\tTransaction from India > AB32456\t 43 \t 34 >

Re: [Tutor] ImportError: No module named numarray

2005-07-11 Thread Danny Yoo
> nltk is looking for a module called numarray that is not part of the > standard Python distribution. Do you have numarray installed? Look for > C:\Python24\Lib\site-packages\numarray. If you don't have it then > download numarray from C:\Python24\Lib\site-packages\numarray and > install it accord

Re: [Tutor] Storing Data Records in XML File

2005-07-12 Thread Danny Yoo
On Tue, 12 Jul 2005, Gooch, John wrote: > I have a Python script that stores the results of the processing that it > does in a database, but it has to have an alternate way of storing its > data in a database-friendly way (XML)in case the database is not > available ( connected down, data store

Re: [Tutor] python newbie..system call help

2005-07-12 Thread Danny Yoo
On Tue, 12 Jul 2005, Mike Pindzola wrote: > I have figured many things out. system works, i just forgot to type > os.system(). I have been looking into the os module and am finding alot > of useful stuff. I still need to workout the best way to ask a user for > a root password, show when ty

[Tutor] Tkinter video lectures off the python-wiki

2005-07-13 Thread Danny Yoo
Hi Dave, I saw that you're starting to learn Tkinter programming; as I was browsing through the Beginners Guide on the Python Wiki, I ran into this: http://wiki.python.org/moin/Intro_to_programming_with_Python_and_Tkinter Unfortunately, I can't watch it myself because my Linux box doesn't have t

Re: [Tutor] Minesweeper implementing 20%, weird problem with matrixes

2005-07-13 Thread Danny Yoo
> Does this make sense so far? Please feel free to ask more questions. I forgot to mention that you might want to look at: http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list since it's relevant to the code that you're writing. Best of wishes to you! ___

Re: [Tutor] Minesweeper implementing 20%, weird problem with matrixes

2005-07-13 Thread Danny Yoo
Hi Alberto, The issue you're seeing is in the intialize() code: ## def initialize(self): self.buttonmatrix=[] self.statematrix=[] self.bombmatrix=[] for i in range(self.fil): aux=[] for j in range(self.col): aux.app

Re: [Tutor] ot, " pythonmonks

2005-07-14 Thread Danny Yoo
On Thu, 14 Jul 2005, Johan Meskens CS3 jmcs3 wrote: > is there such a place as www.perlmonks.org for python ? Hi Johan, Perlmonks is an excellent resource for Perl programmers; I don't believe that any single Python-oriented place has the same feature set, although I could be wrong. There a

Re: [Tutor] Catching OLE error

2005-07-14 Thread Danny Yoo
> > So the errors are getting raised before Python even knows there is a > > problem, so it cannot catch them in an except block. From my very > > limited expoerience of COM programming I'd guess that there is a type > > mismatch somewhere either in the data you are passing in or in the > > data y

Re: [Tutor] regular expressions

2005-07-14 Thread Danny Yoo
> I am working on creating a Domain Specific Language that will > solve partial differential equations. The user will enter a equation in > pseudo code format. [Grammar cut] > It was decided to use Spark for the base for the compiler. To use Spark > all that is need is to just add a new c

Re: [Tutor] Python Lists

2005-07-15 Thread Danny Yoo
> I have created a class which has many "Nested list" attributes. When I > create a second instance of the class, the lists are not empty, and > already contain the same values as were held in the previous > instantiation. As a C/C++ programmer, this majes no semns to me at all. > Could someone p

<    1   2   3   4   5   6   7   8   9   10   >