Pushy lacks a simple remote "exec" method
Bug #733069 reported by
Andrew Wilkins
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pushy |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
Currently to execute a non-trivial piece of code you must compile a code object and evaluate it, e.g.:-
conn = pushy.connect(...)
code_obj = conn.eval(
conn.
This should be made simpler, by introducing a function that wraps these steps.
Related branches
Changed in pushy: | |
importance: | Undecided → Low |
importance: | Low → Wishlist |
status: | New → Opinion |
Changed in pushy: | |
status: | Opinion → Confirmed |
Changed in pushy: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I will add two new methods to pushy.client. Client: execute, and compile.
The execute method will simply be a shortcut for eval(compile( source) ). e.g.:- execute( "print 123") conn.compile( "print 123"))
conn.
= conn.eval(
The compile method will do two things:
- Compile source code to a remote code object, which can be used with the remote eval builtin.
- If given a locally defined function. will get its source (via inspect.getsource), define it in the remote interpreter, and return the function to the caller.
e.g.
>>> print conn.compile("print 123")
>>> <code object <module> at 0x94101d0, file "<pushy>", line 1>
e.g. (Non-interactive; inspect.getsource only works for functions defined in files.)
time.sleep( sec) sleep(0. 5)
def sleep(sec):
import time
remote_sleep = conn.compile(sleep)
remote_