Re: Best method for a menu in a command line program?

2010-11-04 Thread braden faulkner
Sorry, I wasn't aware it was doing that but... I've removed it :-) Sorry about that, Braden Faulkner -- http://mail.python.org/mailman/listinfo/python-list

Best method for a menu in a command line program?

2010-11-03 Thread braden faulkner
ce == "f": temp = input("Fahrenheit temperature:") print "Celsius:",fahrenheit_to_celsius(temp) elif choice != "q": print_options() choice = raw_input("option:") Just wondering if there is another or more efficient way I should be doing it? Thanks -- Braden Faulkner -- http://mail.python.org/mailman/listinfo/python-list

[Beginer Question] I heard about python needing some sort of _VariableName_ boiler plate?

2010-10-31 Thread Braden Faulkner
Can anyone explain to me how this works, I don't seem to have to do it in IDLE? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

RE: text file reformatting

2010-10-31 Thread Braden Faulkner
xt file reformatting > > On 10/31/10 14:52, Braden Faulkner wrote: > >> import csv > >> f = file('def.csv', 'rb') > >> f.next() # discard the header row > >> r = csv.reader(f, delimiter=';') > >> f

RE: text file reformatting

2010-10-31 Thread Braden Faulkner
I also am having issues with this. > Date: Sun, 31 Oct 2010 14:48:09 -0500 > From: python.l...@tim.thechases.com > To: iwawi...@gmail.com > Subject: Re: text file reformatting > CC: python-list@python.org > > > PRJ01001 4 00100END > > PRJ01002 3 00110END > > > > I would like to pick only some co

RE: Python 2.7 or 3.1

2010-10-29 Thread Braden Faulkner
05:21 p.m. 29/10/2010, geremy condra wrote: > >On Wed, Oct 27, 2010 at 7:18 PM, Braden Faulkner wrote: > > > Would it be safe to say that 2.6 would be even better for beginners than? > > > >Let me just come out with a contrary point of view before you go down > >t

Create a GUI and EXE for a python app?

2010-10-28 Thread Braden Faulkner
Having trouble with my mail client, so sorry if this goes through more than once. I'm worknig on a simple math program as my first application. I would like to make a cross-platform pretty GUI for it and also package it up in a EXE for distribution on Windows. What are the best and easiest way

Re: Python 2.7 or 3.1

2010-10-27 Thread Braden Faulkner
Would it be safe to say that 2.6 would be even better for beginners than? -- http://mail.python.org/mailman/listinfo/python-list

Python 2.7 or 3.1

2010-10-26 Thread Braden Faulkner
Which is better for a beginner to get started in Python with? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: pydoc enforcement.

2008-12-01 Thread Ken Faulkner
Hi Yeah, I was thinking about something at commit time for a VCS... catch is, soo many VCS's out there. And I wasn't thinking of the default action throwing compile errors, but would only do that if a particular flag was given. Still, just an idea. I'm just finding more and more public modules/

Re: How can I programmatically find the name of a method from within that method?

2007-08-08 Thread faulkner
On Aug 8, 10:43 pm, faulkner <[EMAIL PROTECTED]> wrote: > On Aug 8, 12:45 am, kj7ny <[EMAIL PROTECTED]> wrote: > > > Is there a way that I can programmatically find the name of a method I > > have created from within that method? I would like to be able to log

Re: How can I programmatically find the name of a method from within that method?

2007-08-08 Thread faulkner
On Aug 8, 12:45 am, kj7ny <[EMAIL PROTECTED]> wrote: > Is there a way that I can programmatically find the name of a method I > have created from within that method? I would like to be able to log > a message from within that method (def) and I would like to include > the name of the method from w

Re: Heterogeneous lists

2007-08-07 Thread faulkner
On Aug 7, 2:53 pm, Gordon Airporte <[EMAIL PROTECTED]> wrote: > This is one of those nice, permissive Python features but I was > wondering how often people actually use lists holding several different > types of objects. > It looks like whenever I need to group different objects I create a > class

Re: custom plugin architecture: how to see parent namespace?

2007-07-22 Thread faulkner
On Jul 22, 10:06 am, escalation746 <[EMAIL PROTECTED]> wrote: > I've got a namespace query that amounts to this: How can an imported > function see data in the parent custom namespace? I have read through > numerous posts which skirt this issue without answering it. > > To illustrate, create plugin

Re: bash-style pipes in python?

2007-07-11 Thread faulkner
On Jul 11, 8:56 pm, Dan Stromberg - Datallegro <[EMAIL PROTECTED]> wrote: > I'm constantly flipping back and forth between bash and python. > > Sometimes, I'll start a program in one, and end up recoding in the > other, or including a bunch of python inside my bash scripts, or snippets > of bash in

Re: Get a filename list of a web site

2007-07-10 Thread faulkner
On Jul 10, 5:12 am, [EMAIL PROTECTED] wrote: > Hi all, > is it possible to get a filename directory list of a website (possibly > with full path indication)? > Using python & possibly wget? > > Bye. HTTP does not provide a command for this. you need to acquire a shell account on the specific serve

Re: Too many 'self' in python.That's a big flaw in this language.

2007-06-27 Thread faulkner
On Jun 27, 7:02 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > HI > I'm currently using Python. I find that a instance variable must > confined with self, > for example: > class a: > def __init__(self): > self.aa=10 > def bb(self): > print self.aa # See .if in c++,

Re: labeled break/continue

2007-06-18 Thread faulkner
On Jun 18, 12:35 am, Matt Chisholm <[EMAIL PROTECTED]> wrote: > Hi. I was wondering if there had ever been an official decision on > the idea of adding labeled break and continue functionality to Python. > > I've found a few places where the idea has come up, in the context of > named code blocks:

Re: getting scancodes

2007-04-25 Thread faulkner
On Apr 23, 8:39 pm, [EMAIL PROTECTED] wrote: > Anyone knows if its possible to get scan codes ??? > I tried with getch () but with no success, just keycodes. > May be using the something in the sys.stdin module ?? is this what you're looking for? http://cheeseshop.python.org/pypi/sysio/1.0 and sy

Re: Python Feature Request: (?) Group all file-directory-related stdlib functions in one place

2007-04-14 Thread faulkner
On Apr 14, 6:30 am, [EMAIL PROTECTED] wrote: > Please check for sanity and approve for posting at python-dev. > > Currently file-directory-related functionality in the Python standard > library is scattered among various modules such as shutil, os, > dircache etc. So I request that the functions be

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread faulkner
On Apr 14, 6:27 am, [EMAIL PROTECTED] wrote: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. > > I would like to have something like "option base" in Visual Basic. > IIRC it used to allow me to choose whether 0 or 1 should be used as > the base of m

Re: tkinter how to write

2007-03-07 Thread faulkner
On Mar 8, 7:07 pm, Gigs_ <[EMAIL PROTECTED]> wrote: > as I write my first gui program (text editor) I wanna ask you guys how > to separate code in classes.? > Should I put in one class my menu and in another class text and > scorllbars etc? > > or something else? > > thanks Use the force. Do what

Re: builtin set literal

2007-02-14 Thread faulkner
On Feb 14, 11:55 am, Schüle Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > lst = list((1,2,3)) > lst = [1,2,3] > > t = tupel((1,2,3)) > t = (1,2,3) > > s = set((1,2,3)) > s = ... > > it would be nice feature to have builtin literal for set type > maybe in P3 .. what about? > s = <1,2,3> > > Regards

Re: Something like the getattr() trick.

2007-02-10 Thread faulkner
On Feb 10, 3:34 pm, Ayaz Ahmed Khan <[EMAIL PROTECTED]> wrote: > I'm working with the following class heirarchy (I've snipped out the code > from the classes): > > class Vuln: > def __init__(self, url): > pass > > def _parse(self): > pass > >

Lython

2007-01-25 Thread faulkner
I have Lython! I want to make sure that anybody else who wants it can access it, so, unless Mr. Egan objects, I'm hosting it here: http://home.comcast.net/~faulkner612/programming/python/lython.zip I had to patch it a bit because the number of arguments to compiler.ast.Function.__init__ changed bet

Re: question on pygtk and accessibility on windows.

2006-11-30 Thread faulkner
if by 'accessibility' you mean 'usable' (like python and firefox are usable), then yes. there are pygtk bindings for windows, and they work. http://python-forum.org/py/viewtopic.php?t=116 if by 'accessibility' you mean 'usable for the blind/deaf', then i think that is up to you as an application de

Re: why would anyone use python when java is there?

2006-11-28 Thread faulkner
functional programming, list comprehensions, decorators, duck typing, generators, dynamism, introspection, prettier code, simpler grammar [see digg and /. for the graphs], and, of course, the trolls. gavino wrote: > wtf -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question to split

2006-11-09 Thread faulkner
def splits(seq, cs): if not cs: return seq elif isinstance(seq, str): return splits(seq.split(cs[0]), cs[1:]) else: return splits(sum([elem.split(cs[0]) for elem in seq], []), cs[1:]) or a = re.split('(\ |\,)', a) a.remove(' ') a.remove(',') Matthias Winterland wrote: > Hi, > > I have

Re: Computer locks up when running valid stand alone Tkinter file.

2006-10-25 Thread faulkner
> But, when I call it from another module it locks methinks this "other module" has the answer. jim-on-linux wrote: > py help, > > The file below will run as a stand alone file. > It works fine as it is. > > But, when I call it from another module it locks > my computer, The off switch is the only

Re: Painless way to do 3D visualization

2006-10-07 Thread faulkner
http://www.vpython.org/ Peter Beattie wrote: > Hey folks, > > I need to do the following relatively simple 3D programming: > > I want to convert data from four-item tuples into 3D co-ordinates in a > regular tetrahedron. Co-ordinates come in sequences of 10 to 20, and the > individual dots in the

Re: How can I make a class that can be converted into an int?

2006-10-02 Thread faulkner
__int__ __long__ __float__ Matthew Wilson wrote: > What are the internal methods that I need to define on any class so that > this code can work? > > c = C("three") > > i = int(c) # i is 3 > > I can handle the part of mapping "three" to 3, but I don't know what > internal method is called when in

Re: does anybody earn a living programming in python?

2006-09-25 Thread faulkner
where do you find these "contract jobs", if you don't mind my asking? Christian wrote: > walterbyrd wrote: > > If so, I doubt there are many. > > > > I wonder why that is? > > Previously I used Python while earning a living working in IT at a > college. Currently it is putting food on the table v

Re: does anybody earn a living programming in python?

2006-09-25 Thread faulkner
both my last summer jobs consisted entirely of python, and the jobs i'm looking at for next summer all involve python. and one of my profs makes a living teaching python. and the office i worked for 2 summers ago was 5 old guys who did nothing but python and stock trade analysis all day. if i'm luc

Re: python gtk based file manager

2006-09-25 Thread faulkner
http://www.google.com/search?q=emelfm2 awesome file manager written in C using gtk. i've been meaning to write something like emelfm in pygtk, but emelfm already exists... Fabian Braennstroem wrote: > Hi, > > I am looking for a file manager based on pygtk. It seems > that there does not exist any!

Re: Best practice for large source code projects

2006-09-22 Thread faulkner
several of my programs are thousands of lines long, and i don't think they're extravagantly large. i'd say you should use modules the same way you use classes and functions: to separate code logically. if it makes sense to think of a group of statements as a function, you make it a function. if it

Re: How to find number of characters in a unicode string?

2006-09-18 Thread faulkner
are you sure you're using unicode objects? len(u'\u') == 1 the encodings module should help you turn '\xff\xff' into u'\u'. Preben Randhol wrote: > Hi > > If I use len() on a string containing unicode letters I get the number > of bytes the string uses. This means that len() can report siz

Re: Webbrowser written totally in Python

2006-09-17 Thread faulkner
this was just on digg: ## import wx from urllib import urlopen import wx.html class Frame(wx.Frame): def userPageButton(self, event): goToPage=self.userPage.GetValue() goToPage='http://www.' + goToPage webpage=urlopen(goT

Re: Cross-platform application restart?

2006-09-06 Thread faulkner
asynchronously start a process which waits for the parent to close, then starts your script. cmd = "python -c 'import time,os;time.sleep(2);os.system(YOUR_SCRIPT)'" if os.name == 'nt': cmd = 'start ' + cmd else: cmd += ' &' subprocess.Popen(cmd, shell=True) sys.exit() Heikki Toivonen wrot

Re: looking for data on csv files

2006-08-28 Thread faulkner
import re if re.search(nome, row[rowcsv], re.I): ... that's re.I [capital i] as in ignorecase. flit wrote: > Hi! > I am using the csv modules.. > > when I use the command: > > if nome in row[rowcsv]: > print "\n" > print row[rowcsv] + "\n > " + row[11] + "\n" >

Re: Python daemon process

2006-08-26 Thread faulkner
process = subprocess.Popen(gnuchess) ... os.kill(process.pid, signal.SIGKILL) Thomas Dybdahl Ahle wrote: > Hi, I'm writing a program, using popen4(gnuchess), > The problem is, that gnuchess keeps running after program exit. > > I know about the atexit module, but in java, you could make a process

Re: Newbie programmer question: How do parsers work?(Python examples?)

2006-08-25 Thread faulkner
http://pages.cpsc.ucalgary.ca/~aycock/spark/ http://www-128.ibm.com/developerworks/library/l-spark.html bio_enthusiast wrote: > I was wondering exactly how you create a parser. I'm learning > Python and I recently have come across this material. I'm interested > in the method or art of writing a p

Re: callable to disappear?

2006-08-23 Thread faulkner
what's wrong with hasattr(obj, '__call__')? Antoon Pardon wrote: > I have been reading http://www.python.org/dev/peps/pep-3100/ > en there is written: > > To be removed: > ... > > callable(): just call the object and catch the exception > > ... > > But that doesn't seem to be a ge

Re: swapping numeric items in a list

2006-08-22 Thread faulkner
for i in xrange(0, len(your_list), 2): your_list[i], your_list[i + 1] = your_list[i + 1], your_list[i] Jiang Nutao wrote: > Hi, > > I simplify my problem like below > > To convert list > aa = [0x12, 0x34, 0x56, 0x78] > into > [0x34, 0x12, 0x78, 0x56] > > How to do it fast? My real li

Re: [NEWB]: List with random numbers

2006-08-19 Thread faulkner
what you want is impossible. step back a second. you want 7 distinct ints all between 0 and 5 inclusive. of course you'll loop forever. once you get all 6 numbers, no matter what you get will already be in your list. if you want floats between 0 and 6, say '6 * random.random()'. random.randrange is

Re: TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread faulkner
works for me. do you do anything in your script besides that? Charles Russell wrote: > Why does this work from the python prompt, but fail from a script? > How does one make it work from a script? > > #! /usr/bin/python > import glob > # following line works from python prompt; why not in script?

Re: seeking the "Hello World" of Packages

2006-08-11 Thread faulkner
yep, that's all a package is. if you have trouble importing, check your PYTHONPATH environment variable, or sys.path. Bell, Kevin wrote: > I'm trying to get an idea of how packages work and I've read about it in > the Py Tutorial and Nutshell, but I'm still craving a concrete example > that I can

Re: Problem reading/writing files

2006-08-03 Thread faulkner
have you been using text mode? [EMAIL PROTECTED] wrote: > This is a bit of a peculiar problem. First off, this relates to Python > Challenge #12, so if you are attempting those and have yet to finish > #12, as there are potential spoilers here. > > I have five different image files shuffled up in

Re: gaierror: (8, 'hostname nor servname provided, or not known')

2006-07-31 Thread faulkner
my boss has a similar problem with his home internet connection in general. he traced it back to his router, which was in the first couple generations of routers. how old are the routers you tested this on? aside from upgrading them, if they are the problem, i can suggest a workaround. the first ti

Re: Small problem with print and comma

