ahmed salah

ahmed salah

  • 1.9k
  • 197
  • 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)='\\\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

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

Answers (2)