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 r...@rtw.me.uk 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

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 et...@stoneleaf.us 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).

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

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 r...@rtw.me.uk 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

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 arno...@gmail.com 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,

Re: lists and for loops

2011-08-17 Thread Jack Trades
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

Re: Reading/Writing files

2011-03-18 Thread Jack Trades
/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

Re: Reading/Writing files

2011-03-18 Thread Jack Trades
, 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 jacktradespub...@gmail.comwrote: On Fri, Mar 18, 2011 at 4:56 PM, Jon Herman jfc.her...@gmail.com 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

Re: Reading/Writing files

2011-03-18 Thread Jack Trades
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

Re: Subversion commit from Python?

2009-05-19 Thread Jack Trades
On May 19, 3:46 am, Duncan Booth duncan.bo...@invalid.invalid wrote: Jack Trades jacktradespub...@gmail.com 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

Re: Subversion commit from Python?

2009-05-19 Thread Jack Trades
On May 19, 3:53 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message ac63e27e-2dd9-4c27-ace0- d9e205be7...@s31g2000vbp.googlegroups.com, Jack Trades wrote: On May 19, 12:26 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message 2904e7de-0a8d

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

Re: Subversion commit from Python?

2009-05-18 Thread Jack Trades
On May 19, 12:26 am, Lawrence D'Oliveiro l...@geek- 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

Re: Why not a Python compiler?

2008-02-08 Thread jack trades
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

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

2008-02-07 Thread jack trades
, 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

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

2008-02-05 Thread jack trades
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

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

2008-02-05 Thread jack trades
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