2006-07-30 Thread faulkner
why don't you iterate over the list instead of indices? for elem in L: print elem, you don't need the 0 when you call range: range(0, n) == range(n) the last element of a range is n-1: range(n)[-1] == n-1 you don't need while to iterate backwards. the third argument to range is step. range(n-1, -1

Re: class variables

2006-07-30 Thread faulkner
python != java. when you say "self.v = ...", you mask the class attribute with an instance attribute. say "C1.v = ...". Colin J. Williams wrote: > Andre Meyer wrote: > > Hi all > > > > I am trying to understand the magic of Python's class variables and > > tried the following code (see below). > >

Re: Looking for a regular expression for this...

2006-07-28 Thread faulkner
idk, most regexes look surprisingly like undergrowth. malahal, why don't you parse s into a dict? read each couple of lines into a key-value pair. John Machin wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > My string is a multi line string that contains "filename > > \n" and "host \n" entr

Re: Client/Server Question

2006-07-28 Thread faulkner
you might want to look at sshd. if you're on a windows box, you may need cygwin. if you're on linux, you either already have it, or it's in your package manager. [EMAIL PROTECTED] wrote: > My server.py looks like this > > -CODE---

Re: Client/Server Question

2006-07-28 Thread faulkner
i highly doubt it. http://www.google.com/search?domains=www.python.org&sitesearch=www.python.org&sourceid=google-search&q=os+system+deprecate&submit=search [EMAIL PROTECTED] wrote: > Is os.system() going to be deprecated in future ?.I read somewhere. > > Dennis Benzinger wrote: > > [EMAIL PRO

Re: list of lists of lists ....

2006-07-28 Thread faulkner
doh. ok, so, recursion is just functional programming sugar for a loop. def get_As(L): checking = [elem for elem in L if isinstance(elem, list)]# the equivalent of elem in recursion all_As = [elem for elem in L if isinstance(elem, A)] while checking: new_checking = [] # al

Re: list of lists of lists ....

2006-07-28 Thread faulkner
recursion. def get_As(L): res = [] for elem in L: if isinstance(elem, A): res.append(elem) elif isinstance(elem, list): res += get_As(elem) return res i also have a Tree class in my rc: http://home.comcast.net/~faulkner612/programming/python/pyth

Re: War chest for writing web apps in Python?

2006-07-27 Thread faulkner
cygwin http://www.cygwin.com/ try a few IDEs out to see which fits you best. IDLE ships with python, and isn't significantly objectively worse than any other python IDE, afaik. GUI designers aren't necessary because there's usually so little boilerplate code in any python toolkit, but, again, whate

Re: splitting words with brackets

2006-07-26 Thread faulkner
er, ...|\[[^\]]*\]|... ^_^ faulkner wrote: > re.findall('\([^\)]*\)|\[[^\]]*|\S+', s) > > Qiangning Hong wrote: > > I've got some strings to split. They are main words, but some words > > are inside a pair of brackets and should be considered as one unit

Re: splitting words with brackets

2006-07-26 Thread faulkner
re.findall('\([^\)]*\)|\[[^\]]*|\S+', s) Qiangning Hong wrote: > I've got some strings to split. They are main words, but some words > are inside a pair of brackets and should be considered as one unit. I > prefer to use re.split, but haven't written a working one after hours > of work. > > Exam

Re: binding more than one attribute in a facntion

2006-07-26 Thread faulkner
http://cheeseshop.python.org/pypi/functional learn lisp/scheme! http://cs.wwc.edu/KU/PR/Scheme.html Peter Otten wrote: > [EMAIL PROTECTED] wrote: > > > I want to have a bound method that "fixes" more than one parmeter of a > > funtion. LEt me post an example. > > > > def f(a, b, c): > > retu

Re: Search within running python scripts

2006-07-24 Thread faulkner
IPC via files, sockets, and shared memory are all readily available in python. the simplest way is to have the script write its pid to a certain file. pidfn = '/tmp/hellowerld_ipc_pid' if os.path.isfile(pidfn): f = file(pidfn) pid = f.read() f.close() if pid in os.popen('ps -A -o p

Re: Python newbie needs constructive suggestions

2006-07-21 Thread faulkner
optional arguments. map(lambda x, one=1: x + one, ...) it is entirely possible, however, to implement let in python. def let(**kw): sys._getframe(2).f_locals.update(kw) def begin(*a): return a[-1] map(lambda x: begin(let(one=1), x+one), range(10)) i really should warn you, though, that

Re: Note on PEP 299

2006-07-21 Thread faulkner
http://home.comcast.net/~faulkner612/programming/python/mainer.py turns if __name__ == '__main__': sys.exit(main(sys.argv)) into import mainer [EMAIL PROTECTED] wrote: > I don't like much the syntax of: > if __name__ == '__main__': > > Some time ago I have read this PEP: > http://www.python.org/de

Re: restricted environment

2006-07-19 Thread faulkner
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496746 When you think of modifying the interpreter, think of the compiler module. Gabriele *darkbard* Farina wrote: > Hi, > > I saw the rexec module is deprecated. I need to develop a python > application able to run custom python code based

Re: tkinter help

2006-07-18 Thread faulkner
add a xscrollcommand and/or yscrollcommand keyword argument to the construction of your listbox. def func(*a): print "i'm a callback!" L = Tkinter.Listbox(root, yscrollcommand=func)# note no parens after func groves wrote: > hi eveyrbody , i have started working on python tkinter, > Whi

Re: Starting a GUI application out of an console application

2006-07-17 Thread faulkner
put your gui application in another script and start it the same way you'd start any other application whose exit status you didn't need: os.popen* or subprocess.Popen. or, use the threading module to give your qt application another thread. Fabian Steiner wrote: > Hello! > > I am currently worki

Re: help!

2006-07-11 Thread faulkner
os.popen* os.system subprocess.Popen Emily Ecoff wrote: > Hi all. > > I am somewhat new to the python programming language but I'm working on > a python script that will call several csh scripts. What commands will > I need to do this, if possible? > > -Emily -- http://mail.python.org/mailman

Re: threading troubles

2006-07-10 Thread faulkner
you don't need twisted to run processes in the background, either. os.popen* returns a file or set of files representing std streams immediately subprocess.Popen is a spiffy little object new in 2.4 and available for download for 2.3. check the module docstrings for usage tips. you can use threads

Re: WANTED: logging of all file operations on Windows

2006-07-09 Thread faulkner
you want a directory watching daemon. it isn't hard at all to build from scratch. first, determine which directories should be watched. then, os.walk each directory, building a mapping from filename to mtime [modified time; os.path.getmtime]. next is your main event loop. this while loop consists o

Re: split a line, respecting double quotes

2006-07-07 Thread faulkner
x27;) elif c == '"': res.append('') res[-1] += c in_dbl = True else: res[-1] += c while '' in res: res.remove('') return res faulkner wrote: > import re > re.finda

Re: split a line, respecting double quotes

2006-07-07 Thread faulkner
import re re.findall('\".*\"|\S+', raw_input()) Jim wrote: > Is there some easy way to split a line, keeping together double-quoted > strings? > > I'm thinking of > 'a b c "d e"' --> ['a','b','c','d e'] > . I'd also like > 'a b c "d \" e"' --> ['a','b','c','d " e'] > which omits any s.split

Re: cas in python

2006-07-05 Thread faulkner
import ctypes ctypes.cdll.find('ginac') i like designing APIs, and i'm up for learning ctypes, so i'll help wrap ginac using ctypes. [EMAIL PROTECTED] wrote: > Hello, > from time to time, people here are asking about the computer algebra > system (cas) in python. I wonder, is there a demand for s

Re: import

2006-07-05 Thread faulkner
that should be __init__.py [TWO underscores]. and you might want to import sys and check sys.path [the list of directories searched by the import mechanism]. David Jackson wrote: > Hi all, > > I'm a real beginner with python but have what I think is a simple question. > I am writing some simple m

Re: Perl Dictionary Convert

2006-07-05 Thread faulkner
data.replace('=', ':').replace(';', ',') then eval in a namespace object whose __getitem__ method returns its argument unchanged. class not_str(str):# take care of that IPF.Contact def __getattr__(self, attr):return self + '.' + attr class not_dict(dict): def __getitem__(self, name):

