File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 7
7
8
8
for p in sys .path :
9
9
file_path = Path (p , "multipart.py" )
10
- if file_path .is_file ():
11
- spec = importlib .util .spec_from_file_location ("multipart" , file_path )
12
- assert spec is not None , f"{ file_path } found but not loadable!"
13
- module = importlib .util .module_from_spec (spec )
14
- sys .modules ["multipart" ] = module
15
- assert spec .loader is not None , f"{ file_path } must be loadable!"
16
- spec .loader .exec_module (module )
17
- break
10
+ try :
11
+ if file_path .is_file ():
12
+ spec = importlib .util .spec_from_file_location ("multipart" , file_path )
13
+ assert spec is not None , f"{ file_path } found but not loadable!"
14
+ module = importlib .util .module_from_spec (spec )
15
+ sys .modules ["multipart" ] = module
16
+ assert spec .loader is not None , f"{ file_path } must be loadable!"
17
+ spec .loader .exec_module (module )
18
+ break
19
+ except PermissionError :
20
+ pass
18
21
else :
19
22
warnings .warn ("Please use `import python_multipart` instead." , PendingDeprecationWarning , stacklevel = 2 )
20
23
from python_multipart import *
You can’t perform that action at this time.
0 commit comments