Using subprocess in Django to run Java (HelloWorld) file

2020-08-03 Thread Alex Wan
Was looking at this link https://www.geeksforgeeks.org/python-subprocess-module-to-execute-programs-written-in-different-languages/ and am trying to translate it into Django. Upon form submission from index.html in templates, I want to call the view function to run HelloWorld.java (in same

Re: Access Celery's subprocess in my Django app

2017-01-14 Thread Avraham Serour
t the CELERY_RESULT_BACKEND Avraham On Fri, Jan 13, 2017 at 10:44 AM, Patricia Infante wrote: > Hi everyone! I put Celery in my Django app so that the two other python > programs can process the input from my Django app via doing subprocess > method. > My question is how do I access the output fr

Access Celery's subprocess in my Django app

2017-01-13 Thread Patricia Infante
Hi everyone! I put Celery in my Django app so that the two other python programs can process the input from my Django app via doing subprocess method. My question is how do I access the output from the subprocess? Back then when I made just a python program, I access the log files (output from

Re: Simple subprocess help

2016-03-26 Thread Daniel Hepper
ine.sh'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) Then pass in the input and read the output (stdoutdata, stderrdata) = p.communicate() Then save the data, e.g. in a field of your instance instance.processed_data = stdoutdata I suggest you first make sure to get the call to the subprocess

Re: Simple subprocess help

2016-03-25 Thread Mike Dewhirst
On 26/03/2016 1:05 AM, Joshua Valdez wrote: I'm very new to django Sorry I didn't pay attention to this part of your question ... To amplfy my response, this is the sort of thing I would do in the save method of the model: from wherever import run_pipeline class Query(models.Model): ..

Re: Simple subprocess help

2016-03-25 Thread Mike Dewhirst
On 26/03/2016 1:05 AM, Joshua Valdez wrote: Okay, so I have figured out that the subprocess is the module that I want to use in this context and I have tried implementing some simple code based on the documentation but I am getting an |ExceptionType:OSErrorExceptionValue:[Errno2]Nosuch file or

Simple subprocess help

2016-03-25 Thread Joshua Valdez
Okay, so I have figured out that the subprocess is the module that I want to use in this context and I have tried implementing some simple code based on the documentation but I am getting an Exception Type: OSErrorException Value: [Errno 2] No such file or directoryException Location

Re: django subprocess doesnt like sleep

2015-06-05 Thread dk
some one put in contab -e ** * * * * systemctl resetart httpd* means that every minute the apache server is restarting and killing everything. that's why non of the script where working =( now that I commented that line from cron tab its working =). -- You received this message b

Re: django subprocess doesnt like sleep

2015-06-05 Thread Tom Lockhart
> On Jun 5, 2015, at 8:44 AM, dk wrote: > > I created a website that can reboot a machine. basically subprocess a script > that lunch the reboot command in Linux. > after that I need to run some other operations. after that I wait 1 minute > before start pinging the mac

Re: django subprocess doesnt like sleep

2015-06-05 Thread Vijay Khemlani
31:02.046665 2015] [:error] [pid 33304] sleeped for 60secs[Fri Jun 05 > 16:31:02.046702 2015] [:error] [pid 33304] 6* > > why is shutting down gracefully, what does it mean? that killed to > process? why?can this be happening to my subprocess? > > -- > You received this

Re: django subprocess doesnt like sleep

2015-06-05 Thread dk
Fri Jun 05 16:31:02.046665 2015] [:error] [pid 33304] sleeped for 60secs[Fri Jun 05 16:31:02.046702 2015] [:error] [pid 33304] 6* why is shutting down gracefully, what does it mean? that killed to process? why?can this be happening to my subprocess? -- You received this message becau

django subprocess doesnt like sleep

2015-06-05 Thread dk
I created a website that can reboot a machine. basically subprocess a script that lunch the reboot command in Linux. after that I need to run some other operations. after that I wait 1 minute before start pinging the machine to see if its back online. the funny thing my script doesn't

Re: subprocess behave diferent in the server than in the client.

