Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread Steve Willoughby
You might also want to consider using the path walk facility in Python's standard lib as well, so you can recurse into subdirectories doing this (if that is helpful) -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tuppe

Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread Steve Willoughby
On Thu, Jun 26, 2008 at 04:53:14AM +0700, Lie Ryan wrote: > I'm not sure what caused your problem, but... Look at where you're checking the file time. You're not checking the file itself, but '.' (the time of the current directory). -- Steve Willoughby| Usi

Re: [Tutor] Script Name/Path Information

2008-07-05 Thread Steve Willoughby
Monika Jisswel wrote: import sys #a module that gives access to the system import os#a module that gives access to the os print sys.argv[0] #prints file name of the script print os.getcwd() #print current working directory print os.getcwd()+sys.argv[0] # but os.getcwd() retu

Re: [Tutor] Python Characteristics.

2008-07-09 Thread Steve Willoughby
Jeremiah Stack wrote: Hello All, I was pondering something. when you are in the live environment receiving immediate feedback is it basically a compiler (or program), responding to what the user inputs, or is it like the bash shell where I could tell it to search the file system for a certain fi

Re: [Tutor] Another assert() question

2008-07-13 Thread Steve Willoughby
Dick Moores wrote: Yes! A rule, not logic. I'm not contradicting Kent, just helping myself understand. First the rule, then logic in the application of the rule. And I assume the rule is there in Python because it makes things work better. Yes, so a statement like "if foo:" becomes an idiom f

[Tutor] Guidance on jump-starting to learn Python

2008-07-17 Thread Steve Poe
Second Edition. Python Programming for the Absolute Beginner, Second Edition. Thanks so much for your advice/help in advance. Steve ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Online class/education for Python?

2008-07-19 Thread Steve Poe
Anyone taken or know of any online classes teaching Python? I know O'Reilly Press teaches online technical courses, through the University of Illinois, but no Python . Thanks. Steve ___ Tutor maillist - Tutor@python.org http://mail.python.org/ma

Re: [Tutor] Raw string

2008-07-20 Thread Steve Willoughby
Neven Goršić wrote: Hi! In every manual and book I read only one way to make a raw string: r"e:\mm tests\1. exp files\5.MOC-1012.exp". I don't know how to make a string raw string if it is already contained in a variable. s.raw() or something like that ... Actually, there's no such thing as a

Re: [Tutor] Raw string

2008-07-20 Thread Steve Willoughby
bob gailer wrote: I'm guessing you want >>> x.raw() # to display r"\t" Is that true. That's the only way I can interpret your question. Hm... or did you (speaking to the OP) intend for your script to interpret strings you're reading from another source, like user input or a text file, and

Re: [Tutor] Online class/education for Python?

2008-07-20 Thread Steve Poe
Joe, It's an online class without a specific time. The class runs for six weeks with two assignments per week. Steve On Sun, Jul 20, 2008 at 3:51 PM, Joe Bennett <[EMAIL PROTECTED]> wrote: > What time where the classes? Web site seems to be missing that info... > > > -

Re: [Tutor] Newbie

2008-07-24 Thread Steve Willoughby
To answer the specific question about square roots below, Python's square root function is in the math module. You can either include this module and invoke it like this: import math . . . y = math.sqrt(x) -or- if you want the sqrt() function brought into your main namespace, you can do it l

Re: [Tutor] List indexing problem

2008-07-25 Thread Steve Willoughby
Mike Meisner wrote: I need to do some statistical analysis by binning values into an array. Being new to Python, I tried to use a list of lists. I've extracted just the minimum code that I'm having trouble with: What you need to remember is that Python works with *objects*, and variables a

[Tutor] understanding join

2008-07-30 Thread Steve Poe
ample: string ='ab' so, if I type: print string.join(string) aabb but if string is 'abc' print string.join(string) aabcbabcc print string ='a' returns on a in this example, whit string='a ' returns aa. So, I

Re: [Tutor] checking for expected types from input file

2008-07-30 Thread Steve Poe
23ABC' >>> print input_data.isdigit() False or something like: while INPUT.has_key('ReferencePositionX').isdigit() =='True': refx = float(INPUT['ReferencePositionX'])/10 refy = float(INPUT['ReferencePositionY'])/10 refz = float(INPUT[

Re: [Tutor] understanding join

