Hello,
I'm trying to use pexpect from web2py with limited success. What I
notice is that web2py doesn't treat the object like a normal python
program would.
A simple example (my real program creates ssh sessions this is just to
demonstrate the issue):
with ajax I call two functions:
first it calls
def open_file():
do_file('create')
message = 'created'
return dict(message=message)
then it calls
def data_file():
info =request.vars.values()[0]
do_file('hello this program is crap)
message = 'stored info into file'
return dict(message=mesage)
Then we have the controller function which does it
def do_file(param1):
if param1 == 'create':
child=pexpect.spawn('nano -wc myfile.txt')
else:
child.sendline(param1)
child.close()
Now it says that the second time:
UnboundLocalError: local variable 'child' referenced before assignment
When I try to store the child object in a session variable I get the
error that it can't store file objects.
Is there anyway I can make web2py keep its reference to the object so
I can keep using it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---