I have a python script that talks to an external device through a COM port. I'm trying to make unit tests for this and I would like to write something that can act as a simulated COM port so I can run these tests without the machine that the script usually uses.
It seems like virtual COM ports are what I need but I haven't been able to find any clear python implementations of this. I'm not sure the best way to do this but I've been thinking that a script that I could leave running would read the virtual port and write back to it whenever the tests are running.
Related
Im trying to see what pyserial is writing in Putty, later on I would like to try CubeIDE STM32 to receive this data as well.
Putty gives me a port is being used error. How can I check what Python is writing to COM5?
You can use programs like for example Virtual Serial Port Driver. It can create linked virtual COM ports ,one to write and second to read data.
I'm trying to create a serial port in python. I'm going to use it to communicate with another program that is communicating via a serial port. the PySerial package seems fine but I can't get it working. I've looked eveywhere and every implementation is for linux. Can anyone help me create a COM port on windows and read/write to it?
It is not possible to create a serial port in Python, because you need a special driver for this task. You can only call 3rd party utility (with the drivers) that will do it for you.
I would recommend to try the following utilities:
Com0Com: http://sourceforge.net/projects/com0com/
Virtual Null Modem: http://www.virtual-null-modem.com/
I'm familiar with python within the 3D application I use (OSX platform), but am struggling with its usage in a client/server relationship. I've written a simple distributed rendering script which breaks my 3D render script into smaller OSX bash shell scripts and saves them to a directory on my machine. The remote machines in the room then look at my local folder with these smaller bash shell scripts and execute them one by one until they are all gone. It is a rudimentary solution to distributed rendering, but it works. What I would like to do is have the remote machines listen for a command from my local machine (the local machine would need to send an OSX bash command to the remote machines). I have been looking and this site: http://www.tutorialspoint.com/python/python_networking.htm
This seems to be what I'm looking for, but not knowing much about how python works with the network, I'm not sure whether its secure, and I am not sure how to send a Bash command rather than a message.
If anyone has any suggestions it'd be much appreciated.
I'm attempting my first foray into creating a Python script that will automate software updates remotely to our machines. What it needs to do:
Telnet into machine
Run a command that changes the machine's IP address (gives the machines external access for downloading from an online repo)
Reboot machine for changes to take effect
Run a command that points to a directory, then executes the command
Once completed, change the IP address to its original address and reboot
Using python's telnet library, I can get remotely connected to the server and send commands, but I'm stuck on the part that involves rebooting the machine and reconnecting to it automatically. Is there a way to create a try/catch statement that tries pinging the machine until it gets a reply, or is this not a feasible idea?
I am testing a piece of hardware which hosts an ftp server. I connect to the server in order to configure the hardware in question.
My test environment is written in Python 3.
To start the ftp server, I need to launch a special proprietary terminal application on my pc. I must use this software as far as I know and I have no help files for it. I do however know how to use it to launch the ftp server and that's all I need it for.
When I start this app, I go to the menu and open a dialog where I select the com port/speed the hardware is connected to. I then enter the command to launch the ftp server in a console like window within the application. I am then prompted for the admin code for the hardware, which I enter. When I'm finished configuring the device, I issue a command to restart the hardware's software.
In order for me to fully automate my tests, I need to remove the manual starting of this ftp server for each test.
As far as I know, I have two options:
Windows GUI automation
Save the stream of data sent on the com port when using this application.
I've tried to find an GUI automater but pywinauto isn't supporting Python 3. Any other options here which I should look at?
Any suggestions on how I can monitor the com port in question and save the traffic on it?
Thanks,
Barry
Have you looked at pySerial? It's been a few years since I've used it but it was quite good at handling RS-232 communications and it looks like it's compatible with Python 3.x.
Sikuli might provide the kind of GUI automation you need.
I was also able to solve this using WScript, but pySerial was the preferred solution.