2008-07-30 Thread Steve Poe
uence of three letters. The argument to join() is a sequence of strings, not a single string. Kent Kent, Your explanation about my confusion is right on target. Thank you! Okay, now let's join people to people and what do we get? Steve ___ T

Re: [Tutor] understanding join

2008-07-30 Thread Steve Poe
7;[1] + 'abc' + 'ABC'[2] which is: 'A' + 'abc' + 'B' + 'abc' + 'C' Hope this helps. -- John. John, Your explanation is very help. It does make be wonder the usefulness of join with strings. Do you have a practical example

[Tutor] key/value order in dictionaries

2008-07-30 Thread Steve Poe
BB': 3456, 'EEE': , 'FFF': , 'CCC': 7890, 'DDD': } If I know the key, then I can find the value, so the order it is in the dictionary should not matter. I am just curious why this happens. If I have (4) key/value pairs, the display order

Re: [Tutor] Scan Directory for files

2008-08-02 Thread Steve Poe
Fred, What is/are the exact error message(s)? You may want to look at the module glob. Steve Ar e you typing this in the python interpreter or On Aug 1, 2008, at 10:41 PM, Fred @ Mac wrote: Hello, new to python, so please go easy on me! I am using for f in os.listdir(watch_dir

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-12 Thread Steve Willoughby
Jaggo wrote: Why do you use your editor rather than using Pywin? What feature has editor X got that PyWin hasn't? (That is, other than "My editor runs on unix / linux"; while that does count for something it is rather irrelevant to my current situation.) I use a different editor (in my case vim

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-15 Thread Steve Willoughby
llent point with regard to languages too. Learning a new language is always a good thing to do if it changes how you look at programming. Only knowing how to edit text in one fashion with one tool makes as much sense as only knowing one way to write a program, in one language. --steve __

Re: [Tutor] RE expressions

2008-08-15 Thread Steve Willoughby
Johan Nilsson wrote: 'text "http:\123\interesting_adress\etc\etc\" more text' Does this really use backslashes in the text? The standard for URLs (if that's what it is) is to use forward slashes. For your RE, though, you can always use [...] to specify a range including whatever you like.

Re: [Tutor] RE expressions

2008-08-15 Thread Steve Willoughby
Steve Willoughby wrote: Johan Nilsson wrote: In [74]: p.findall('asdsa"123abc\123"jggfds') Out[74]: ['"123abcS"'] By the way, you're confusing the use of \ in strings in general with the use of \ in regular expressions and the appearance of \ a

Re: [Tutor] os.path.walk vs unix find command

2008-08-15 Thread Steve Willoughby
Kent Johnson wrote: Is os.popen("find") faster or slower than os.path.walk to find file pattern in the The general answer to "is find faster than os.[path.]walk faster" is "it depends." Find is optimized, compiled, and fast at what it does. However, what it does is somewhat limited. If you

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-15 Thread Steve Willoughby
Joseph Bae wrote: Thanks for the help! I have managed to get a good temperature converter program working! I am working on beefing it up a bit with some exception handling and an "and-or trick". The error handling works okay but I am having problems using and-or. Here's my updated code: def mai

Re: [Tutor] For Loops and nested loops

2008-08-16 Thread Steve Willoughby
> b=int(a) > n=b+1 > for row in range(1, n): remember what means in range(1, ). You may have a fencepost error (off-by-one), depending on what you intended to happen here. -- Steve Willoughby| Using billion-dollar satellites [EMA

Re: [Tutor] simple python scrip for collocation discovery

2008-08-16 Thread Steve Willoughby
as you look through the list of words and wouldn't need to be building these lists and then going back through them. I'm trying to give some vague help without doing the work for you because we don't do homework exercises for people :) -- Steve Willoughby| Using billion-dollar

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-16 Thread Steve Willoughby
eeds are just to tweak a few lines here and there in an existing document (like an auto-generated template from the IDE). They're just tools. Pick the ones that work for the jobs you need to get done, but don't assume that the other ones are pointless. They may either have points yo

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-16 Thread Steve Willoughby
Steve Willoughby wrote: Likewise, there's a reason the IDE environments like Visual Studio or Eclipse, and pointy-clicky-WYSIWYG editing tools exist. They're much easier for beginners to learn, not as intimidating, but in the end they For example, I use pyWin or IDLE all the time

Re: [Tutor] Shell scripting

2008-09-17 Thread Steve Willoughby
; should do what you want. > > Here is a silly pseudo code example: > > bash command | some-python-script.py | some.other-script.sh > > thanks in advance-Patrick > > ___ > Tutor maillist - Tutor@python.org > http://mail.

Re: [Tutor] WMI

2008-09-17 Thread Steve Willoughby
his could be as simple as invoking an existing network RPC call or something, to as complicated as creating a web service on windows that the linux client(s) connect to. -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware.

Re: [Tutor] WMI

2008-09-17 Thread Steve Willoughby
the provisioning process. Your web interface could have a simple Linux-side Python script which would connect to the web service and request it to run. Be careful, though. What you're describing is fraught with security issues and vulnerabilities that need to be skillfully addressed. -

Re: [Tutor] WMI

2008-09-17 Thread Steve Willoughby
On Wed, Sep 17, 2008 at 11:37:39AM -0600, Spencer Parker wrote: > Yes...you do have it all correct. Luckily this is all behind a private > network that is firewalled. There is no way to get to this network unless > you are physically on site. Since there isn't even VPN access to this > network c

Re: [Tutor] not operator

2008-09-18 Thread Steve Willoughby
st True, False, and None. I'd really strongly encourage the first form. Your mileage may vary, of course. -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware. ___ Tutor maillist - Tu

Re: [Tutor] pexpect

2008-09-20 Thread Steve Poe
#x27;show version | i restarted\n') 22 RouterStartupTimestamp = tn.read_until('#', 2) 23 tn.read_until('#', 2) 24 tn.write('show call history voice last 100\n') HTH, Steve On Sep 20, 2008, at 8:43 AM, James wrote: Folks, Does anyone here have ex

Re: [Tutor] array of different datatypes

2008-09-22 Thread Steve Willoughby
Dinesh B Vadhia wrote: I have looked (honestly!) and cannot see an array structure to allow different datatypes per column. I need a 2 column array with column 1 = an integer and column 2 = chars, and after populating the array, sort on column 2 with column 1 sorted relatively. If by "array"

Re: [Tutor] array of different datatypes

2008-09-22 Thread Steve Willoughby
Dinesh B Vadhia wrote: Thanks Steve. How do you sort on the second element of each list to get: a' = [[42, 'fish'], [1, 'hello'] [2, 'world'] ] something like this would do the trick: a_prime = sorted(a, key=(lambda i: i[1])) sort

Re: [Tutor] A question about how python handles numbers larger than it's 32 bit limit

2008-09-23 Thread Steve Willoughby
hey may be 32 bits or possibly(?) longer), but they are unlimited in size. Python will automatically promote an integer to a long when it gets too big, so you don't *have* to put the L on the end or use long() to construct one explicitly, unless you real

Re: [Tutor] please explain this error

2008-09-23 Thread Steve Willoughby
x27;t *really* go away until it's closed, too. But NFS doesn't represent that case well so a temporary filename is used.) Unless your Python program is what's holding the offending file(s) open... any idea what's keeping the file in use? -- Steve Willoughby| U

Re: [Tutor] WHAT IS THE DIFFERENCE BETWEEN FILTER AND REDUCE FUNCTION

2008-09-24 Thread Steve Willoughby
-> 720 or in other words, this computes (1*2)*3)*4)*5)*6) = 720 So our factorial function could have been implemented like this using reduce: def factorial(n): return reduce(lambda x,y: x*y, range(1,n+1)) HTH HAND steve ___ Tutor maillist

[Tutor] How to replace instances

2008-09-25 Thread Steve Collins
I've written a save/load function for a simple program using cPickle. Upon saving, a master list, to which all instances are added in their __init__, is pickled. when the program starts, if the user wishes to load, a variable "load" is set to one, and the pickled list is loaded. All the classes eit

Re: [Tutor] How to replace instances

2008-09-25 Thread Steve Collins
On 9/25/08, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Sep 25, 2008 at 4:24 AM, Steve Collins <[EMAIL PROTECTED]> > wrote: > >> However, some of the instances refer explicitly to other instances >> instances. It's obvious why this causes problems. It o

Re: [Tutor] re.compile concatenating two searh words

2008-09-29 Thread Steve Willoughby
eople is...' You could do re.compile('good.*bad|bad.*good') I suppose, or several other possibilities. I'm not sure exactly what to suggest since I am guessing you're trying to give a simplified example and aren't literally looking for this pattern in your program. &

Re: [Tutor] range/for list change behavior

2008-09-29 Thread Steve Willoughby
Don Parris wrote: Hi all, After a rather long (and unfortunate) break from tinkering with Python, I am back at it. I am working through the book Learning Python (based on 2.2/2.3 - I use 2.5), and in the chapter on while/for loops, ran across the following example: >>> L = [1, 2, 3, 4, 5]

Re: [Tutor] list to csv

2008-09-30 Thread Steve Willoughby
Arun Tomar wrote: hi! I've a list new_array = ['n1', 'm1', 'p1', 'n2', 'm2', 'p2', 'n3', 'm3', 'p3'] I am trying to convert this to a csv in 3 columns so that the final output would look something like this "n1","m1","p1" "n2","m2","p2" "n3","m3","p3" This can easily be done with the "csv"

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
d then do the calculation. There's a couple of ideas. See where that leads you and let us know. -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
t() do what raw_input() today does, because this is confusing to people as it stands now. -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
ol yourself that a script is "just for me", in most environments things get reused in ways you don't expect, and even if not, get used to good programming habits). -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware. _

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread Steve Willoughby
I therefore retain > > numbers = input("Please type the numbers, separated by commas: ") ? > > Otherwise I don't know (yet) what to do > > David > > > Bill Campbell wrote: > >On Thu, Oct 02, 2008, Steve Willoughby wrote: > > > >&g

Re: [Tutor] Hello again. and another question.

2008-10-02 Thread Steve Willoughby
each count. See anything amiss there? -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Hello again. and another question.

2008-10-02 Thread Steve Willoughby
ot;) > grades_file_2.close() No need to explicitly call str() here, and I suspect print would be clearer anyway. And again, note the direct iteration over Grades: for grade in Grades: print >>grades_file_2, "%.2f" % grade grades_file_2.close() -- S

Re: [Tutor] Hands-on beginner's project?

2008-10-03 Thread Steve Willoughby
l later want to see how to generalize this so the collection of rooms and connections between them exists in _data_ instead of _code_. Something to simmer on the back burner until you're ready for that step. -- Steve Willoughby| Using bil

Re: [Tutor] assigning values to dictionary

2008-10-03 Thread Steve Willoughby
n overall dictionary of dictionaries you add to? What's the bigger context this fits into? Although you *can* do this sort of thing, it quite often ends up not being the most elegant thing to do. -- Steve Willoughby| Using billion-dollar satellites

Re: [Tutor] assigning values to dictionary

2008-10-03 Thread Steve Willoughby
major_key]: print "(%s) %s=%s" % (major_key, minor_key, my_dict[major_key][minor_key]) Another possibility might be: for major_key, subdict in my_dict.iteritems(): print "The stuff stored under", major_key, "is:" for minor_key, value in subdict.iterite

Re: [Tutor] bug in exam score conversion program

2008-10-04 Thread Steve Willoughby
Dragos Ionescu wrote: - Original Message From: bob gailer <[EMAIL PROTECTED]> To: David <[EMAIL PROTECTED]> Cc: tutor@python.org Sent: Saturday, October 4, 2008 10:15:10 PM Subject: Re: [Tutor] bug in exam score conversion program Lots of good responses. And now for something completely

Re: [Tutor] bug in exam score conversion program

2008-10-04 Thread Steve Willoughby
Dragos Ionescu wrote: Original Message From: Steve Willoughby <[EMAIL PROTECTED]> To: Dragos Ionescu <[EMAIL PROTECTED]> Cc: bob gailer <[EMAIL PROTECTED]>; David <[EMAIL PROTECTED]>; tutor@python.org Sent: Saturday, October 4, 2008 11:04:30 PM Subject: Re: [

Re: [Tutor] Delete file before function ends

2008-10-06 Thread Steve Willoughby
On Mon, Oct 06, 2008 at 02:15:06PM -0400, Adrian Greyling wrote: > As a newbie, Alan, I was kinda scared you'd say that "threads" were the > answer here! (It sounds like someone is going to get sucked into a worm > hole or something...) Looks like the next class in my Python education is > going

Re: [Tutor] first call - newcomer

2008-10-07 Thread Steve Willoughby
where A$ was a > >variable > >and 36 was the ASCII value for 'A'. I believe the reverse of this > >process > >was PRINT VAL(A$) or something. I want to play with a program > >that will In Python: a = chr(36) print ord(a)

Re: [Tutor] Fwd: how to see a number as two bytes

2008-10-20 Thread Steve Willoughby
the modulus, although for all I know Python may optimize that in these special cases anyway. Also, unless Python is doing more than I think it does to watch out for your safety behind the scenes, this is more safe against sign extension errors. -- Steve Willoughby| Using billion-dollar satel

Re: [Tutor] please help with simple python CGI script

2008-10-26 Thread Steve Willoughby
aivars wrote: Hello, Lie, I renamed the directory back to Cgi-bin and the scripts are NOT working. Going back to cgi-bin it works. I also do not understand why. Aivars 2008/10/26 Lie Ryan <[EMAIL PROTECTED]>: On Sun, 26 Oct 2008 08:32:52 +, Alan Gauld wrote: "aivars" <[EMAIL PROTECTED]>

Re: [Tutor] cgi scripts

2008-11-07 Thread Steve Willoughby
Jim Morcombe wrote: I want to print a list of the keys and their values passed to a cgi script by an HTML form. I have tried this, but just seems to crash. When you say "crash", what do you mean, exactly? Any ideas? print "Content-type: text/html\n" print "CGI Form Response\n" print "This

[Tutor] Converting EBCDIC characters to ASCII

2008-11-13 Thread Steve Bricker
data fields (for example, X'014C' is equal to integer 14). I am assuming I need to go through this byte-by-byte to convert. Is that the best approach, or is there a better way? Steve Bricker ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Converting EBCDIC characters to ASCII

2008-11-13 Thread Steve Bricker
r field of '014'. Steve Bricker On Thu 13/11/08 10:14 , Steve Bricker [EMAIL PROTECTED] sent: I am trying to build an application for work that FTPs a file from an IBM mainframe to my Windows desktop then process it. The EBCDIC-to-ASCII conversion works nicely (using a BAT file I

Re: [Tutor] Converting EBCDIC characters to ASCII

2008-11-13 Thread Steve Bricker
BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }I stand corrected. There was enough information. Thank you. BAT file has nothing to do with Python. I used it because I knew how. Once I figure it out in Python, I'll use that instead. Steve Bricker On Thu 13/11/08

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Steve Willoughby
= y1Speed rect(x1, y1, size, size) Is that the sort of code you're coming up with? One thing that strikes me off the top here is that (in either language) you'd be better off not using all those global variables. Make your functions take parameters and use them in your calculatio

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Steve Willoughby
On Mon, Dec 01, 2008 at 12:59:23PM -0800, Steve Willoughby wrote: > > void drawSquare1() { > > if(x1<0 || x1>width-size) { > > x1Speed = -x1Speed; > > } > > > > if(y1<0 || y1>height-size) { > > y1Speed = -y1Speed; > > } > &g

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Steve Willoughby
d you learn nothing. > > Then we have to do it all o er again next time you get stuck. > > That's inefficient for both you and us! > > > > > > -- > > Alan Gauld > > Author of the Learn to Program web site > > http://www.freenetpages.co.uk/hp/alan.gauld > > > > __

Re: [Tutor] 'for' loops

2008-12-01 Thread Steve Willoughby
The list in this case is range(10) which is an expression that generates the list (0, 1, 2, ..., 9), so you get one run through the code for each of those. Does that help? > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Steve Wil

Re: [Tutor] importing images and sound

2008-12-02 Thread Steve Willoughby
ght want to look at pymedia or pygame. -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] dictionary looping problem

2008-12-02 Thread Steve Willoughby
script (and then didn't use). 2. The return value from os.system() is NOT the hash, so what you're storing in the dictionary is not going to be that unique, and so each call which yields the same return value (0, usually) will overwrite that element in the dict. -- Steve

Re: [Tutor] how to run a process forever

2008-12-10 Thread Steve Willoughby
disassociated from any TTY, of course). A watchdog re-launcher cron script is also not uncommon. If your script isn't actively doing something it's good to put it to sleep until some interesting event (or timer) wakes it up. Was there something beyond that you were looking for? -- St

Re: [Tutor] how to run a process forever

2008-12-10 Thread Steve Willoughby
shell, this usually looks like this: /path/to/myscript /dev/null 2>&1 & -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] reading output from a c executable.

2008-12-11 Thread Steve Willoughby
Ravi Kondamuru wrote: Hi, I am writing a script to read list output from a C executable. How should c program be written so that python can read the output as a list? Any pointers to info on this appreciated. The possibilities are truly wide open on this. Python can read a variety of standa

Re: [Tutor] reading output from a c executable.

2008-12-11 Thread Steve Willoughby
Ravi Kondamuru wrote: I am expecting these lists to be huge and was hoping to avoid re-parsing in python. Any way for the c program to return a list that python can Mind if I ask the obvious question here? Why are you wanting to avoid parsing in Python? Any time you have one program (in any

Re: [Tutor] reading output from a c executable.

2008-12-11 Thread Steve Willoughby
program? I have thought about having to populate a database first but will prefer to avoid having another intermediate datastore (apart from the log file). thanks, Ravi. On Thu, Dec 11, 2008 at 10:27 AM, Steve Willoughby <mailto:st...@alchemy.com>> wrote: Ravi Kondam

Re: [Tutor] [Fwd: Re: reading output from a c executable.]

2008-12-11 Thread Steve Willoughby
With the amount of information provided so far, I'd say you need to step back and question your initial assumptions. Python shouldn't have a great deal of trouble reading variable-length binary data blocks, and the overhead of doing that is probably a lot less than it would be to have another

Re: [Tutor] how to convert '\xf0' to 0xf0?

2008-12-11 Thread Steve Willoughby
ord('\xf0') ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] what does the "@" operator mean?

2008-12-15 Thread Steve Willoughby
Marc Tompkins wrote: On Mon, Dec 15, 2008 at 5:03 PM, Alan Gauld wrote: I've been using Python for oover 10 years and still find decorators hard to get my head around! :-) I've only been using Python for a couple of years now, but my experience so far is the same as yours: decorators make my h

Re: [Tutor] reciprocal import

2008-12-16 Thread Steve Willoughby
spir wrote: Is it legal or possible at all for two modules to import each other? I tried several ways and had several kinds of error messages. Usually "can't import...". My first impression here is that this sounds like a bad class/module design if they're really that interdependent. ___

Re: [Tutor] reciprocal import

2008-12-16 Thread Steve Willoughby
spir wrote: Steve & Kent: Actually, I have 2 main modules that work together to achieve the task. In the first one is defined a set of objects that outline the creation of objects which classes & subclasses are in the second module. Only for clarity I need two modules. In my experienc

Re: [Tutor] Very basic question about lists

2008-12-22 Thread Steve Willoughby
if 'ar' or 'ko' in item: This is incorrect. What you meant to say was: if 'ar' in item or 'ko' in item: or something equivalent to that. "if 'ar' or 'ko' in item" means "if ('ar') is True or ('ko' in item) is True". Since 'ar' is True anyway, you'll get a match every time. __

Re: [Tutor] telnetlib unable to cath gaierror

2008-12-28 Thread Steve Willoughby
, then your try/except clause would be like: except telnetlib.gaierror: -- Steve Willoughby| Using billion-dollar satellites st...@alchemy.com | to hunt for Tupperware. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] quoting and escaping

2009-01-13 Thread Steve Willoughby
On Tue, January 13, 2009 15:09, Jon Crump wrote: > All, > > Something I don't understand (so what else is new?) about quoting and > escaping: > s = """ "some" \"thing\" """ s > ' "some" "thing" ' Correct. Note that """ ... """ is just a string constant the same as "..." is, with the exc

Re: [Tutor] quoting and escaping

2009-01-13 Thread Steve Willoughby
On Tue, January 13, 2009 16:12, John Fouhy wrote: > (or, heck, get rid of eval.. do you really need it?) As a general comment, especially for beginning to intermediate programmers, the answer to "do you need eval()" is usually "not really." There's almost always a better, easier and more straight

Re: [Tutor] Sys.stdin Question

2009-01-13 Thread Steve Willoughby
ached to a real terminal at all. On Unix, os.isatty(sys.stdin) will tell you this. steve ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Sys.stdin Question

2009-01-13 Thread Steve Willoughby
On Tue, January 13, 2009 17:59, Damon Timm wrote: > ... then, I guess, I can just have it do an if statement that asks: if > args[0] == "-" then ... blah. I may do that ... the script, itself, Look at the fileinput module. If you're looking at the command line for a list of filenames, which may

Re: [Tutor] @property?

2009-01-16 Thread Steve Willoughby
little confused here because of the "@" in the subject. Do you mean Python syntax using the "@" in front of a name like: @protected def spam(eggs): ... Those are called "decorators". Try searching for those, or we can help if that's what you&#x

