LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-20-2012, 07:23 AM   #1
guardian1
LQ Newbie
 
Registered: May 2012
Posts: 19

Rep: Reputation: Disabled
ssh python login, can't see file


Hi all,

I am new to SSH and have narrowed down what I thought was a server problem to what seems to be an SSH problem. I the following simple python program which for some reason, cannot see the file "result1.txt".

import ssh
import pickle

s = ssh.Connection(host = 'IPADDRESS', username = 'toolserv', password = 'XXX')

with open("/home/toolserv/result1.txt", "r") as my_file:
signed_data1 = pickle.load(my_file)
my_file.close()

print signed_data1

s.close()

I get the error that it doesn't exist, when it definitely does:

Traceback (most recent call last):
File "sshread.py", line 6, in <module>
with open("/home/toolserv/result1.txt", "r") as my_file:
IOError: [Errno 2] No such file or directory: '/home/toolserv/result1.txt'

I don't know how to proceed here. I'm stuck and would appreciate any help.
 
Old 08-21-2012, 02:31 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-21-2012, 02:38 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Code:
with open("/home/toolserv/result1.txt", "r") as my_file:
signed_data1 = pickle.load(my_file)
my_file.close()
Read the doco some more ...

Your code doesn't get run on the remote box, but on the machine that your script is on.


And please use code-tags, specially w/ python, where indentation is so important, your
post is pretty much incomprehensible.


Cheers,
Tink
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python - How to get text file data into an array on python. golmschenk Programming 4 11-11-2013 09:15 AM
[SOLVED] ssh-keygen for auto ssh login not working R00ts Linux - Software 26 09-23-2012 01:40 PM
[SOLVED] SSH login problem for additional users after password-less login setup uncle-c Linux - Newbie 3 02-10-2010 12:51 PM
Using python to edit a python file. deathalele Programming 2 08-27-2008 12:34 PM
Python: how to import a python file that doesn't end in .py? BrianK Programming 5 04-15-2008 12:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration