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


Active member
Sep 26, 2018
Programming Experience
I have shared path '\\\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)='\\\Import\8'
EXEC sp_execute_external_script
@language =N'Python',
import os
d = os.path.isdir(ExportFilePath)
,@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.
Top Bottom