Re: [Tutor] Unable to get the gateway IP of wlan interface using python code

2018-11-12 Thread Bill Campbell
27;" I don't have a freebsd system available to test this, but I think this pattern should work: re.compile(r'^(default|0\.0\.0\.0)\s+(\S+)') Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www2.celestial.com/ PO Box 820; 6641 E. M

Re: [Tutor] python smtplib 'Message denied - From address spoofing attempt detected via SMTP

2016-03-25 Thread Bill Campbell
ting that it thinks the 'From:' address, is bogus. There's no MX record for jss.hs.org, and no IP address for jss.hs.org either. The From: address should be legitimate and deliverable. It might also accept a legitimate 'Reply-To:' address. Bill -- INTERNET: b...@cele

Re: [Tutor] imaplib and mutt flags

2014-01-30 Thread Bill Campbell
On Thu, Jan 30, 2014, Alan Gauld wrote: > On 30/01/14 02:45, Bill Campbell wrote: >> I'm writing a python script which uses imaplib > > We don't get many messages about imaplib so I'm > not sure how many folks here know about it. I've used it off and on for

[Tutor] imaplib and mutt flags

2014-01-29 Thread Bill Campbell
7;N' which is uses for new messages. I would like to have the script restore the 'N' status flag that mutt uses instead of 'O'. The mail server is using courier-imap with Maildir stores on CentOS Linux. Mutt access is direct on the file system, not via IMAP. Bill -- INTER

Re: [Tutor] Processing Linux command line output

2013-04-24 Thread Bill Campbell
ses os.popen import os fh = os.popen('ifconfig') for line in fh: # scan line here The more modern way to handle this is using the subprocess module with something like: from subprocess import PIPE, Popen fh = Popen('ifconfig', stdout=PIPE).stdout ... Bill -- INTER

[Tutor] distutils site.cfg variable expansion

2011-04-28 Thread Bill Campbell
install-scripts=%(prefix)s/sbin Better yet would be for the prefix to be available from the command line or taken from sys.prefix if not specified. Is there a way to do this other than fiddling the site.cfg file? Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Softwar

Re: [Tutor] Sorting a List

2011-01-12 Thread Bill Campbell
sions. import re _digits = re.compile(r'(\d+)') def ver(s): r = _digits.split(s) r[1::2] = map(lambda x: int(x), r[1::2]) return(tuple(r)) class FileInfo(object): def __init__(self, fname) self.fname = fname self.cmp = ver(fname) def __cmp__(s

Re: [Tutor] How to pass a python variable to subprocess.call?

2010-10-25 Thread Bill Campbell
iable to these subprocesses? For example: > >mydir = "/usr/local/bin" >subprocess.call("ls -l /usr/local/bin", shell=True) > >How do I replace /usr/local/bin in the subprocess call with the mydir variable? subprocess.call("ls -l '%s'" % myd

Re: [Tutor] list comprehension, efficiency?

2010-09-28 Thread Bill Campbell
llion samples. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(206) 232-9186 Skype: jwccsllc (206) 855-5792 Independent self-rel

Re: [Tutor] A Plea for Sensible Quoting

2010-09-14 Thread Bill Campbell
s here with vi (I've never been able to get my fingers retrained for emacs after almost 30 years of vi :-). Agreed on the quoting. Interspersing new information between quoted sections is great, but quoting an entire message only to add ``ditto'' at the end is idiotic. Bill -- I

Re: [Tutor] FTP from mainframe

2010-07-29 Thread Bill Campbell
me(f, fname) Of course this works for http by simply changing the url. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(20

Re: [Tutor] Why is the max size so low in this mail list?

2010-03-01 Thread Bill Campbell
link to the attachment in the body of the message. That's a feature I would like to see an all webmail servers. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island

[Tutor] imaplib command to delete messages

2010-02-26 Thread Bill Campbell
he imaplib documentation as lots of ways to delete mailboxes (folders) and expunge messages from folders, but I don't see anything about marking individual messages as deleted. What am I missing? Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.cel

[Tutor] email module, convert non multipart to multipart message

2010-01-25 Thread Bill Campbell
clean key, but I think there ought to be a neater way. Thanks. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(206) 232-9186

Re: [Tutor] Faster list searching?

2009-11-18 Thread Bill Campbell
NTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(206) 232-9186 Skype: jwccsllc (206) 855-5792 Intaxication: Euphoria at getting a refund fr

Re: [Tutor] What is Curses and why do they call it that.

2009-10-12 Thread Bill Campbell
5-1995. And should be more desirable today for applications that require efficient, heads-down data entry where one does not want to take fingers off of home keys or numeric keypads. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO B

Re: [Tutor] Issues with regex escaping on \{

2009-07-29 Thread Bill Campbell
edy, you can make it non-greedy with a >question mark As a general rule, it's a Good Idea(tm) to write regular expressions using the raw quote syntax. Instead of: re.compile('UserID: \{(.+)\}',...) Use: re.compile(r'UserID: \{(.+)\}',...) The alternative is to backw

Re: [Tutor] != -1: versus == 1

2009-07-17 Thread Bill Campbell
dex into the string matching the argument to find. The test above will return -1 if ``Source Heigtht'' is not in line, and one generally wants to have the test return True if there is something to do. The alternative would be to say ``if not line.find('Source Height') == -1: ...

Re: [Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread Bill Campbell
ni, so that's why I think >it's either not reading the ini, or perhaps it's being executed as the wrong >user or something. (Linux environment) Are you closing or flushing the output file before starting the subprocess? Bill -- INTERNET: b...@celestial.com Bill Campbell

Re: [Tutor] mac os x executable

2009-07-07 Thread Bill Campbell
s, a program that generates wrappers for X11 applications that one can click on or drop files on to execute them. For instance, I have one I call Gvim.app that executes the vim editor in an xterm (I don't like the GUI versions of vim, but prefer working in a simple xterm). Bill -- INTERNET: b

Re: [Tutor] mac os x executable

2009-07-07 Thread Bill Campbell
For a python script, say mypython.py, it should start with something like this: #!/usr/bin/env python # do stuff here Then ``chmod +x mypython.py'' and it's ready to go. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ P

Re: [Tutor] quick question to open(filename, 'r') vs. file(filename, 'r')

2009-05-04 Thread Bill Campbell
eason why Python allows such ambiguity here? > >Cheers for a quick shot of enlightenment ;-) ``pydoc file'' is your friend. It says open is an alias for file. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box

Re: [Tutor] sorting file paths made up of of strings and numbers

2009-04-14 Thread Bill Campbell
ath37', 'filepath38', 'filepath39', > 'filepath4', 'filepath40', 'filepath41', 'filepath42', 'filepath43', > 'filepath44', 'filepath45', 'filepath46', 'filepath47', &#

Re: [Tutor] glob in order of the file numbers

2009-03-06 Thread Bill Campbell
strip() > # This prints > e...@emad-laptop:~/Desktop/TEMP$ python globbing.py > This is four > This is one > This is two > This is three > Could somebody please tell me how to get the output in the right > order? files = glob.glob('*.temp') fi

Re: [Tutor] *nix tail -f multiple log files with Thread

2009-02-16 Thread Bill Campbell
On Mon, Feb 16, 2009, David wrote: >Bill Campbell wrote: >> >> The ``swatch'' program, written in perl, does this by using the >> gnu-tail program via a pipe using. >> >> gtail --follow=name --lines=1 file1 file2 ... >> >> Use the sour

Re: [Tutor] *nix tail -f multiple log files with Thread

2009-02-15 Thread Bill Campbell
to see that > code. If not why mention it? > The ``swatch'' program, written in perl, does this by using the gnu-tail program via a pipe using. gtail --follow=name --lines=1 file1 file2 ... Use the source Luke. Bill -- INTERNET: b...@celestial.com

Re: [Tutor] Variable to String?

2009-02-13 Thread Bill Campbell
d available on any datetime object. It uses the standard strftime expansion, which on any Linux/Unix box will be found with ``man strftime''. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice:

Re: [Tutor] eval and floating point

2009-01-14 Thread Bill Campbell
;Python itself. You might try: >eval ("1.0 * 3/2") Make either the numerator or denominator floating point. eval ('3.0/2') Python does the Right Thing(tm) when dividing two integers, returning an integer result. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestia

Re: [Tutor] Linux tail -f multiple log files

2009-01-06 Thread Bill Campbell
sudo = "sudo" > tail = "tail" > targ = "-f" # output appended data as the file grows > sfile = "/var/log/messages" > print colored("", "blue") > call([sudo, tail, targ, sfile]) Looking at how swatch does this

Re: [Tutor] beginsWith multiple prefixes

2008-12-24 Thread Bill Campbell
tartswith(prefix): > return True It might be more useful to return the prefix that matched as the caller already knows what ``word'' is. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer W

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

2008-12-20 Thread Bill Campbell
and perl, I have done it with two reads, the first to get the length, the second to read the data with that length. Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Merce

Re: [Tutor] Decimal fixed point representation

2008-11-21 Thread Bill Campbell
rything in decimal which made a lot of sense since they were designed primarily to run COBOL accounting applications. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-

Re: [Tutor] python based blogging software/cms?

2008-11-03 Thread Bill Campbell
for about 4 years now. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(206) 232-9186 "If taxation without consent is not

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

2008-10-02 Thread Bill Campbell
get unauthorized access or change things they shouldn't. Many of the common exploits of web pages are the result of poor checking of input resulting in sql injection attacks, and other breaches. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Bill Campbell
On Tue, Sep 23, 2008, Bill Campbell wrote: >On Wed, Sep 24, 2008, John Fouhy wrote: >>2008/9/24 Joe Python <[EMAIL PROTECTED]>: >>> Hi Pythonistas, >>> >>> I have a large dictionary of dictionary (50,000+ keys) which has a structure >>> as fol

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Bill Campbell
f, other): return(cmp((-self.income, self.name), -other.income, other.name)) d = dict( key1 = MyStuff('john', 1), key2 = MyStuff('bill', 2), ) vals = d.values() vals.sort() # vals should be sorted by income in descending order and name. Bill -- INTERNET

[Tutor] Regular expression to match \f in groff input?

2008-08-21 Thread Bill Campbell
line = line.replace(r'\001', r'\f') print line Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(206) 232-9186 I

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Bill Campbell
On Wed, Feb 27, 2008, Alex Ezell wrote: >I must be missing some simple method on a file object or something. > >What I need to do is to truncate the first line of a file which has an >unknown number of lines and an unknown size. > >The only thing I can think to do is to readlines() and then slice o

Re: [Tutor] appending to a list

2008-01-30 Thread Bill Campbell
) > >obviously, the syntax doesn't work. This should be easy, but I've never seen >example code. any pointers? mylist.append(somefunc()[1]) Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FA

Re: [Tutor] Spaces and tabs messing up code

2008-01-08 Thread Bill Campbell
to 4 spaces? Do that, and in his ~/.vimrc file, add a line ``set expandtab'' (Friends don't let friends use emacs :-). Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-91

Re: [Tutor] Windows - Linux based open() file handle mode

2007-11-19 Thread Bill Campbell
.out', 'U') instead of the $DEITY/Awful DOSish backwacks. If you're really enamoured of backslashes, add an r before the single quotes to get what you want. blast_out = open(r'C:\human\prb_blast.out','U') Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Ce

Re: [Tutor] Re-Naming an existent file

2007-10-10 Thread Bill Campbell
On Wed, Oct 10, 2007, Ed Goulart wrote: > > Hello! > > Though I've tried very hard, I couldn't find in the WEB the needed > help; so, if you can help me, please...!!! import os os.rename(old, new) Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celesti

Re: [Tutor] function for removing all white spaces from a string

2007-10-01 Thread Bill Campbell
ou want more than simple >spaces removed. > >Or you can use regexs. (Or the translate function might work too, but >i haven't >tried it for this) import re whitespace = re.compile(r'\s+') cleanstring = whitespace.sub('', dirtystring) Bill -- INTERNET: [EMAIL PROTE

Re: [Tutor] Image Analysis

2007-09-12 Thread Bill Campbell
On Wed, Sep 12, 2007, Kent Johnson wrote: >Bill Campbell wrote: >> Most mailing lists limit the size >> of messages to 40k or less. > >On this list large messages go to moderation. I think I was so >captivated with the images that I forgot about the size. A better way to

Re: [Tutor] Image Analysis

2007-09-11 Thread Bill Campbell
otas. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 We'll show the world we are prosperous, even if we h

Re: [Tutor] Bookpool sale on Addison Wesley

2007-08-09 Thread Bill Campbell
than Amazon or Powells. They're generally the first place I look. (my only assocation with any of them is as a customer). ... Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-

Re: [Tutor] Regex Ordering

2007-07-23 Thread Bill Campbell
r expression strings in reverse order such that the longer strings are tested first. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-

Re: [Tutor] "#!/usr/bin/env python" vs "#!/usr/local/bin/python"

2007-06-14 Thread Bill Campbell
#!/usr/bin/python... > >Perhaps I should use the "#!/usr/bin/env python" one. The case where ``#!/usr/bin/env python'' won't work is where there are multiple versions of python on the system, and one wants to run a version that's not first in the PATH. In that cas

Re: [Tutor] Behaviour of dictionaries and others when deleting?

2007-05-22 Thread Bill Campbell
On Mon, May 21, 2007, Kent Johnson wrote: >Bill Campbell wrote: >> Is the behaviour defined if one is processing a dictionary using >> iteritems, and delete items? >> >> for k, v in d.iteritems(): >> if somecondition(k, v): del d[k] >> >> Would

[Tutor] Behaviour of dictionaries and others when deleting?

2007-05-21 Thread Bill Campbell
leary of deleting items while processing things like this, keeping a list of keys to be deleted, then processing that list upon completion of the mail loop to delete the items from the original dictionary or database file. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software, LL

Re: [Tutor] How to test for a remainder from division

2007-05-14 Thread Bill Campbell
y any of [4,100,400] While the modulus operator is generally useful for things like this, one might want to use the calendar module for this if it's smarter about some of the subtle quirks of leapyear: import calendar if calendar.isleap(year): ... Bill -- INTERNET: [EMAIL PROTECTED] Bill C

Re: [Tutor] os.path.join question

2007-05-03 Thread Bill Campbell
On Wed, May 02, 2007, Jason Coggins wrote: > > Is it possible to use os.path.join to link to a file located in the > directory above where you are currently located? os.path.join('..', filename) os.path.realpath(os.path.join('..', filename)) Bill -- INTERN

Re: [Tutor] Question about exception

2007-04-05 Thread Bill Campbell
.mylist = mylist Exception.__init__(self, msg) try: check_something() except MyException, e: for entry in e.mylist: ... Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 2

Re: [Tutor] Passing a list, dict or tuple to MySQLdb?

2007-03-07 Thread Bill Campbell
tuples) I think what you want is ...(*list_of_tuples) similar to the syntax used when calling functions with position arguments from a list. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:

Re: [Tutor] dictionaries and memory handling

2007-02-23 Thread Bill Campbell
On Fri, Feb 23, 2007, Alan Gauld wrote: >"Bill Campbell" <[EMAIL PROTECTED]> wrote > >>>It seems that an SQL database would probably be the way to go, but I >>>am a bit concerned about speed issues (even though running time is >> ... >> Yo

Re: [Tutor] dictionaries and memory handling

2007-02-23 Thread Bill Campbell
er off using one of the hash databases, Berkeley, gdbm, etc. (see the anydbm documentation). These can be treated exactly like dictionaries in python, and are probably orders of magnitude faster than using an SQL database. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software L

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Bill Campbell
On Thu, Feb 15, 2007, Luke Paireepinart wrote: >Bill Campbell wrote: >> The major reason for not setting Reply-To: thelist is that it makes it >> *SLIGHTLY* more difficult to post something to the list and replys should >> go to the sender. IHMO, one should have to go to a

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Bill Campbell
``mutt'' mailer, this effort is simply pressing ``L'' instead of ``r'' when posting to the list and adding the listname to the subscribe section of ~/.muttrc, hardly a major inconvenience. http://www.unicom.com/pw/reply-to-harmful.html ... Bill -- INTERNET: [E

Re: [Tutor] file open error

2007-02-08 Thread Bill Campbell
your ``from os import *'' is biting you in the butt as the os.open command is being executed instead of the normal open. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:

Re: [Tutor] ***SPAM*** List to dictionary

2006-12-06 Thread Bill Campbell
ike: outDict = dict(map(lambda x: (x, 1), inList)) names = outDict.keys() names.sort() Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-

Re: [Tutor] Has anyone tried matplotlib...??

2006-10-22 Thread Bill Campbell
On Sun, Oct 22, 2006, Matt Richardson wrote: >I just used it a couple of weeks ago to produce a histogram of >randomly generated numbers. Read the documentation, it's well written >and has good examples. You might also want to look at gnuplot. Bill -- INTERNET: [EMAIL PR

Re: [Tutor] can i pass a list to a function and get one back ?

2006-10-21 Thread Bill Campbell
some_list.append(var) > return some_list > is this cool ? Ayup! The best way to find answers to questions like this is to just do it, and see what python does. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ P

Re: [Tutor] Capture telnet output to a file?

2006-10-16 Thread Bill Campbell
INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 To say that UNIX is doomed is pretty rabid, OS/2 will certainly play a role, but you d

Re: [Tutor] Capture telnet output to a file?

2006-10-16 Thread Bill Campbell
t'' program in *NIX systems which captures your entire session. I haven't used pexpect with python yet, but the perl expect module can also be used to capture things like this, and I would expect that one could do this with pexpect as well. Bill -- INTERNET: [EMAIL PROTECTED] Bill

Re: [Tutor] python equivalent of perl readlink()?

2006-10-16 Thread Bill Campbell
On Mon, Oct 16, 2006, Alan Gauld wrote: > >"Bill Campbell" <[EMAIL PROTECTED]> wrote in message >> The >function is in the os module ([2] >>> http://docs.python.org/lib/os-file-dir.html). >> >> Silly me. I was looking in the os.path modul

Re: [Tutor] python equivalent of perl readlink()?

2006-10-15 Thread Bill Campbell
On Sun, Oct 15, 2006, Michael P. Reilly wrote: > > On 10/15/06, Bill Campbell <[EMAIL PROTECTED]> wrote: > > Is there a python equivalent of the perl readlink() function > (e.g. one that returns the relative path in cases where a command > such as ``ln

[Tutor] python equivalent of perl readlink()?

2006-10-14 Thread Bill Campbell
olved path rather than the relative one (/usr/local/bin/ls in the case above). Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 `

Re: [Tutor] is there a tutorial on ez_install.py

2006-09-08 Thread Bill Campbell
On Fri, Sep 08, 2006, Kent Johnson wrote: >Bill Campbell wrote: >> On Fri, Sep 08, 2006, Kent Johnson wrote: >>> http://peak.telecommunity.com/DevCenter/EasyInstall >> >> Is it possible to use EasyInstall to install relative to a >> directory other than the s

Re: [Tutor] is there a tutorial on ez_install.py

2006-09-08 Thread Bill Campbell
s description of GUIs ``GUIs make simple things simple and complex things impossible''. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820;

[Tutor] Library for rtf to text?

2006-07-12 Thread Bill Campbell
se that if necessary, but would prefer a pure python solution. Any hints on this? Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 `

Re: [Tutor] Python + PostGreSQL

2006-03-31 Thread Bill Campbell
qlobject. So far I haven't tried psycopg2. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 A child can go only so far

Re: [Tutor] Test If File System is mounted in Linux

2006-03-17 Thread Bill Campbell
(Tiger) -- no /proc/mounts or /etc/fstab SCO OpenServer 5.0.6a -- no /proc/mounts or /etc/fstab All of these systems have the gnu gdf which returns information in the same format. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Systems, Inc. URL: http://www.celestial.com/ PO Bo

Re: [Tutor] Test If File System is mounted in Linux

2006-03-17 Thread Bill Campbell
On Fri, Mar 17, 2006, Adam wrote: >On 17/03/06, Bill Campbell <[EMAIL PROTECTED]> wrote: >> On Fri, Mar 17, 2006, Michael Lange wrote: >> >On Fri, 17 Mar 2006 00:36:35 -0700 >> >fortezza-pyt <[EMAIL PROTECTED]> wrote: >> > >> >> If

Re: [Tutor] Test If File System is mounted in Linux

2006-03-17 Thread Bill Campbell
zip(gdf_cols, line.split(None, 5))) filesys = rec['filesys'] dir = rec.get('dir') if ( dir and not (filesys.find(':') >= 0 or pseudofilesys.get(filesys)) ): mounted.append(dir) df.close() return mounte

Re: [Tutor] usernames and uid in linux

2006-03-03 Thread Bill Campbell
from the passwd file. But I want to do > something like: > command(username) > And get something that returns the uid (the number). You're close: import pwd pw = pwd.getpwnam('username') Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Systems, In

Re: [Tutor] Postgresql+Python -tutorial?

2006-02-10 Thread Bill Campbell
h one offhand). The licensing issues with mysql make me very leary of doing anything commercial with it. There is also the python sqlobject system which provides a very object oriented wrapper on top of relational databases. Using sqlobject can make many database functions very easy, and large

Re: [Tutor] How to get terminal settings

2006-01-19 Thread Bill Campbell
On Thu, Jan 19, 2006, Vincent Zee wrote: >Hi, > >say you want to write a more-like program. >How do you know how many lines the terminal window >can display. Use the curses library, and it will take care of this for you. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Cel

Re: [Tutor] Who called me?

2005-11-10 Thread Bill Campbell
On Thu, Nov 10, 2005, Kent Johnson wrote: >Bill Campbell wrote: > >>The problem I'm working on now is to have our client's machines connect to >>our XML-RPC server in cron jobs which will do at least two things, check to >>see if their dynamic IP address has cha

Re: [Tutor] Who called me?

2005-11-10 Thread Bill Campbell
On Tue, Nov 08, 2005, Kent Johnson wrote: >Kent Johnson wrote: >> Bill Campbell wrote: >> >>>Is there a way in python for a method to determine its parent? >>> >>>In particular, I'm working with SimpleXMLRPCServer, and would >>>like to be ab

[Tutor] Who called me?

2005-11-08 Thread Bill Campbell
don't know how to get to that. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ My brother

Re: [Tutor] python ncurses vs OS X Tiger's xterms.

2005-10-14 Thread Bill Campbell
he X Resources that xterms support, but it would be much nicer if there is something I can handle in my python ncurses routines than if I have to dig into the keyboard mapping stuff. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill

[Tutor] python ncurses vs OS X Tiger's xterms.

2005-10-13 Thread Bill Campbell
, at least on Tiger and Panther which are the only machines I have in-house for testing. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206)

Re: [Tutor] Importing Modules Within Classes

2005-10-07 Thread Bill Campbell
rting the modules that may or may not use them. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206)

Re: [Tutor] Stupid newbie question

2005-09-23 Thread Bill Campbell
e'' of python, indentation errors. The getday routine appears to be a subroutine of __init__, not a method of the class. BTW: Not to start a religious war, I hated BEGIN/END blocks on ALGOL too, but in those days my editor was an 026 keypunch or worse, making paper tapes on a telet

Re: [Tutor] Performance difference, ``in'' vs ``has_key()''

2005-07-18 Thread Bill Campbell
htab.html Thanks for the references (occassionaly there's something that government does that's actually useful :-). Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186

[Tutor] Performance difference, ``in'' vs ``has_key()''

2005-07-17 Thread Bill Campbell
and a dictionary? I presume that using it with small hashes will be faster than dictionries since it doesn't have to calculate the hashes. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:

Re: [Tutor] strip an email

2005-06-24 Thread Bill Campbell
ilman/listinfo/tutor >> >___ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > -- Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Bo

Re: [Tutor] CPAN for python

2005-06-06 Thread Bill Campbell
>http://www.python.org/pypi There's also the vaults of parnassus http://www.vex.net/parnassus/ Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer

Re: [Tutor] Detecting my own IP address?

2005-06-05 Thread Bill Campbell
expressions, keyed on the first and third entries in os.uname() output. I don't do Windows so can't say what it does (knowing Microsoft, it may vary between Windows versions, patch levels, and the phase of the moon :-). Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Softwar

Re: [Tutor] Detecting my own IP address?

2005-06-05 Thread Bill Campbell
interface on the private address which probably isn't what is required). One disadvantage of parsing ifconfig is that output varies depending on the operating system. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Systems, Inc. UUCP: camco!bill PO Box 820; 6641 E

Re: [Tutor] TKinter and things over Linux

2005-04-20 Thread Bill Campbell
ndard input into a file, and to its own standard output. make 2>&1 | tee make.output Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040

Re: [Tutor] Of fish and foul...(aka the Perl require command)

2005-04-18 Thread Bill Campbell
s particular question in the >book you recommend? Good? That depends on what your standards are. I found ``Perl to Python Migration'' by Martin C. Brown useful. I think I found this on bookpool.com, but you can always try bookfinder.com which can find pretty much anything. Bill

Re: [Tutor] TKinter and things over Linux

2005-04-16 Thread Bill Campbell
ese in Linux) Python scripts should Just Run(tm) whether they have a .py extension or not on a Linux box. Linux, and most *nix flavours don't depend on the file suffix to determine what type of file it is, but generally look at the first few bytes of the file (if a text file starts with

[Tutor] Berkeley db incompatibility

2005-03-04 Thread Bill Campbell
out of the enum. I've tried google to find a fix, but haven't found anything yet. Is there a recommended fix for this? Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 23

Re: [Tutor] Matching multiple regular expressions

2005-01-12 Thread Bill Campbell
re.compile(r'pattern1'), re.compile(r'pattern2'), ... ) fh = open('somefile') for line in fh.xreadlines(): for regex in relist: if regex.search(line): break else: print line Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbe

Re: [Tutor] (OT) How to run a script file

2005-01-05 Thread Bill Campbell
no python! >Back to Mandrake I think. I have yet to see a SuSE distribution without python although you may have to install it from using yast2. FWIW, I would strongly recommend the SuSE Professional rather than the Personal if you're going to be doing any serious development work. Bi

Re: [Tutor] here documents

2005-01-03 Thread Bill Campbell
of text here, perhaps with %s insertion ''' % 'variable' You will have to use the ``printf'' type features of the ``%'' operator in places where one could include variable names within perl's double quotes or ``HERE'' types. Bill -- INTERNET:

Re: [Tutor] eval and exec

2004-12-04 Thread Bill Campbell
On Sat, Dec 04, 2004, Gonçalo Rodrigues wrote: >Bill Campbell wrote: ... >>>Both are extremely dangerous functions from a security >>>and maintenance/reliability pouint of view and should be >>>used very rarely. >> >> >>True enough, but useful upon

Re: [Tutor] eval and exec

2004-12-04 Thread Bill Campbell
variables with the name of the table so I'm not accessing the dictionary. Would something like this work: # dbtables is already built for table in dbtables.keys(): exec("%s = dbtables['%s']" % (table, table)) Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell;