when check directory at shared path remotely it display not exist (false) althou

  • when check directory at shared path remotely it display not exist (false) although it exists

    I have shared path '\\192.168.7.9\Import\8' I face

    issue when try to check this directory path exist or not .

    when run script python on sql server 2019 it must

    return true because directory path exist but my

    issue is python script return false although directory exist .

    script python

    declare @ExportPath varchar(max)='\\192.168.7.9\Import\8'
    EXEC sp_execute_external_script
    @language =N'Python',
    @script=N'
    import os
    d = os.path.isdir(ExportFilePath)
    print(d)'
    ,@params = N'@ExportFilePath NVARCHAR(MAX)'
    ,@ExportFilePath = @ExportPath

    Expected result is True

  • Aren't you missing a backslash at the end of the declaration for the @ExportPath?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • i found issue

    os.path.isdir()  working local only

    so use another thing working remote to check directory

    so How to handle that

     

  • had you google it you would have found it - its amazing the type of information you get if you search for it instead of waiting for someone to give it to you.

    it also shows a lack of consideration for the others to always expect them to do your work.

    https://stackoverflow.com/questions/21701652/check-the-existence-of-file-on-local-network-in-python

  • ahmed_elbarbary.2010 wrote:

    i found issue

    os.path.isdir()  working local only

    so use another thing working remote to check directory

    so How to handle that

    I don't use Python and  I don't have 2019, so I can't help but this will "bump" your question for you because I'm also interested in how this would be done in Python.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply