Re: [Tutor] import and reload in modules

2007-11-04 Thread Garry Willgoose
In response to Kent's suggestion here is an updated post showing the python code and the error log. The original reason for using try was I thought maybe this was scoping problem and that maybe 2nd time through the call it needed to import it again from scratch. As a side observation for Ke

Re: [Tutor] I need an 'atomic read/ write action'

2007-11-04 Thread Tom
Thank you for your replies.I think lockfile is a good solution. Kent, I have python 2.2.3 running on my server (not my choice) could you tell me which module(s) I could use to access cron. Otherwise the only other relavent way I can access my sever is Secure Shell Access (SSH). And what about for

Re: [Tutor] import and reload in modules

2007-11-04 Thread Kent Johnson
I don't know what the problem is but here are some things that might help: - don't catch the exception, let it print out. Send the traceback to the list. - note you never reload siberia900 - in the load function the reload fails for an unknown reason and at the interpreter prompt you reload myte

Re: [Tutor] importing

2007-11-04 Thread Kent Johnson
Lawrence Shafer wrote: > What is the difference between "from name import *" and "import name"? http://effbot.org/pyfaq/tutor-whats-the-difference-between-import-foo-and-from-foo-import.htm Kent ___ Tutor maillist - Tutor@python.org http://mail.python

Re: [Tutor] I need an 'atomic read/ write action'

2007-11-04 Thread Kent Johnson
Tom wrote: > So all my ideas for how to record task x as 'done', like using shelve > or writing a log file etc are not sufficient because, I need an 'atomic > read/ write action' (I think that's the jargon). A couple of ideas: - Michael's file lock - lockfile is another way to lock files http://

Re: [Tutor] reading and writing with csv then appending some data to a specific line

2007-11-04 Thread Kent Johnson
pierre cutellic wrote: > Hi, > I wrote this script to select some data from a csv file. > Actually it writes it into a file but i would like to append it into an > existing one to a specific line without removing existing code. > does the open(' filename.csv','a+') can do that? > > ag =

Re: [Tutor] images

2007-11-04 Thread John Fouhy
On 05/11/2007, SwartMumba snake <[EMAIL PROTECTED]> wrote: > Hi > > I would like to know which is the best module to use, with regard to my > needs: > > - I would like to read an image off a website > e.g. http://www.examplecom/image/1/PNG/ > > - I would then like to read the pixels and do other th

[Tutor] importing

2007-11-04 Thread Lawrence Shafer
What is the difference between "from name import *" and "import name"? The reason I ask is because I was using the former, and switched to the latter only to find out "NameError: global name 'name' is not defined" and I think using the latter is going to fix another problem I have. I just want

[Tutor] images

2007-11-04 Thread SwartMumba snake
Hi I would like to know which is the best module to use, with regard to my needs: - I would like to read an image off a website e.g. http://www.examplecom/image/1/PNG/ - I would then like to read the pixels and do other things to the image I am currently using python 2.5 Thanks in advance . .

[Tutor] import and reload in modules

2007-11-04 Thread Garry Willgoose
I'm writing a simple modelling environment that provides a GUI for dynamically coupling fortran and C subroutines to solve a science problem. The GUI and environment glue are all python. One thing I want to do is allow the user to load a python file that provides the user defined details on

Re: [Tutor] Difference between Perl and Python

2007-11-04 Thread Steve Willoughby
Varsha Purohit wrote: > Hello everyone, >I wanted to know what are the differences between perl and > python, since both of them are scripting languages... There is plenty of difference between them and between all the other scripting languages. Look beyond the notion of "scripting" and

[Tutor] Difference between Perl and Python

2007-11-04 Thread Varsha Purohit
Hello everyone, I wanted to know what are the differences between perl and python, since both of them are scripting languages... thanks -- Varsha, ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I need an 'atomic read/ write action'

2007-11-04 Thread Michael Langford
You don't need an atomic read and write, you need a blocking file lock mechanism. This page explains them and how to use them: http://www.voidspace.org.uk/python/pathutils.html#file-locking --Michael On 11/4/07, Tom <[EMAIL PROTECTED]> wrote: > > Hi, > > I am trying to write a cron/ task sche

Re: [Tutor] repeated times

2007-11-04 Thread Aditya Lal
On 11/4/07, Thorsten Kampe <[EMAIL PROTECTED]> wrote: > > * linda.s (Sun, 4 Nov 2007 01:39:46 -0800) > > On Nov 2, 2007 1:03 AM, ALAN GAULD <[EMAIL PROTECTED]> wrote: > > > > > >I want to run an .exe file and get the output many times. > > > >> Given that I know that you know about loops I have to

Re: [Tutor] reading and writing with csv then appending some data to a specific line

2007-11-04 Thread John
Remember to seek to the end of the file before you start writing. See: http://mail.python.org/pipermail/python-list/2000-August/048839.html ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] reading and writing with csv then appending some data to a specific line

2007-11-04 Thread pierre cutellic
Hi, I wrote this script to select some data from a csv file. Actually it writes it into a file but i would like to append it into an existing one to a specific line without removing existing code. does the open('filename.csv','a+') can do that? here is the existing code: *import csv import sys

[Tutor] I need an 'atomic read/ write action'

2007-11-04 Thread Tom
Hi, I am trying to write a cron/ task scheduler like system for my website. The users of my site and also more than one external rss feed reader request my scripts regularly and I'd like to insert code in each script that will decide whether to run a scheduled task or not. It would go something l

Re: [Tutor] repeated times

2007-11-04 Thread Thorsten Kampe
* linda.s (Sun, 4 Nov 2007 01:39:46 -0800) > On Nov 2, 2007 1:03 AM, ALAN GAULD <[EMAIL PROTECTED]> wrote: > > > > >I want to run an .exe file and get the output many times. > > >> Given that I know that you know about loops I have to > > >> ask what you see as the problem? > > > > > >I want to run

Re: [Tutor] Some question about OO practice

2007-11-04 Thread Kent Johnson
John wrote: > Thanks, > > One last question (okay, one MORE question ;) ) when you call a > method/function with optionaly *args **kwargs, I'm finding I need to > make the statement like; > > def myFunc(self, *args,**kwargs): > do something > > > In ord to pass the kwargs: > myFunc(**kw

Re: [Tutor] Some question about OO practice

2007-11-04 Thread John
Thanks, One last question (okay, one MORE question ;) ) when you call a method/function with optionaly *args **kwargs, I'm finding I need to make the statement like; def myFunc(self, *args,**kwargs): do something In ord to pass the kwargs: myFunc(**kwargs) # where kwargs is a dictionary or f

Re: [Tutor] Some question about OO practice

2007-11-04 Thread Kent Johnson
John wrote: > I've now written my first set of Classes to do some fairly specific > processing for work I do. I have a few questions. > > First, in looking through what I've done, I basically just incorporated > all my previous scripts into classes... they are still highly specific > to my app

Re: [Tutor] 'source' in python or preloading variables

2007-11-04 Thread Kent Johnson
John wrote: > Does anyone know why the script below works fine (in regards to the > 'source function') but when I try to uncomment the line from mymod > import source and use it that way without defining the function in the > script, I get an error that N_id does not exist. It must have somethin

Re: [Tutor] Some question about OO practice

2007-11-04 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > I've now written my first set of Classes to do some fairly specific > processing for work I do. I have a few questions. > > First, in looking through what I've done, I basically just > incorporated all > my previous scripts into classes... they are still highly

Re: [Tutor] 'source' in python or preloading variables

2007-11-04 Thread John
Does anyone know why the script below works fine (in regards to the 'source function') but when I try to uncomment the line from mymod import source and use it that way without defining the function in the script, I get an error that N_id does not exist. It must have something to do with namespace

[Tutor] Some question about OO practice

2007-11-04 Thread John
I've now written my first set of Classes to do some fairly specific processing for work I do. I have a few questions. First, in looking through what I've done, I basically just incorporated all my previous scripts into classes... they are still highly specific to my application, though I did try t

Re: [Tutor] repeated times

2007-11-04 Thread linda.s
On Nov 2, 2007 1:03 AM, ALAN GAULD <[EMAIL PROTECTED]> wrote: > > > >I want to run an .exe file and get the output many times. > >> Given that I know that you know about loops I have to > >> ask what you see as the problem? > > > >I want to run it many times and export all the output to a text file