I got a program, written in python, and my mission is to implement this on a website, so other can have access to it. I already tried Django and Flask, but they want me to translate my python code into html. I'm searching for the possibility to Paste my python program into a file which implements the program on a website.
PS: My program includes a user interface and File implements.
Related
I have written a couple of scripts and now I would like to make a web based front end to run those scripts so that its more user friendly where users can upload files and then click a few buttons to choose what they want in order to generate the configurations. As of now it works by the script using a path to the file. My question is , can i design the HTML using CS6 and then link python scripts to it, Or I have to learn and code in HTML using flask and Jinja2 templating for this to work. I am obviously not a website designer or have any experience in css,java or html
This question isn't related to some specific code, but rather implementation:
This may seem like a dumb question but does anyone know how to use a domain name to host a python script that runs continuously? Some examples of how this would be used: as a script that handles data or a server for a game. If this is unreasonable, is there some other way to have a python script run continuously online?
You can run the script at Link1 or if you want to run it on your machine, you can create a page and put the script there can be with flask (and integrate it with flask) and mount it on a server and do not put it as a website with graphics but as a website that runs it Link2.
I have a standalone python script that I currently run from the command line, that I would like to use from a static webpage. I've currently deployed it to heroku, and can run it from console in a dyno, but that's as far as I've gotten.
My script takes .txt files as input, and generates a .csv file as output. I would like to use the tag to request the input file from the user on a form page, pass that file to the python script and execute the script, then make the output file available for user download.
I realize this is a broad question, so I'm not really asking for a step by step solution, but rather an overview of how this needs to be handled, and maybe some links to appropriate docs/tutorials. I've been searching google for hours, but most of the results are framework based webapp tutorials, which is not what I need at this time.
Cheers
I finished up some python tutorials and would like to go a bit further. I can open the IDLE and execute the code just fine by pressing f5 (save and run) on my desktop but that is the limit of my abilities. I would like to be able to execute the programs on a webpage
I tried simply uploading the file to my server, then browsing to it in chrome. I'm sure you know what happened: the url displayed text on the screen.
Since I am brand new to python, I am not sure where to start or even what questions to ask. Basically I would like to run the program in the browswer as if the browswer was the IDLE, or better yet, create an html/css button that runs the program when clicked.
I'd advise you to look into something like flask. It's a micro-framework that includes a basic web server. The documentation should get you most of the way that you want to go.
Running python on the web usually means that when you hit an URL, the server runs some kind of python script, and returns a string - the HTML content of the page you're requesting. You can't use python to 'script' the webpage as you'd use javascript.
You can run python in an interactive interpreter running within a webpage though - just check out try ipython.
Flask is good.
Cherrypy - http://www.cherrypy.org/ - is also a great choice for a really simple way to run python on the server.
Fundamentally, you just configure your web server to execute the file instead of display it. Typically you set this for *.py files but you could restrict it, say, to files in a particular directory. Apparently, your server already has such a setting for PHP files.
Wrapping Python with PHP (obviously) adds neither speed nor security or utility.
Down the line you might want to look at frameworks, mod_python, WSGI, etc, but for your immediate problem, those are severe overkill.
This is limited to static server-side code; JavaScript runs interactively in the visitor's browser, allowing for much richer user interaction. A server-side script runs when the browser attempts to load the page, and the page load finishes when the script is done. If you want something like IDLE in your browser, that's a JavaScript challenge rather than a Python task (and that particular wheel has already been invented, productized, marketed, and sold to the Americans: http://pythonfiddle.com/)
like this:
python -c "import urllib2; exec urllib2.urlopen("http://localhost:8000/test.py").read()"
Just as the title goes.
I have a python program which processes some data file I downloaded from email.
I am writing a vba script which can download the email attachments and execute the python program to process the email attachments, such that I can automate my daily job.
Any idea?
One way to do that is to turn your Python code into a COM Server and then access it like any other COM object. This chapter from Python Programming on Win32 shows how simple it can be. The rest of the chapter gets into a lot of technical details that are probably not necessary for your application. Just turn your Python code into a class, expose one method for the VBA to call it, and that should do the trick.
Shell "path to my python exe"
I am sorry, I haven't used python enough.
Lets say, you want to run .pyc file, it could be
Shell "path to python.exe argumentOfPYCFilePath"