From a Python script, I would like to start PUTTY for a serial line (COM1, COM2,.. etc) and also mention the speed through python script.
I have explored, but most of the information is helpful for Python to Putty (SSH) connection.
Will it be possible to establish Python to Putty(Serial) connection and take logs?
If your goal is to communicate over serial link, consider using
PySerial, I used it many times for communicating with devices connected via serial link and it works very well on MS Windows as well as on Linux.
Putty is just a type of console, which allows to communicate with serial link, but for your Python it is not required.
Related
I have been trying to figure out if there's a way I could create a program that could connect to another program on the same network with same protocols, like to connect to the program thats waiting to be connect to(Wifi Direct) using Python on WINDOWS operating system.
I am fairly new to sockets in python and I want to know how i can remotely run commands to another computer. At the moment, I've looked a bit into sockets and I know how to send text messages across networks. And yes, I've port-forwarded my PC.
If this explanation is confusing, let me give examples:
When you
import os
in the python shell and use
os.system(<command>)
, it will run the specified command in your shell. I want to achieve that, but on a remote computer. I am able to establish a connection and I'm successfully able to transfer bytes over a WLAN.
Issue: I don't know how to send python commands via. sockets and I would like to learn how to do it. I know I could implement the code onto the client's connection side of things, but I don't want it hardcoded. I want something like a 'live terminal' of the client's computer allowing me to type commands in and watch them being performed remotely on the client's computer. I'd appreciate some help!
P.S. I'm using Python 3.7.4
You have to do roughly the same thing you were doing with sending text messages. You must have had a client running your python script and your own computer(the server) running a script as well. The only difference between you sending a text message to the client and you sending a command would be in the python script the client is running.
In that python script, instead of printing the command to the console, you can just execute that command using os.system()
Basically I want to be able to send instructions for a bot over WiFi using the nodeMCU module, but I cant find any detailed functions list that can help me.
I've already tried setting up a server on the NodeMCU, and then a html webpage can then be created on my laptop with buttons for instructions from this and it works, but when I try to to the same on python, (send GET requests through python) I get this error on trying to do more than one request:
ConnectionError: ('Connection aborted.', ConnectionAbortedError(10053, 'An established connection was aborted by the software in your host machine', None, 10053, None))
Also I think the converse would be better suited for my case, a server on the laptop and client as the module, but I don't know where to start.
I coded the on the module using arduino IDE and on my laptop I'm using spyder. For sending requests and stuff I'm using the requests package.
You can create HTTP endpoints in nodeMCU and call them from your python script.
For this to work, both the nodeMCU and the machine running the python script has to be in the same network. and the IP address of the nodeMCU should be correctly added in the python script.
If you wanted to use your laptop as the server, I would suggest going with an MQTT broker such as mosquito, and communicate between the nodeMCU and the python script using the MQTT protocol.
I have a python program that currently reads JSON over bluetooth or usb serial ports and then does some stuff with it.
I want to write another python program that writes to a serial port like a bluetooth or usb device would so I can do some easy testing.
The most success I've found is from this answer Virtual Serial Device in Python?
but I can't find a way to make this work between separate programs
Can anyone provide example code for two separate Python programs that communicate over virtual serial ports?
I have been interested in finding an alternative to the UI in SAS for quite some time now. We license SAS on our server instead of our desktops, so furthermore we have to launch a remote desktop application to execute code.
I was able to use a Telnet connection instead to remotely connect to the server, and batch execute SAS programs. Then I was interested in whether a python script could be made to connect remotely, and batch execute code, and this script could be executed in jEdit as a BeanShell script.
So far, I have Python code which successfully opens and closes the Telnet connection. It can do basic shell functions like call "dir". However, when I pass the exact same line that I use to execute SAS from command prompt on the remote server with a telnet connection in Python, nothing happens.
Is it possible the server is preventing me from executing code from a script? I use a "read_until" statement for the prompt before running any code.
Here's a few ideas...
The issue you are having above may be related to Local Security Policy settings in Windows (if it is running on a windows server). I'm far from an expert on that stuff but I remember older SAS/Intranet installations required some rumaging around in there to get them working.
As an alternative to the approach you are trying above you could also setup a SAS session on the server that listens for incoming socket requests as per this article:
http://analytics.ncsu.edu/sesug/2000/p-1003.pdf
And finally... Not sure if this helps or not by I remotely execute SAS jobs using PSEXEC. A description of how I set it all up can be found here:
http://www.runsubmit.com/questions/260/hide-sas-batch-jobs-winxp
Good luck
This paper outlines how you can use a Python script to connect to a Unix server using SSH, copy the SAS program written locally onto the server, batch submit it, and download the results back to your local machine, all using a BeanShell macro script for jEdit.