Re: [Tutor] referring to subfolders

2009-01-16 Thread Steve Willoughby
Che M wrote: I have been using absolute paths in my programs, but want to get out of the habit as I try to run them on other computers. I was surprised to find that this type of reference didn't work: path = '/subfolder/myfile.py' Pathnames are relative by default. So: 'myfile.py' would b

[Tutor] Question about pygame/tkinter interaction

2009-01-19 Thread Steve Willoughby
dle things like creating a video playback window on the screen, or is pygame going to want to run the whole GUI event loop and screen updates in competition with Tkinter? Any general nudges in the right direction would be appreciated. Thanks, steve -- Steve Willoughby| Using billion-dolla

Re: [Tutor] Question about pygame/tkinter interaction

2009-01-19 Thread Steve Willoughby
pokes callbacks at you, I thought... "Well, maybe..." -- Steve Willoughby| Using billion-dollar satellites st...@alchemy.com | to hunt for Tupperware. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] vim as a python editor; FOLLOW-UP QUESTION

2010-12-16 Thread Steve Willoughby
as the up-arrow command history feature and is also good for Python coding in general? If you use the up-arrow to move your cursor to previous lines in the IDLE window and hit ENTER, you recall that line where you can edit and re-enter it. -- Steve Willoughby / st...@alchemy.com "A ship in

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Steve Willoughby
is the quit() method actually defined? -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53 ___ Tutor maillist - T

Re: [Tutor] no luck with sqlinsert

2011-01-14 Thread Steve Willoughby
On 14-Jan-11 09:03, Jason Staudenmayer wrote: Don't build you sql separate from the execute (or so I was told when I was doing something similar) cur.execute(INSERT INTO tkindbtal (kommune, komnr, i2005, i2006, i2007 \ , i2008, i2009, i2010) VALUES (%s, %s, %s, %s, %s, %s,\ %s, %s)% (cols[0], col

Re: [Tutor] Help on RE

2011-01-22 Thread Steve Willoughby
s a digit character. \d+ matches one or more digit characters. Nothing in your regex matches a sign character. You might want something like [-+]\d+ which would require either a - or + followed by digits. If you want the sign to be optional, maybe this would work: [-+]?\d+ -- Steve Wil

Re: [Tutor] remote code execution

2011-02-15 Thread Steve Willoughby
hanks! It seems like the ideal case would be to run a remote desktop session onto the target system and develop there (e.g., run Eclipse or your favorite IDE on the Linux box, using it via VNC or something). Then you're running the real code on the real system. -- Steve Willoughby / st...@alch

Re: [Tutor] Python object

2011-02-24 Thread Steve Willoughby
od? This could happen if you did this at the prompt: >>> print object.GetAllAtrib() This is a case where giving us more information about what you're doing helps us answer your question better. --steve On Thu, Feb 24, 2011 at 10:48 AM, Christopher Brookes mailto:chris.klai.

Re: [Tutor] accessing another system's environment

2011-02-24 Thread Steve Willoughby
your script to be executed in that environment. Finding the environment of a running process can be done easily, too. Look at the output of "ps" with certain options set, or the contents of files in /proc. However, remember that there are as many environments are there are processes

Re: [Tutor] accessing another system's environment

2011-02-25 Thread Steve Willoughby
ccount? the account of a service that you're interested in? The default skeleton configuration files for new users? The environment of something you know to be running already? All of those things are possible to look at, if you know what you're really after and why it will hel

Re: [Tutor] accessing another system's environment

2011-02-25 Thread Steve Willoughby
On 25-Feb-11 19:27, Steve Willoughby wrote: Wait. Are you trying to figure out how, on a Unix system, to read Unix system environment variables as you're accustomed to doing on Windows? Or are you saying you want to, from a remote Unix system, reach out to a Windows system and see

Re: [Tutor] accessing another system's environment

2011-02-25 Thread Steve Willoughby
On 25-Feb-11 20:26, Bill Allen wrote: On Fri, Feb 25, 2011 at 21:33, Steve Willoughby mailto:st...@alchemy.com>> wrote: On 25-Feb-11 19:27, Steve Willoughby wrote: Or are you saying you want to, from a remote Unix system, reach out to a Windows system and see that W

Re: [Tutor] accessing another system's environment

2011-02-26 Thread Steve Willoughby
g To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53 _

<    1   2   3   4   >