socketServer questions

2005-10-07 Thread rbt
= str.strip(data) bytes = str(len(data)) public_ip = self.client_address[0] serv_date = time.strftime('%Y-%m-%d', time.localtime()) serv_time = time.strftime('%H:%M:%S', time.localtime()) # Note that 'data; comes from the client.

Re: socketServer questions

2005-10-07 Thread rbt
On Fri, 2005-10-07 at 09:17 -0700, Paul Rubinhttp: wrote: > > 3. How do I keep people from tampering with the server? The clients > > send strings of data to the server. All the strings start with x and > > end with y and have z in the middle. Is requiring x at the front and > > y at the back and z

Re: socketServer questions

2005-10-08 Thread rbt
On Fri, 2005-10-07 at 15:07 -0700, Paul Rubinhttp: wrote: > rbt <[EMAIL PROTECTED]> writes: > > The server just logs data, nothing else. It's not private or important > > data... just sys admin type stuff (ip, mac addy, etc.). I just don't > > want some scrip

Re: socketServer questions

2005-10-10 Thread rbt
On Sat, 2005-10-08 at 14:09 -0700, Paul Rubinhttp: wrote: > rbt <[EMAIL PROTECTED]> writes: > > Off-topic here, but you've caused me to have a thought... Can hmac be > > used on untrusted clients? Clients that may fall into the wrong hands? > > How would one hand

One last thing about SocketServer

2005-10-10 Thread rbt
hese generated clients to manage and/or monitor them? The SocketServer module is great, but it seems to hide too many details of what it's up to! Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: socketServer questions

2005-10-10 Thread rbt
On Mon, 2005-10-10 at 05:54 -0700, Paul Rubinhttp: wrote: > rbt <[EMAIL PROTECTED]> writes: > > > I don't understand the question. HMAC requires that both ends share a > > > secret key; does that help? > > > > That's what I don't get. I

Re: socketServer questions

2005-10-10 Thread rbt
On Mon, 2005-10-10 at 07:46 -0700, Paul Rubinhttp: wrote: > rbt <[EMAIL PROTECTED]> writes: > > > Instead, for client #i, let that client's key be something like > > > hmac(your_big_secret, str(i)).digest() > > > and the client would send #i as part of t

speeding up Python when using wmi

2005-11-28 Thread rbt
Here's a quick and dirty version of winver.exe written in Python: http://filebox.vt.edu/users/rtilley/public/winver/winver.html It uses wmi to get OS information from Windows... it works well, but it's slow... too slow. Is there any way to speed up wmi? In the past, I used the platform and sys

Re: speeding up Python when using wmi

2005-11-28 Thread rbt
Tim Golden wrote: > [rbt] > >> Here's a quick and dirty version of winver.exe written in Python: > > [.. snip ..] > >> It uses wmi to get OS information from Windows... it works well, but >> it's slow... too slow. Is there any way to speed up wmi? >

Re: How to execute an EXE via os.system() with spaces in the directory name?

2005-12-06 Thread rbt
[EMAIL PROTECTED] wrote: > This comes up from time to time. The brain damage is all Windows', not > Python's. Here's one thread which seems to suggest a bizarre doubling > of the initial quote of the commandline. > > http://groups.google.com/group/comp.lang.python/browse_frm/thread/89d94656ea393

extract python install info from registry

2005-12-06 Thread rbt
On windows xp, is there an easy way to extract the information that Python added to the registry as it was installed? -- http://mail.python.org/mailman/listinfo/python-list

Re: extract python install info from registry

2005-12-06 Thread rbt
Laszlo Zsolt Nagy wrote: > rbt wrote: > >> On windows xp, is there an easy way to extract the information that >> Python added to the registry as it was installed? >> >> > Using regedit.exe, look at the registry keys and values under > > HKEY_LOCAL_MACH

Re: extract python install info from registry

