directory path already exist with full permissions although it return false ?

ahmedsalah

Active member
Joined
Sep 26, 2018
Messages
32
Programming Experience
3-5
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

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
correct result is true.png
 
How is this a C# issue?
 
Recall that in Python the backslash is an escape character (just like in C, C++, and C#). So the string that you have on your first line of your script does not mean what you think it means. Inconceivable! Therefore, os.path.isdir() is telling you the truth, that path with effectively only one leading backslash and whatever '\I' and '\8' map to in ASCII does not exist.
 
Explaining Python in a C# forum seems inappropriate.
 
Back
Top Bottom