August 5, 2022 at 10:28 pm
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
August 6, 2022 at 6:08 am
Aren't you missing a backslash at the end of the declaration for the @ExportPath?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 6, 2022 at 3:58 pm
i found issue
os.path.isdir() working local only
so use another thing working remote to check directory
so How to handle that
August 6, 2022 at 5:35 pm
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
August 6, 2022 at 5:39 pm
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
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy