ahmed salah

ahmed salah

  • 940
  • 494
  • 30.5k

can't check directory exist or not when using python script ?

Aug 5 2022 9:24 PM

I working on script running on sql server 2019 using python 3.10 .

I have directory path and can  write and read to files and delete and create files onthis directory path



my issue when run script python on sql server 2019

it return false

but it must return true because directory path exist.

this path have permissions everyone and administrator and system full control read and write and delete .

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

from sql server it return true as exist but from python script it return false for same server and same user.


Answers (3)