On Thu, Jun 10, 2010 at 10:30 AM, Stephen Hansen (L/P) <me+list/ pyt...@ixokai.io> wrote:
> On 6/10/10 7:14 AM, Victor Subervi wrote: > > Hi; > > I have a script that calls values from the form that calls it. This > script > > imports another script: > > > > from New_Passenger import New_Passenger > > > > def create_edit_passengers3(): > > ... > > new_passengers_curr_customers = > New_Passengers_Curr_Customers(customers, > > flights) > > if new_passengers_curr_customers > 0: > > print "<input type='submit' value=' Send ' />" > > > > All this works. What puzzles me, however, is that the value of > > new_passengers_curr_customers has to be called using cgi from the > imported > > script (New_Passenger). It cannot be called from the calling script. I > would > > have thought it would have been the other way around. Please help me > > understand why. > > I can't quite figure out what you're asking. > new_passengers_curr_customers is a variable local to > create_edit_passengers3; correct > you have something that differs only in case > called New_Passengers_Curr_Customers which -- I assume is defined, > somewhere. correct > Then you haev New_Passenger, and I'm not sure I see what it > has to do with anything. > My bad. This is another script that is called by the script I have partially quoted here ("main script"). It is in that script that I am able to access the variable in question (as cited by you below). > > But what does "cannot be called" mean? "Cannot" usually means "an error > happened" -- in which case you shouldn't really even mention it unless > you're gonna back it up with a traceback. > That is correct. It throws an error if I try and access the variable from the main script, because I try and use the value of that variable and for some reason I can't retrieve it. > > The former is a value, you don't call it. You access it. And it being > local, you can surely only access it within that function (unless you > pass it somewhere). The latter is -- a class? A function? fn, a script. I hope that cleared things up. Please advise. TIA, beno
-- http://mail.python.org/mailman/listinfo/python-list