When I wanted to execute a *SAVED* python script after logged into a remote machine through Tramp, I got the following message:
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
/home/SECRET_PATH/<ipython-input-4-f052da0ab8eb> in <module>()
----> 1 execfile(r'/ssh:remote:/PATH_OF_FILE') # PYTHON-MODE
IOError: [Errno 2] No such file or directory: '/ssh:remote:PATH_OF_FILE'
Clearly it would have worked if the /ssh:remote prefix was eliminated.
I realized the work-around would be to modify the file a little bit (e.g. adding a space) so that the file is an unsaved temporary file.
The file will then be written to a temporary file on the remote host, and the execution works.
Similarly, executing a region works too.