2005-12-06 Thread rbt
gene tani wrote: >> There's more to it than that... isn't there? I've used _winreg and the >> win32 extensions in the past when working with the registry. I thought >> perhaps someone had already scripted something to extract this info. >> > > Yes, a small firm named Microsoft has done this (but n

arbitrary number of arguments in a function declaration

2005-01-02 Thread rbt
How do I set up a function so that it can take an arbitrary number of arguments? For example, I have a bunch of expenses which may grow or shrink depending on the client's circumstance and a function that sums them up... hard coding them is tedious. How might I make this dynamic so that it can

Re: arbitrary number of arguments in a function declaration

2005-01-02 Thread rbt
Nick Coghlan wrote: rbt wrote: How do I set up a function so that it can take an arbitrary number of arguments? For example, I have a bunch of expenses which may grow or shrink depending on the client's circumstance and a function that sums them up... hard coding them is tedious. How mi

ftplib with unknown file names

2005-01-10 Thread rbt
How can I use ftplib to retrieve files when I do not know their names? I can do this to get a listing of the directory's contents: ftp_server.retrlines('LIST') The output from this goes to the console and I can't figure out how to turn that into something I can use to actually get the files (lik

Re: ftplib with unknown file names

2005-01-10 Thread rbt
Jeremy Jones wrote: rbt wrote: How can I use ftplib to retrieve files when I do not know their names? I can do this to get a listing of the directory's contents: ftp_server.retrlines('LIST') The output from this goes to the console and I can't figure out how to turn that

exceptions and items in a list

2005-01-10 Thread rbt
If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other objects in the list, or does it

Re: exceptions and items in a list

2005-01-10 Thread rbt
Andrey Tatarinov wrote: rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue wit

Re: Debian says "Warning! you are running an untested version of Python." on 2.3

2005-01-13 Thread rbt
Nick Craig-Wood wrote: > Alex Stapleton <[EMAIL PROTECTED]> wrote: >> Whenever I run python I get >> >> "Warning! you are running an untested version of Python." >> >> prepended to the start of any output on stdout. >> >> This is with Debian and python 2.3 (running the debian 2.1 and 2.2 >>

Re: dynamic data types

2005-01-17 Thread rbt
Charlie wrote: Hi, The description of Python always mentions "very high level dynamic data types". Now, I can't seem to find any examples of these (nothing described with this term anyway). Is this simply refering to built-in dynamic data structures such as lists and dictionaries, with a great deal

Re: Install Python 2.4 on Fedora 3 Core

2005-01-17 Thread rbt
Bill wrote: I have less than a week experience on linux, so I am a new newbie. Python 2.3 came preinstalled. I installed version 2.4. All seemed to go well except it installed to usr/local? 1. Was it wrong to install when logged in as 'root'? Does it make a difference? 2. I looked in the package

Memory Usage

2005-01-24 Thread rbt
about 1 MB of Ram. On the machine with more Ram, it uses 9 MB of Ram. Is this normal and expected behavior? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory Usage

2005-01-24 Thread rbt
Peter Hansen wrote: rbt wrote: Would a Python process consume more memory on a PC with lots of memory? For example, say I have the same Python script running on two WinXP computers that both have Python 2.4.0. One computer has 256 MB of Ram while the other has 2 GB of Ram. On the machine with

Re: urllib2 and proxy question

2005-01-24 Thread rbt
Fuzzyman wrote: urllib2 (under windows) will auto-detect your proxy settings and use those. Normally that's a good thing (I guess), except when it's not ! How do I switch off this behaviour ? I'm behind a censoring proxy and wanting to test things *locally*. IE is set to not use the proxy when fetc

exclude binary files from os.walk

2005-01-26 Thread rbt
Is there an easy way to exclude binary files (I'm working on Windows XP) from the file list returned by os.walk()? Also, when reading files and you're unsure as to whether or not they are ascii or binary, I've always thought it safer to 'rb' on the read, is this correct... and if so, what's the

Re: exclude binary files from os.walk

2005-01-26 Thread rbt
Grant Edwards wrote: On 2005-01-26, rbt <[EMAIL PROTECTED]> wrote: Is there an easy way to exclude binary files (I'm working on Windows XP) from the file list returned by os.walk()? Sure, assuming you can provide a rigorous definition of 'binary files'. :) non-ascii -- h

Re: MSI Difficulties

2005-01-26 Thread rbt
brolewis wrote: I am trying to deploy Python onto a number of laptops and have been trying to take advantage of Python 2.4's MSI installer. I have tried using the following commands to install, but to no avail: msiexec /i python-2.4.msi /qb ALLUSERS=1 -- and -- msiexec /i python-2.4.msi /qb ALLUSER

Re: The next Xah-lee post contest

2005-01-29 Thread rbt
Steve wrote: Hi All, For sometime now, I have just been a passive lurker on this list. Of late I saw an increase in the number of posts by Xah Lee, and I have to admit, what he lacks in understanding of the various programming languages he talks about, he makes up for in creativity. So, I was

Description Field in WinXP Services

2005-01-29 Thread rbt
How does one associate a "Description" with a Windows service written in Python? I've just started experimenting with Python services. Here's my code... copied straight from Mr. Hammond's "Python Programming on Win32": import win32serviceutil import win32service import win32event class test_

Re: Description Field in WinXP Services

2005-01-29 Thread rbt
Roger Upole wrote: ChangeServiceConfig2 is the api functions that sets the description, but it's not in the win32service module (yet). Roger OK, I can use _winreg to add the 'Description' field under the appropriate registry key. -- http://mail.python.org/mailman/listinfo/python-list

Re: Description Field in WinXP Services

2005-01-29 Thread rbt
rbt wrote: Roger Upole wrote: ChangeServiceConfig2 is the api functions that sets the description, but it's not in the win32service module (yet). Roger OK, I can use _winreg to add the 'Description' field under the appropriate registry key. Here's an example of

string issue

2005-02-04 Thread rbt
Either I'm crazy and I'm missing the obvious here or there is something wrong with this code. Element 5 of this list says it doesn't contain the string 255, when that's *ALL* it contains... why would it think that??? import time ips = ['255.255.255.255', '128.173.120.79', '198.82.247.98', '127.

Re: string issue

2005-02-04 Thread rbt
Thanks guys... list comprehension it is! Bill Mill wrote: On Fri, 04 Feb 2005 14:23:36 -0500, rbt <[EMAIL PROTECTED]> wrote: Either I'm crazy and I'm missing the obvious here or there is something wrong with this code. Element 5 of this list says it doesn't contain the string

Re: string issue

2005-02-04 Thread rbt
Steve Holden wrote: rbt wrote: Either I'm crazy and I'm missing the obvious here or there is something wrong with this code. Element 5 of this list says it doesn't contain the string 255, when that's *ALL* it contains... why would it think that??? import time ips

Re: string issue

2005-02-04 Thread rbt
Alan McIntyre wrote: I think it's because you're modifying the list as you're iterating over In this case then, shouldn't my 'except Exception' raise an error or warning like: "Hey, stupid, you can't iterate and object and change it at the same time!" Or, perhaps something similar? -- http://mai

Re: string issue

2005-02-04 Thread rbt
Alan McIntyre wrote: I think it's because you're modifying the list as you're iterating over it. One last clarification on this. It's OK to modify the elements of a list, but not the list itself while iterating over it... is that the correct way to think about this? -- http://mail.python.org/m

Re: string issue

2005-02-04 Thread rbt
John J. Lee wrote: Steve Holden <[EMAIL PROTECTED]> writes: [...] You are modifying the list as you iterate over it. Instead, iterate over a copy by using: for ip in ips[:]: ... Just to help popularise the alternative idiom, which IMO is significantly less cryptic (sane constructors of mutable o

Re: string issue

2005-02-04 Thread rbt
Bill Mill wrote: On Fri, 04 Feb 2005 15:25:04 -0500, rbt <[EMAIL PROTECTED]> wrote: John J. Lee wrote: Steve Holden <[EMAIL PROTECTED]> writes: [...] You are modifying the list as you iterate over it. Instead, iterate over a copy by using: for ip in ips[:]: ... Just to help po

breaking out of nested loop

2005-07-12 Thread rbt
What is the appropriate way to break out of this while loop if the for loop finds a match? while 1: for x in xrange(len(group)): try: mix = random.sample(group, x) make_string = ''.join(mix) n = md5.new(make_string) match = n.hexd

Re: breaking out of nested loop

2005-07-12 Thread rbt
Thanks guys... that works great. Now I understand why sometimes logic such as 'while not true' is used ;) On Tue, 2005-07-12 at 10:51 -0400, Peter Hansen wrote: > rbt wrote: > > What is the appropriate way to break out of this while loop if the for > > loop finds a match?

all possible combinations

2005-07-13 Thread rbt
Say I have a list that has 3 letters in it: ['a', 'b', 'c'] I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 abaa aaba aaab acaa aaca aaac ... What is the most efficient way to do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: all possible combinations

2005-07-13 Thread rbt
On Thu, 2005-07-14 at 00:47 +1000, Steven D'Aprano wrote: > On Wed, 13 Jul 2005 10:21:19 -0400, rbt wrote: > > > Say I have a list that has 3 letters in it: > > > > ['a', 'b', 'c'] > > > > I want to print all the

Re: all possible combinations

2005-07-13 Thread rbt
On Wed, 2005-07-13 at 10:21 -0400, rbt wrote: > Say I have a list that has 3 letters in it: > > ['a', 'b', 'c'] > > I want to print all the possible 4 digit combinations of those 3 > letters: > > 4^3 = 64 > > > abaa > aaba

Re: all possible combinations

2005-07-13 Thread rbt
On Wed, 2005-07-13 at 11:09 -0400, rbt wrote: > On Wed, 2005-07-13 at 10:21 -0400, rbt wrote: > > Say I have a list that has 3 letters in it: > > > > ['a', 'b', 'c'] > > > > I want to print all the possible 4 digit combinations o

Re: all possible combinations

2005-07-14 Thread rbt
Thanks to all who were helpful... some of you guys are too harsh and cynical. Here's what I came up with. I believe it's a proper combination, but I'm sure someone will point out that I'm wrong ;) groups = [list('abc'),list('abc'),list('abc'),list('abc')] already = [] while 1: LIST = []

Re: all possible combinations

2005-07-15 Thread rbt
Wow. That's neat. I'm going to use it. Thanks! On Thu, 2005-07-14 at 19:52 -0400, Peter Hansen wrote: > Bengt Richter wrote: > > On Thu, 14 Jul 2005 17:10:37 -0400, William Park <[EMAIL PROTECTED]> wrote: > > It's a one liner in Python too ;-) > > > > >>> print ' '.join([x+y+z+q for s in ['abc']

Re: Python scripts wont run - HELP

2005-07-18 Thread rbt
On Mon, 2005-07-18 at 17:22 +0100, John Abel wrote: > windozbloz wrote: > > >Bye Bye Billy Bob... > > > >Hello All, > >I'm a fairly literate windoz amateur programmer mostly in visual basic. I > >have switched to SuSE 9.2 Pro and am trying to quickly come up to speed > >with Python 2.3.4. I can r

Re: goto

2005-07-18 Thread rbt
On Mon, 2005-07-18 at 12:27 -0600, Steven Bethard wrote: > Hayri ERDENER wrote: > > what is the equivalent of C languages' goto statement in python? > > Download the goto module: > http://www.entrian.com/goto/ > And you can use goto to your heart's content. And to the horror of all > your f

Re: goto

2005-07-18 Thread rbt
10 PRINT "YOU'RE NOT RIGHT IN THE HEAD." 20 GOTO 10 On Tue, 2005-07-19 at 02:33 +, Leif K-Brooks wrote: > rbt wrote: > > IMO, most of the people who deride goto do so because they heard or read > > where someone else did. > > 1 GOTO 17 > 2 mean,

Re: goto

2005-07-19 Thread rbt
On Tue, 2005-07-19 at 10:02 -0400, George Sakkis wrote: > "rbt" <[EMAIL PROTECTED]> wrote: > > > On Mon, 2005-07-18 at 12:27 -0600, Steven Bethard wrote: > > > Hayri ERDENER wrote: > > > > what is the equivalent of C languages' goto sta

Re: goto

2005-07-19 Thread rbt
On Wed, 2005-07-20 at 03:43 +1000, Steven D'Aprano wrote: > On Tue, 19 Jul 2005 11:29:58 -0400, rbt wrote: > > >> It should not really come as a shock that the same fellow who came up with > >> a brilliant efficient way > >> to generate all permutations

broken links

2005-07-22 Thread rbt
How can I find broken links (links that point to files that do not exist) in a directory and remove them using Python? I'm working on RHEL4 Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: broken links

2005-07-22 Thread rbt
I found it: os.path.exists(path) On Fri, 2005-07-22 at 09:22 -0400, rbt wrote: > How can I find broken links (links that point to files that do not > exist) in a directory and remove them using Python? I'm working on RHEL4 > > Thanks, > rbt -- http://mail.python.org/mai

pretty windows installer for py scripts

2005-09-08 Thread rbt
Any recommendations on a windows packager/installer that's free? I need it to allow non-tech users to install some python scripts... you know, "Click Next"... "Click Next"... "Click Finish"... "You're Done!" and everything just magically works ;) -- http://mail.python.org/mailman/listinfo/python-l

Get Mac OSX Version

2005-09-13 Thread rbt
Is there a similar function to sys.getwindowsversion() for Macs? Many thanks! -- http://mail.python.org/mailman/listinfo/python-list

appended crontab entries with py script

2005-09-13 Thread rbt
How can I safely append a crontab entry to a crontab file progammatically with Python? I need to handle crontabs that currently have entries and crontabs that are empty. Also, I'd like this to work across Linux and BSD systems. Any pointers? -- http://mail.python.org/mailman/listinfo/python-list

Re: appended crontab entries with py script

2005-09-14 Thread rbt
On Tue, 2005-09-13 at 23:18 -0400, Mike Meyer wrote: > rbt <[EMAIL PROTECTED]> writes: > > > How can I safely append a crontab entry to a crontab file > > progammatically with Python? > > Well, one way would be to invoke the system crontab utility and use an >

win32 service and time.sleep()

2005-09-20 Thread rbt
minutes with time.sleep(600) and then wakes and tries again. This is when the problem occurs. I can't stop the service while the program is sleeping. When I try, it just hangs until a reboot. Can some suggest how to fix this? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

win32 service and time.sleep()

2005-09-20 Thread rbt
minutes with time.sleep(600) and then wakes and tries again. This is when the problem occurs. I can't stop the service while the program is sleeping. When I try, it just hangs until a reboot. Can some suggest how to fix this? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding where to store application data portably

2005-09-22 Thread rbt
On Tue, 2005-09-20 at 23:03 +0100, Tony Houghton wrote: > I'm using pygame to write a game called Bombz which needs to save some > data in a directory associated with it. In Unix/Linux I'd probably use > "~/.bombz", in Windows something like > "C:\Documents And Settings\\Applicacation Data\Bombz".

safest way to open files on all platforms

2005-02-14 Thread rbt
n a binary file might cause some sort of corruption). Anyway, am I right in saying this? That 'rb' is the safest way to open files for reading and that it should work well on *all* Python supported platforms? Many thanks, RBT -- http://mail.python.org/mailman/listinfo/python-list

Re: safest way to open files on all platforms

2005-02-14 Thread rbt
Fredrik Lundh wrote: "rbt" wrote: I believe that this is the safest way to open files on Windows, Linux, Mac and Unix, but I wanted to ask here just to be sure: fp = file('filename', 'rb') The 'b' on the end being the most important ingredient (especially

os.walk() usage

2005-02-15 Thread rbt
I'm trying to write very small, modular code as functions to break up a big monolithic script that does a file system search for particular strings. The script works well, but it's not easy to maintain or add features to. I'd like to have a function that builds a list of files with os.walk() a

Re: os.walk() usage

2005-02-15 Thread rbt
[EMAIL PROTECTED] wrote: every object in os.walk() returns a 3-tuple, like below, it seems your code assumes it returns only a list of files. for d in os.walk('c:\\temp'): (dirpath, dirnames, filenames) = d print dirpath print dirnames print filenames Thank you, this

more os.walk() issues... probably user error

2005-02-16 Thread rbt
This function is intended to remove unwanted files and dirs from os.walk(). It will return correctly *IF* I leave the 'for fs in fs_objects' statement out (basically leave out the entire purpose of the function). It's odd, when the program goes into that statment... even when only a 'pass', an

Re: more os.walk() issues... probably user error

2005-02-16 Thread rbt
rbt wrote: This function is intended to remove unwanted files and dirs from os.walk(). It will return correctly *IF* I leave the 'for fs in fs_objects' statement out (basically leave out the entire purpose of the function). It's odd, when the program goes into that statment... e

Re: more os.walk() issues... probably user error

2005-02-16 Thread rbt
Kent Johnson wrote: rbt wrote: rbt wrote: This function is intended to remove unwanted files and dirs from os.walk(). It will return correctly *IF* I leave the 'for fs in fs_objects' statement out (basically leave out the entire purpose of the function). It's odd, when the pr

os.walk()

2005-02-17 Thread rbt
Could someone demonstrate the correct/proper way to use os.walk() to skip certain files and folders while walking a specified path? I've read the module docs and googled to no avail and posted here about other os.walk issues, but I think I need to back up to the basics or find another tool as th

Re: os.walk()

2005-02-17 Thread rbt
Roel Schroeven wrote: rbt wrote: The problem I run into is that some of the files and dirs are not removed while others are. I can be more specific and give exact examples if needed. On WinXP, 'pagefile.sys' is always removed, while 'UsrClass.dat' is *never* removed, etc. K

re.compile and very specific searches

2005-02-18 Thread rbt
Is it possible to use re.compile to exclude certain numbers? For example, this will find IP addresses: ip = re.compile('\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}') But it will also find 999.999.999.999 (something which could not possibly be an IPv4 address). Can re.compile be configured to filter results

Re: re.compile and very specific searches

2005-02-18 Thread rbt
John Machin wrote: Diez B. Roggisch wrote: So I'd suggest you dump re and do it like this: address = "192.168.1.1" def validate_ip4(address): digits = address.split(".") if len(digits) == 4: for d in digits: if int(d) < 0 or int(d) > 255: return False re

Re: How to wrap a class's methods?

2005-02-20 Thread rbt
Jeff Shannon wrote: You could probably also do this as a factory function, rather than as a class (also untested!): def Wrapper(func): def wrapped(self, *args, **kwargs): s, r = func(self, *args, **kwargs) if s != 'OK': raise NotOK((s,r)) return r retur

searching pdf files for certain info

2005-02-22 Thread rbt
Not really a Python question... but here goes: Is there a way to read the content of a PDF file and decode it with Python? I'd like to read PDF's, decode them, and then search the data for certain strings. Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: searching pdf files for certain info

2005-02-22 Thread rbt
Andreas Lobinger wrote: Aloha, rbt wrote: Not really a Python question... but here goes: Is there a way to read the content of a PDF file and decode it with Python? I'd like to read PDF's, decode them, and then search the data for certain strings. First of all, http://groups.google

Re: searching pdf files for certain info

2005-02-22 Thread rbt
Andreas Lobinger wrote: Aloha, rbt wrote: Thanks guys... what if I convert it to PS via printing it to a file or something? Would that make it easier to work with? Not really... The classical PS Drivers (f.e. Acroread4-Unix print-> ps) simply define the pdf graphics and text operators as

Re: searching pdf files for certain info

2005-02-22 Thread rbt
Tom Willis wrote: I tried that for something not python related and I was getting sporadic spaces everywhere. I am assuming this is not the case in your experience? On Tue, 22 Feb 2005 10:45:09 -0500, rbt <[EMAIL PROTECTED]> wrote: Andreas Lobinger wrote: Aloha, rbt wrote: Thanks guys... w

Re: searching pdf files for certain info

2005-02-22 Thread rbt
Tom Willis wrote: Well sporadic spaces in strings would cause problems would it not? an example The String: "Patient Face Sheet"--->pdftotext--->"P a tie n t Face Sheet" I'm just curious if you see anything like that, since I really have no clue about ps or pdf etc...but I have a strong desire

hidden attribute on Windows files

2005-03-07 Thread rbt
How do I enable the hidden attribute when creating files on Windows computers? I'd *really* prefer to do from the standard Python installer (no win32 extensions). Any tips? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: autoexecution in Windows

2005-03-07 Thread rbt
Earl Eiland wrote: How does one make a Python program auto-execute in Windows? Earl No program (python or other) can just arbitrarily execute. A user has to click it or a cron-like utility (Task Scheduler) has to execute it at a set time. registry entries (such as run) can execute programs too. A

Re: autoexecution in Windows

2005-03-07 Thread rbt
Earl Eiland wrote: In Linux, if I make the first line #!/path/to/Python, all I have to do to execute the program is type ./FileName (assuming my pwd is the same as FileName). what's the Windows equivalent? Earl On Mon, 2005-03-07 at 13:36, F. Petitjean wrote: Le Mon, 07 Mar 2005 13:25:35 -0700, Ea

os.walk(entire filesystem)

2005-03-09 Thread rbt
More of an OS question than a Python question, but it is Python related so here goes: When I do os.walk('/') on a Linux computer, the entire file system is walked. On windows, however, I can only walk one drive at a time (C:\, D:\, etc.). Is there a way to make os.walk() behave on Windows as it

Reading a HP Printer Web Interface

2004-12-27 Thread rbt
Hello there, Depending on the firmware version of the HP printer and the model type, one will encounter a myriad of combinations of the following strings while reading the index page: hp HP color Color Printer Printer Status Status: Device: Device Status laserjet LaserJet How can I go about dete

Re: spaces in re.compile()

2005-03-21 Thread rbt
AndrewN wrote: d = re.compile(' \d{3}\.\d{3}\.\d{3} ') d.findall(' 123.345.678 ') [' 123.345.678 '] Works for me. Yes, you're correct. That works if there is a space at the front and back. However, place '123.345.678' in a file by itself and it doesn't work. What I'm trying to avoid is something

spaces in re.compile()

2005-03-21 Thread rbt
Is it possible to use spaces in a re.compile()? For example, I want to make sure one space exists right before this string and right after it: re.compile ('\d{3,3}\.\d{3,3}\.\d{3,3}\.\d{3,3}') I've tried this, but it didn't work: re.compile (' \d{3,3}\.\d{3,3}\.\d{3,3}\.\d{3,3} ') Any ideas? -- h

Re: spaces in re.compile()

2005-03-21 Thread rbt
Jeff Epler wrote: Maybe you want r'\b'. From 'pydoc sre': \b Matches the empty string, but only at the start or end of a word. import re r = re.compile( r'\btest\b' ) print r.findall("testy") print r.findall(" testy ") print r.findall(" test ") print r.findall("test") That works great. T

os.stat access and modify time same on WinXP

2005-03-23 Thread rbt
I'm using the standard NTFS file system. The only time the access time is updated is when the file is modified or saved (with no changes). What's up with that? Shouldn't a read/view update the access time? -- http://mail.python.org/mailman/listinfo/python-list

Re: os.stat access and modify time same on WinXP

2005-03-23 Thread rbt
Peter Hansen wrote: rbt wrote: I'm using the standard NTFS file system. The only time the access time is updated is when the file is modified or saved (with no changes). What's up with that? Shouldn't a read/view update the access time? See http://www.microsoft.com/resource

truncating a file from the top down

2005-03-29 Thread rbt
* most efficient way of doing this? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: truncating a file from the top down

2005-03-29 Thread rbt
Mike Rovner wrote: Right. Thanks for the correction. Fredrik Lundh wrote: Mike Rovner wrote: if os.stat says the_file is too big: fh = open(the_file, 'rb') fh.seek(2008, 2) should be fh.seek(-2008, 2) right? data = fh.read() fh.close() assert len(data)==2008 # you may want some error pr

Re: How to execute a cmd line program without invoking console window?

2005-03-29 Thread rbt
Tian wrote: In Windows, I have been simply using os.system() to run command line program in python. but there will be a black console window. How can I run the program without invoking that window? i guess there are some function with which I can redirect the output? name your scripts with .pyw ext

Re: Write an hexadecimal file

2005-03-30 Thread rbt
Larry Bates wrote: There is not such thing as a hexadecimal file. Right, 300 is 300 whether you choose to represent it in decimal, binary, hex, etc... it's still only 300 of something ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Change between Python 2.3 and 2.4 under WinXP

2005-04-05 Thread rbt
Martin v. Löwis wrote: Of course, it is not all that clear what the OP actually wanted. For all we know, he wanted to "alternate quickly (with batch file or similary) between python23 and python24"... Maybe off-topic for this thread, but I noticed that when installing 2.4.1 that 2.4.0 is automatic

check interpreter version before running script

2005-04-05 Thread rbt
to do proper checking, etc. It doesn't seem that sys.version was built with this type of usage in mind. So, what is the *best* most correct way to go about this? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: Add System Path?!?

2005-04-05 Thread rbt
ath' value under this registry key: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" You can import _winreg to edit it as you like. I think it's a string... just append your path(s) to them. rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: check interpreter version before running script

2005-04-06 Thread rbt
Peter Otten wrote: rbt wrote: Is there a recommended or 'Best Practices' way of checking the version of python before running scripts? I have scripts that use the os.walk() feature (introduced in 2.3) and users running 2.2 who get errors. Instead of telling them, 'Upgrade you Pyth

shebang in cross platform scripts

2005-04-06 Thread rbt
Haven't tested this on Windows yet... thought I'd ask here: Does the line below have any negative impact on Windows machines? I develop and test mostly on Unix, but my scripts are often used on Win systems too. #!/usr/bin/env python Many thanks, rbt -- http://mail.python.org/mailma

Re: Distributing Python Apps and MySQL

2005-04-07 Thread rbt
dcrespo wrote: Hi there... I want to distribute my python apps and the MySQL Database in the easiest way possible. I mean a user just run the installation file and all is automaticly installed. Any suggestions? My knowledge: I know, as many of you, that there's py2exe for compiling python apps for

Re: Interpreter problem

2005-04-08 Thread rbt
Steve Holden wrote: Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver.py at the command prompt the file runs as

Re: Interpreter problem

2005-04-08 Thread rbt
Steve Holden wrote: rbt wrote: Steve Holden wrote: Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver

  1   2   3   >