2015-04-02 Thread dk
found 2 things happening, some one move the file, second of all the subprocess stdout spits a tuple of tuples =( (that was trick thing to find.) thanks guys. On Tuesday, March 31, 2015 at 2:03:08 PM UTC-5, JirkaV wrote: > It's very likely that the actual user running the webserver pr

Re: subprocess behave diferent in the server than in the client.

2015-03-31 Thread jirka . vejrazka
ooglegroups.com Subject: Re: subprocess behave diferent in the server than in the client. playing a littlie bit more, I found out that does work if I am using the manage.py runserver. but doesn't work using the production django =(. On Monday, March 30, 2015 at 5:53:59 PM UTC-5, dk wrote: >

Re: subprocess behave diferent in the server than in the client.

2015-03-31 Thread aRkadeFR
g the production django =(. On Monday, March 30, 2015 at 5:53:59 PM UTC-5, dk wrote: hi, I have a button in my webpage that lunch a subprocess and check the ping of the computer and save the information in a text file. that's it, very basic stuff. If I am doing my click in

Re: subprocess behave diferent in the server than in the client.

2015-03-31 Thread dk
playing a littlie bit more, I found out that does work if I am using the manage.py runserver. but doesn't work using the production django =(. On Monday, March 30, 2015 at 5:53:59 PM UTC-5, dk wrote: > hi, I have a button in my webpage that lunch a subprocess and check the >

subprocess behave diferent in the server than in the client.

2015-03-30 Thread dk
hi, I have a button in my webpage that lunch a subprocess and check the ping of the computer and save the information in a text file. that's it, very basic stuff. If I am doing my click in the server computer everything works, the subprocess will ping the computer, make the file and sav

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
On Tue, Mar 11, 2014 at 8:07 PM, Shawn Milochik wrote: > > I tried to circumvent the entire problem by adding an "if __name__ == > '__main__'" block to the script and having it take a command-line argument > via argparse and print the desired output. Then I did a > subprocess.check_output call on

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
amount of memory required, but I'm pretty sure this script isn't consuming much memory. Even when it's not running ls, it's just doing a subprocess call to gpg to sign and encrypt a file. It takes well under one second. Thanks for looking at it. Shawn -- You received this message

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Russell Keith-Magee
On Wed, Mar 12, 2014 at 2:06 AM, Shawn Milochik wrote: > Hi everybody. I have a weird problem. I have a small script that does a > subprocess call. It works. It works when run via iPython. It blows up when > run in manage.py shell or under Django with OSError: [Errno 12] Cannot > all

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
On Tue, Mar 11, 2014 at 9:24 PM, Nick Santos wrote: > Hey Shawn, > > What does your web stack and environment look like? If it's failing during > a fork with an out of memory, that makes me wonder if the host process for > django is consuming a chunk of memory for some reason, and when it gets >

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
On Tue, Mar 11, 2014 at 9:06 PM, Drew Ferguson wrote: > Hi > > Could your problem be some SELINUX issue? > > Perhaps disable SELINUX temporarily and see if the problem persists. > > How would selinux cause the problem to only happen under certain conditions? I don't think it's running. Based on th

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Drew Ferguson
of memory required, > but I'm pretty sure this script isn't consuming much memory. Even when > it's not running ls, it's just doing a subprocess call to gpg to sign > and encrypt a file. It takes well under one second. > > Thanks for looking at it. > Shawn > -

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Nick Santos
e were no answers > other than directly addressing the amount of memory required, but I'm > pretty sure this script isn't consuming much memory. Even when it's not > running ls, it's just doing a subprocess call to gpg to sign and encrypt a > file. It takes well under one

A subprocess call fails, but only under Django

2014-03-11 Thread Shawn Milochik
Hi everybody. I have a weird problem. I have a small script that does a subprocess call. It works. It works when run via iPython. It blows up when run in manage.py shell or under Django with OSError: [Errno 12] Cannot allocate memory. Does anyone have any idea on how to fix this? It'

Trying to send key value pair to perl script using subprocess

2012-10-16 Thread Pervez Mulla
ate import RequestContext from subprocess import Popen, PIPE, sys import subprocess def ex(request): myName = 'Pervez' if 'firstname' in request.POST: myName = (request.POST['firstname']) p = Popen(['/home/pervez/Desktop/simplepage/simpl

Django & subprocess

2012-09-15 Thread malinoff
Hi all, please, i need your help. I use suprocess module, executing 'stockfish' uci engine, like: engine = subprocess.Popen('stockfish', stdin=subprocess.PIPE, stdout=subprocess.PIPE) My module use opened subprocess receiving some information from Django's form, for

Re: subprocess

2012-03-01 Thread Sébastien Billion
> > p = subprocess.Popen(args=[("%s %s") % (script_name,command_args1)], > > Sorry to pick on something seemingly inconsequential, but this really > riles me. If you launch a subprocess using a string like "command arg1 > arg2 arg3", then you force the OS to do

Re: subprocess

2012-03-01 Thread Tom Evans
On Thu, Mar 1, 2012 at 11:42 AM, Sébastien Billion wrote: > Hi, > > You can try something like that: > > p = subprocess.Popen(args=[("%s %s") % (script_name,command_args1)], Sorry to pick on something seemingly inconsequential, but this really riles me. If you launch a

Re: subprocess

2012-03-01 Thread Sébastien Billion
Hi, You can try something like that: p = subprocess.Popen(args=[("%s %s") % (script_name,command_args1)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) output = p.stdout.readlines() p.wait() 2012/3/1 dummyman dummyman > Hi , > > i am using django s view function to invoke py*t

subprocess

2012-02-29 Thread dummyman dummyman
Hi , i am using django s view function to invoke py*thon script* to run in background. now i want to pass command line args to the script here is wat i did subprocess.Popen([sys.executable,"script_name","command_args1"]) i got the error execv requires arg 2 to be a string please help me --

Re: problems running subprocess inside django view

2012-01-28 Thread Russell Keith-Magee
On Sat, Jan 28, 2012 at 12:05 AM, Mark Lancaster wrote: > I'm having problems running subprocess inside a django view using: > > result = subprocess.Popen([ , ], > stdout=subprocess.PIPE).communicate()[0] > > exactly the same method works perfectly inside a regular python

Re: problems running subprocess inside django view

2012-01-28 Thread Brian Schott
As the same user? Are you running with manage.py runserver? Generally it is a bad idea to call subprocess from a web process context. A blocking call you don't expect might time out the client and/or hang your server. Check out Django-celery. Create a tasks.py and have your view call a

Re: problems running subprocess inside django view

2012-01-28 Thread Eugene Gavrish
On 27 янв, 20:05, Mark Lancaster wrote: > I'm having problems running subprocess inside a django view using: > > result = subprocess.Popen([ , ], > stdout=subprocess.PIPE).communicate()[0] > > exactly the same method works perfectly inside a regular python > script. &g

problems running subprocess inside django view

2012-01-27 Thread Mark Lancaster
I'm having problems running subprocess inside a django view using: result = subprocess.Popen([ , ], stdout=subprocess.PIPE).communicate()[0] exactly the same method works perfectly inside a regular python script. Should I be using a different method to initiate a script? Thanks --

Pythons subprocess with WSGI + Apache mpm-worker: IOError 4

2012-01-02 Thread sbrandt
r switching Apache from mpm-prefork to mpm-worker, using subprocess in my (Django) Python WSGI application raises the following exception after hanging for a couple of time: IOError at / [Errno 4] Interrupted system call The call in question is: out = check_output(['sudo', 'quot

subprocess blocks view

2011-02-01 Thread Matt Labbé
Hello, I have a problem calling subprocess.Popen from a view: The view that calls subprocess.Popen is not displayed until the subprocess finishes. The server send "200 OK" immediately, but not the content of the page. My question is: Is this a limitation of Django's development

Re: Subprocess module in Python CGI

2009-01-08 Thread Anurag
Hello Kenneth, Thank you for your suggestion. This was helpful to remove a sort of redundancy in my program but removal of '\' still does not solve my problem as the Error displayed remains exactly the same. Any other suggestions? Once again thank you so much for your valuable time. Regards.

Re: Subprocess module in Python CGI

2008-12-23 Thread Kenneth Gonsalves
On Monday 22 Dec 2008 4:21:31 pm Anurag wrote: > comd = [\ >         "tar -xf x.tar.gz", \ nothing to do with python: [law...@localhost programs]$ tar -xf x.tar.gz tar: x.tar.gz: Cannot open: No such file or directory tar: Error is not recoverable: exiting now btw, there is no need to put '\' wh

Re: Subprocess module in Python CGI

2008-12-23 Thread Anurag
a few command line in a pipe and I have written the script (a > short > one) as follows. I would later also like to import this application to > Django. > > #!/usr/bin/python > > import cgi, string, os, sys, cgitb, commands, subprocess > import posixpath, macpath >

Subprocess module in Python CGI

2008-12-22 Thread Anurag
the script (a short one) as follows. I would later also like to import this application to Django. #!/usr/bin/python import cgi, string, os, sys, cgitb, commands, subprocess import posixpath, macpath #file = "x.tar.gz" #comd = "tar -xf %s" % (file) #os.system(comd) #command

Mozilla connection interrupted error while using thread running python subprocess popen in shell

2008-10-20 Thread emy_66
Hello, I don't know much about networking. I keep getting a connection interrupted error page when I start a thread which runs the python subprocess popen method: "proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)". After starting this thread my function retu