Re: Can I do it using python?? about xterm and telnet

2006-07-02 Thread faulkner
try pexpect. http://pexpect.sourceforge.net/ valpa wrote: > I'm a net admin for about 20 unix servers, and I need to frequently > telnet on to them and configure them. > It is a tiring job to open a xterm and telnet, username, password to > each server. > > Can I do it automatically by python? Af

Re: Can I do it using python?? about xterm and telnet

2006-07-02 Thread faulkner
try pexpect. http://pexpect.sourceforge.net/ valpa wrote: > I'm a net admin for about 20 unix servers, and I need to frequently > telnet on to them and configure them. > It is a tiring job to open a xterm and telnet, username, password to > each server. > > Can I do it automatically by python? Af

Re: Python "sub-interpreter," security

2006-06-25 Thread faulkner
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496746 [EMAIL PROTECTED] wrote: > Hello, I am writing a pure-Python game engine that interprets the code > of game objects within the same process with the exec statement. My > main goal is to make as much power available as possible and exec

Re: Python taught in schools?

2006-06-25 Thread faulkner
Franklin W. Olin College of Engineering I TAed a python class last semester, and am using it to build a webapp for the Arts and Humanities dept. http://www.olin.edu MilkmanDan wrote: > I'll be a college freshman this fall, attending Florida Institute of > Tech studying electrical engineering. > >

Re: search engine

2006-06-24 Thread faulkner
http://www.voidspace.org.uk/cgi-bin/pysearch/search.py http://www.voidspace.org.uk/ http://www.vex.net/parnassus/ http://cheeseshop.python.org/pypi http://aspn.activestate.com/ASPN/Cookbook/Python http://www.google.com vinodh kumar wrote: > hai all, > i am student of computer science

Re: Getting external name of passed variable

2006-06-20 Thread faulkner
>>> import sys >>> tellme = lambda x: [k for k, v in sys._getframe(1).f_locals.iteritems() if >>> v == x] >>> a=1 >>> tellme(a) ['a'] Michael Spencer wrote: > David Hirschfield wrote: > > I'm not sure this is possible, but it sure would help me if I could do it. > > > > Can a function learn the n

Re: Problem Py2exe pygtk and Pil

2006-06-20 Thread faulkner
read the py2exe docs. py2exe should put everything a new user should need in the dist directory. if it doesn't, copy the libraries [be they .pyc or .pyd or .dll] that py2exe missed into dist. i know for a fact that py2exe is intelligent with the gtk libraries, so check if the PIL libraries are in t

Re: Segmentation fault only on Iinux

2006-06-20 Thread faulkner
if you don't know exactly which line of code causes the segfault, use print statements to determine that. then try to either redesign/refactor so that line isn't necessary, or protect its operation somehow. if you do know, tell us what it is and we might not need to see all your code. Kiran wrote:

Re: Function definition

2006-06-19 Thread faulkner
no. python is not C. python is interpreted, not compiled, so if you want a function to exist when you call it, you need to define it before you call it. it isn't clunky, it's just how it's done. if you want to define a 'main' function at the top of your script/module, go for it. then you can use th

Re: Chess module blog

2006-06-18 Thread faulkner
make psyco entirely optional by putting it in a try/except block. change INITIAL_BOARD to be a triple-quoted string. you seem to mostly follow pep8, which is all most folks ask, but i really like this style for docstrings: def test(): ''' hello, this text and the quotes line up

Re: Passing data to system command

2006-06-18 Thread faulkner
import os, subprocess xys = [[1,2],[3,4]] msg = '\n'.join([str(x) + ',' + str(y) for x, y in xys]) os.popen('command', 'w').write(msg) os.popen2('command')[0].write(msg) p = subprocess.Popen('command', stdin=subprocess.PIPE) p.stdin.write(msg) help(subprocess) help(os.popen) help(os.popen3) Ch

Re: Video capture from webcam on Mac?

2006-06-16 Thread faulkner
gstreamer has python bindings. http://gstreamer.net/ Joseph Chase wrote: > Is there a cross-platform solution for video capture from a webcam? > > I am aware of the Win32 videocapture library, but am unaware of how to > accomplish the same functionality on the Mac side. > > Thanks in advance. --

Re: Linux info

2006-06-13 Thread faulkner
os.path.realpath TheSaint wrote: > Hello there, > > I still learning, but I couldn't find anything which tells me where a > symlink is pointing to. > A part of os.system('ls -l ' + path) and cutting down to the need, I haven't > got any specialized function. > > F -- http://mail.python.org/mail

Re: what are you using python language for?

2006-06-06 Thread faulkner
i'm writing a text editor [yes, it has quite a few interesting unique features]. http://fauxlkner.sf.net> this summer, i hope to make it collaborative like gobby. i also have a full-time job this summer at my college writing a small database system to manage student records. hacker1017 wrote: > i

Re: Adding attribute to objetcs

2006-06-05 Thread faulkner
when you set an attribute of an object, python secretly calls that objects __setattr__ method. class test: def __setattr__(self, attr_name, attr_value): print self, attr_name, attr_value self.__dict__[attr_name] = attr_value# do what the original __setattr__ method does. tes

Re: ConfigParser, no attribute

2006-06-05 Thread faulkner
Settings.__init__ needs to call ConfigParser.SafeConfigParser.__init__ before it calls self.readfp. Nexu wrote: > Hello, > > I'm not sure exactly what i'm doing wrong here. I asked around on IRC > and i was told the code is correct. > The purpose of Settings() is that whenever Settings() or any of

Re: re beginner

2006-06-04 Thread faulkner
you could write a function which takes a match object and modifies d, pass the function to re.sub, and ignore what re.sub returns. # untested code d = {} def record(match): s = match.string[match.start() : match.end()] i = s.index('\t') print s, i# debugging d[s[:i]] = int(s[i+

Re: check for dictionary keys

2006-06-02 Thread faulkner
def all(s): for x in s: if not x: return False return True bad_combos = [['-A', '-B'], ['-A', '-C'], ...] for bad_combo in bad_combos: assert not all([bad_elem in a for bad_elem in bad_combo]) [EMAIL PROTECTED] wrote: > hi > in my code, i use dict(a) to make to "a" into a dic

do you have a local copy of Lython?

2006-06-02 Thread faulkner
t.org/python suggested posting here. If you have a saved copy, please email it to me or link me to a working download. Thanks for your time, faulkner -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling

2006-02-03 Thread Simon Faulkner
>>I love Python for it's ease and speed of development especially for the >>"Programming Challenged" like me but why hasn't someone written a >>compiler for Python? > > > But there *is* a compiler for Python. > http://www.python.org/doc/2.4.2/lib/module-compiler.html ty Bruno, I must confes that

Python on Windows

2006-02-03 Thread Simon Faulkner
I've just written my first (simple) WxPython program - yy! What would folks suggest is the easiest way to package it to run on other windows PCs? I would love a single .exe file that would run without ANY OTHER FILES even if it was 50 Mb! TIA Simon -- http://mail.python.org/mailman/list

Compiling

2006-02-03 Thread Simon Faulkner
Pardon me if this has been done to death but I can't find a simple explanation. I love Python for it's ease and speed of development especially for the "Programming Challenged" like me but why hasn't someone written a compiler for Python? I guess it's not that simple eh? Simon -- http://mail

Re: CygWin ODBC

2005-05-27 Thread Simon Faulkner
Steve Holden wrote: > Simon Faulkner wrote: > >> Hi All, >> >> I am new to Cygwin and am hoping that someone here will be able to >> tell me how to get ODBC running in Python on Cygwin. >> >> Maximum gratefullness... >> >> >> Simon >

CygWin ODBC

2005-05-27 Thread Simon Faulkner
Hi All, I am new to Cygwin and am hoping that someone here will be able to tell me how to get ODBC running in Python on Cygwin. Maximum gratefullness... Simon -- http://mail.python.org/mailman/listinfo/python-list