convert a bash script with dialog to python [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I currently have a bash script that installs a web server with many options and features.
Currently I download the script on the remote linux server and execute it via ssh.
This script uses Dialog so that the end user can enter information such as user name, password to create. Path to use, domain name etc....
I would like to rewrite this script which has become huge in python, keeping an interactivity of the same type (dialog). Is there a solution / module with python? Knowing that the remote server on which the script run is a server without a graphical system like Qt, Gtk just console. I think it is necessary to use curses
bash dialog definition :
Dialog is a utility to create nice user interfaces to shell scripts,
or other scripting languages, such as perl. It is non-graphical (it
uses curses) so it can be run in the console or an xterm.
exemple:
I'm looking for an equivalent on python
Thanks

There are several different ways to create dialog box type UIs for python. PyQt is one of the more powerful ones. Tkinter is also handy for simple tasks. Or at least I like to use it for simple stuff. Either one should get what you need. There's probably more I missed as well.
EDIT
If it's a CLI you want, there are plenty of tool. Here's a neat looking one.

Related

Python script to monitor program and control microcontroller [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
NOTE: System will not be connected to a network
I'm automating a device and need to create a script that will communicate with the micro-controller (to drive the motors) and with the original software (Thermo Fisher Scientific). The original software has a GUI interface but no API.
My original thought was to write a python script to first set the motors to the correct position -> then run the software -> save the data -> repeat.
I know how to communicate with the micro-controller to set the motors, but I'm unsure of how to communicate with the original software. Any advice on how to do this with python would be much appreciated.
Alternative methods are also welcome.
Thanks.
I have used AutoIt to solve similar problems. There is a Python extension available (I have never used this).
AutoIt v3 is designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks.
When using the python extension you will be able to directly interact with the GUI app from your source code.
Alternatively you can also just build an Autoit executable to drive the software if the input into the GUI software is always the same.

Run Python online but share only the output [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've seen this topic, but it doesn't really answer my question.
The question: Is there any way I can run my Python script (on 2.7) on a server/website (can be free or paid..or course free would be better), but without sharing the source code?
I would like to provide only the output of the script by sharing a link.
I already know some websites, such as www.pythonanywhere.com .
But on this website, I need to share the source code. I would need to protect the source, as it contains sensitive data.
If your Pyhton code contains sensitive data, you should not upload it to a server that you don't own.
So my best advice would be:
Get a server. That could be your desktop via some form of dyndns or an inexpensive virtual host.
Run your script in a Python framework. Common frameworks are Django, Pyramid, Flask. Or execute Python using mod_wsgi directly in apache.

Create standalone text application from Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am developing a program to use as a pedagogical tool in my classroom. I'm writing currently writing it in Python, but I'm also open to solutions that would use C. I want to create a standalone application for Mac (.app file) for my program, but I only need text-based interaction with the users (i.e. just STDIN/STDOUT, and not a GUI). The majority of my students do not have python installed and have no experience with Terminal/shell scripting.
I tried using Platypus to create this application, but I get an error, as shown below.
I later realized that Platypus does not support prompts for user-input. Is there anything like Platypus that would also allow me to prompt users for input?
As I say, I'm also open to solutions to my problem which would involve transposing my Python code into C and going from there.
I don't know if you have thinking about make a web app, in Google App Engine for example is very simple to deploy a Python based web app really fast, using webapp2 for example. And all your students could use your app online, this is a good getting started. But if you want maybe you could to build a command line app deployed in some server and your students could connect with ssh to use it.
It depends what kind of systems your students have and it is highly unlikely that they will have similar kind of system. For least dependency i think you can use java to write your application. For java they just need to install jdk and can run your shared jar.

Python: Creating desktop application with HTML GUI [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
This question is more about methodology.
I want to create a Python desktop application, but I don't want its GUI to be like tkinter or like PyQt. I prefer to have a beautiful and modern client GUI like Bootstrap.
Is there any existing API for creating such applications in Python?
If not: does it sound a sane workround to use some Python server (like Django or like web2py), and to start a new server each time the application is launched by a user, just for enabling the application core to be in Python and the client to be in HTML?
Does anyone work this way?
Use PyQt or PySide 2, Qt WebEngine and Qt's builtin support for hosting HTML applications:
http://doc.qt.io/qt-5/qtwebchannel-index.html
The general architecture is a SPA (Single Page Application) running from local HTML and Javascript content bundled with your app – no need for bundling in a web server.
For anything complicated (like bypassing cross origin issues), use the Qt WebChannel to message to functionality built on the Python side.
This is basically the same architecture that Cordova uses.
Now, whether you should build an application this way (cough QML cough) is a completely different topic.
There is value in having a local server that does your GUI work, whether this applies in your case depends very much on the requirements of the app.
Most apps I write tend to have a habit of ending up to be multi-user and hosted, so for me it makes absolute sense starting of like this.
If you are going down this route also have a look at http://brython.info/, having the same like languages across everything makes brain context switching less of an 'overhead' (pardon the pun).

Run python program on windows 2008 server with web gui [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have made this python (2.7) program that takes a few hours to complete, looping through stuff all the time. I also have a windows 2008 server which I want to use to run this program, I can run it just fine on its own and leave it alone for a while, but I want to use a web interface to achieve the same effect.
I currently use cherrypy and made a form that submits to another page and executes the code there, which works somewhat, but when I close the browser the execution stops. What I really want to do is create a form that provides a function with some arguments and start a standalone python script from there, and possibly also include a stop button to stop the execution. Is this in any way possible?
Yes, this is possible. However, you need to decouple execution of your programme from your web interface.
Probably the simplest setup is to use supervisor to run both your program and your web interface. How your program and your web interface interact is up to you. You could even have your web interface control supervisor, or see if there is a third party web interface for supervisor.
I'm sure it's completely possible, there are numerous modules for Python that act task queue/job queue managers. The first that comes to my mind is Celery.

Categories