How to connect to shared folder and access files from it using python

Discussion in 'Python' started by samandhare, Jun 25, 2020.

  1. samandhare

    samandhare

    Joined:
    Jun 25, 2020
    Messages:
    1
    Likes Received:
    0
    I am trying to connect share folder using python not able to connect

    from pathlib import Path
    data_folder = Path("//xx.xx.xx.xx//d$//ftpAutoLogin//jflow-data-files-poc")
    file_to_open = data_folder / "mscreen_gxml20200522-143205-512.xml"
    f = open(file_to_open)
    print(f.read())

    I am getting below error
    Traceback (most recent call last):
    File "/Users/sam1546/Documents/jflow_ebm_data_extraction/ebm_extractor_sharepath.py", line 19, in <module>
    f = open(file_to_open)
    FileNotFoundError: [Errno 2] No such file or directory: '//xx.xx.xx.xx/d$/ftpAutoLogin/jflow-data-files-poc/mscreen_gxml20200522-143205-512.xml'

    Process finished with exit code 1
     
    samandhare, Jun 25, 2020
    #1
    1. Advertisements

  2. samandhare

    sunfighter

    Joined:
    Nov 27, 2019
    Messages:
    108
    Likes Received:
    14
    This tells you the error:
    "FileNotFoundError: [Errno 2] No such file or directory: '//xx.xx.xx.xx/d$/ftpAutoLogin/jflow-data-files-poc/mscreen_gxml20200522-143205-512.xml'"

    Check your path to file. ALSO I see "ftp " in the address, FTP does not open anything, it is designed to transfer files. You might want to check the python ftp library for handling this.
     
    sunfighter, Jun 25, 2020
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.