run local python script from remote linux machine over ssh - python

I'm trying to run a python script on a remote linux machine accessed by ssh(putty). I want to change/access directory to the windows directory and run a program which converts files on the server to csv and saves them to the server.
Is it possible to run the program without moving the files from remote to local, run conversion, move local to remote?
I am not the root user and can't install anything on the linux machine.
My Windows is 64bit and the linux machine is 64bit Ubuntu. Any suggestions?

I found a way to do what I wanted. Doing what I initially wanted requires me to transfer the files from the local machine to the remote machine then running the script and transferring it back. Ultimately it's a function of how fast my internet connection is. Since my local connection isn't that strong, I realized that my initial thoughts were flawed. Eventually, I just uploaded my data to the remote machine and run the script there. It was the fastest solution

Related

Read files at local in Asure VM python code

My python program is running in Assure Virtual machine. I needs to read csv file from local machine. Develop Python code to read CSV file from local machine into Asure virtual machine. python code will runs in VM.
How can a python code running in Asure VM, can read data from local disk/local machine
develop python code to import/read data from local machine to Asure VM. While executing the code in Asure VM, data needs to import from local machine.

Opening script saved on a cluster with local spyder installation

I have anaconda, hence spyder, installed on a local machine. What I am trying to do is to use my local spyder installation to open a .py script saved on a remote cluster (in my office) via ssh. The issues that I am encountering are the following:
I cannot run spyder from the cluster - there is no graphical device whatsoever. For example, we have actually anaconda installed on the cluster, but when I ran spyder from the command line, I get the following error message: Could not connect to any X display
I cannot mount the (remote) drivers, where the .py scripts are located, onto my local machine when I am working from home (which is the case when I am at work, connected to the internet via cable). If this was the case, I could simply launch spyder on my local machine, then open the scripts. I can only access the files on some drivers mounted onto the cluster via ssh.
As, however, I can access the .py scripts saved on the cluster via ssh (I can open then with programs installed locally e.g. vim, jpico etc), I was wondering whether it is possible to use the command line to open a script saved on a remote cluster using my local spyder installation, something like $ spyder /path/to/myScript/savedOnTheRemoteCluster.py
(Spyder maintainer here) As of May 2019 our editor is not capable of working with files on remote locations. So your best option right now is to mount your remote server with sshfs to make it appear as a local directory and then open any file present there in Spyder.

Copy files from a remote windows virtual machine

I want to do a python script that is able to copy log files from a remote windows 10 virtual machine to the script's machine (Windows) as well as deleting files. A developer in my work place uses WMI with C# to do these kind of stuff but I haven't been able to find anything for Python regarding this topic.
You can use SSH for that.
Paramiko is an awesome library that can run SSH in python: http://www.paramiko.org/

Running remote script on remote interpreter in PyCharm

I have a python script on a remote server. I would like to run it on the remote server itself. However, PyCharm is not installed on the remote server and I need PyCharm to debug the code.
I have PyCharm on my local computer and I would like to run the script (which is on remote server) on the remote server using PyCharm on my local machine. I am aware of Deployment tools and remote server host in PyCharm. I do not know how to make them work together.
Having the script on my local computer is not really an option for me as there are huge data files involved with the code and I have very limited storage on my laptop.
I'm not sure if it's absolutely necessary to use Pycharm only for debugging on your remote server but if not, you can use pdb module for debugging too: https://docs.python.org/2/library/pdb.html

python client/server to send bash command to remote machines -- osx

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.

Categories