I'm trying to run a Python script remotely via ssh local for a Linux machine but I'm getting an error when my script is reading a txt file, the script is running well without errors on my Python IDE.
I'm using ssh root@ip_adress python2 < script.py to run the script.
Part of my script where i'm reading the txt file:
import os
import smtplib
with open("file.txt") as fp:
conteudo = fp.readlines()
conteudo = [linhas.strip() for linhas in conteudo]
Error:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
IOError: [Errno 2] No such file or directory: 'file.txt'
file.txtactually exist on the remote machine?ssh root@makes my stomach hurt. ;)