Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File not found error
#1
I am using pysftp module to connect to sftp server.After establishing the connection,I am trying to upload a file from my local to sftp server.For this ,I used
Sftp.put(localPath=“ C:/Users/documents/TestEDI.txt",remotePath=“ /Users/authentucation/")
This gives me error like
 FileNotFoundError: [Errno 2] No such file or directory: c:/Users/documents/TestEDI.txt
But i have the file present under documents folder.So this error comes when i run through pycharm and command prompt.Any suggestions on How to proceed further?
Reply
#2
Sftp.put(localPath="C:/Users/documents/TestEDI.txt",remotePath="/Users/authentucation/")
Reply
#3
(Jul-03-2022, 12:00 PM)Axel_Erfurt Wrote: Sftp.put(localPath="C:/Users/documents/TestEDI.txt",remotePath="/Users/authentucation/")

yes,this is what i have written in code.I still get the error
Reply
#4
Are Windows filesystems case-sensitive? If so, have you got the casing correct? Could there be a permissions problem? I don't use Windows, so I don't know how permissions work on that OS. Can you upload files from anywhere else?
Reply
#5
The Documents folder is under your Windows user name.
C:/Users/<username>/Documents/TestEDI.txt"
Reply
#6
(Jul-03-2022, 09:32 AM)saisankalpj Wrote:
Sftp.put(localPath=“ C:/Users/documents/TestEDI.txt",remotePath=“ /Users/authentucation/")
Your localPath and remotePatch start with a space. I think this is not correct. Did you notice Axel Erfurt left out these spaces?
Reply
#7
(Jul-03-2022, 05:38 PM)ibreeden Wrote:
(Jul-03-2022, 09:32 AM)saisankalpj Wrote:
Sftp.put(localPath=“ C:/Users/documents/TestEDI.txt",remotePath=“ /Users/authentucation/")
Your localPath and remotePatch start with a space. I think this is not correct. Did you notice Axel Erfurt left out these spaces?

Yes,i have removed the spaces and tried,still i get file nt found error.This is my code right now

Sftp.put(localPath=“C:/Users/sankalp/documents/TestEDI.txt",remotePath=“/Users/authentucation/")
Reply
#8
N
(Jul-03-2022, 04:51 PM)snippsat Wrote: The Documents folder is under your Windows user name.
C:/Users/<username>/Documents/TestEDI.txt"

Yes,yes.I forgot to add it while posting in the forum.This is my code which still gives file not found, inspite of the file being present in that location
 Sftp.put(localPath=“C:/Users/sankalp/documents/TestEDI.txt",remotePath=“/Users/authentucation/")
Reply
#9
Copy the path in Explorer and paste it into your code
Reply
#10
You have two Unicode(Left Double Quotation Mark) in code posted,that will never work and you should get SyntaxError before file not found error.
>>> Sftp.put(localPath=“C:/Users/sankalp/documents/TestEDI.txt",remotePath=“/Users/authentucation/")
Error:
File "<interactive input>", line 1 Sftp.put(localPath=“C:/Users/sankalp/documents/TestEDI.txt",remotePath=“/Users/authentucation/") ^ SyntaxError: invalid character '“' (U+201C)
>>> Sftp.put(localPath="C:/Users/sankalp/documents/TestEDI.txt",remotePath=“/Users/authentucation/")
Error:
File "<interactive input>", line 1 Sftp.put(localPath="C:/Users/sankalp/documents/TestEDI.txt",remotePath=“/Users/authentucation/") ^ SyntaxError: invalid character '“' (U+201C)
Sftp.put(localPath="C:/Users/sankalp/documents/TestEDI.txt",remotePath="/Users/authentucation/")
Error:
Traceback (most recent call last): File "<interactive input>", line 1, in <module> NameError: name 'Sftp' is not defined
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Absolute paths in subprocess - file not found kittyticker 4 493 Jan-28-2024, 10:37 PM
Last Post: kittyticker
  file open "file not found error" shanoger 8 1,129 Dec-14-2023, 08:03 AM
Last Post: shanoger
  Module Not Found Error bitoded 4 1,411 Jan-01-2023, 09:08 AM
Last Post: bitoded
  TypeError: sequence item 0: expected str instance, float found Error Query eddywinch82 1 5,122 Sep-04-2021, 09:16 PM
Last Post: eddywinch82
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 2 2,551 Nov-23-2020, 05:15 PM
Last Post: cananb
  Unknown error occurred: Port not found NewBeie 0 1,439 Aug-27-2020, 08:50 PM
Last Post: NewBeie
  File not found error Ads 5 3,281 Mar-15-2020, 01:56 PM
Last Post: saqib1066
  uising python zero with IDLE I get an error of 'module not found' Brian123 1 3,914 Apr-24-2019, 09:21 PM
Last Post: Yoriz
  How to fix error code 2 in python, “directory not found”? dav3javu 1 7,041 Apr-03-2019, 04:55 PM
Last Post: Larz60+
  modify line in file if pattern found in list. kttan 1 2,227 Dec-10-2018, 08:45 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020