Chandra,

Have you considered remote procedure calls? Seems like you could achieve
what you want with minimal effort:

    https://docs.python.org/2/library/xmlrpclib.html

Regards,

Nathan


On 12 June 2015 at 16:45, AMARASINGHAM, Chandra <
[email protected]> wrote:

>   Hi all,
>
> Hi All,
>
>
>
> I was wondering if anyone had any ideas on how I can send a string of
> python code to a remote python interpreter using fabric?
>
>
>
> I have successfully done this using something like the following, but I
> don't quite like using the -c flag and would like to send the script as
> stdin if possible.  The use case is a local Linux server and a remote AIX
> server both running python 2.7.
>
>
>
> I am aware ipython has some features which may help with this, but I don't
> have ipython available on the AIX at present.
>
>
>
>
>
>
>
>
>
> import fabric
> from fabric.api import run
>
> sql = "select Request.date_entry from Request"
>
>
>
> def run_sql():
>
>     run(". /etc/kshrc; python -c 'import unifydb; from api import
> run_raw_sql; sql=\"" + sql + "\"; cursor = run_raw_sql(sql);
> output=cursor.fetchall(); print str(output)'")
>
>
>  *Chandra Amarasingham*
> Analyst Programmer
> Specialist Diagnostic Services Pty Ltd
> 17 Enterprise Grove, Mt Helen, 3350
> Federation University Technology Park
>
> T: (03) 5330 1056 ext 212
>
> This email (including any attachments) is intended only for the
> addressee.  It may contain confidential or legally privileged information.
> Confidentiality and privilege are not waived or lost if you are not the
> intended recipient of this email, nor may you use, review, disclose,
> disseminate or copy any information contained in or attached to it. If you
> receive this email in error, please delete it and any attachments from your
> system and notify us immediately. It is your responsibility to check this
> email and any attachments, before opening or using them, for viruses or
> defects. You assume all liability arising from opening or using this email
> and any attachment.
>
> _______________________________________________
> melbourne-pug mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/melbourne-pug
>
>
_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to