File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . IO ;
3
+ using System . Linq ;
4
+
2
5
using NUnit . Framework ;
3
6
using Python . Runtime ;
4
7
@@ -201,7 +204,12 @@ public void SetPythonPath()
201
204
}
202
205
catch ( PythonException ex )
203
206
{
204
- throw new Exception ( $ "Py.Import(\" { moduleName } \" ) failed before setting PythonEngine.PythonPath. sys.path={ path } ", ex ) ;
207
+ string [ ] messages = paths . Where ( p => p . Contains ( "site-packages" ) ) . Select ( folder =>
208
+ ( folder != null && Directory . Exists ( folder ) ) ?
209
+ $ " { folder } contains { string . Join ( Path . PathSeparator . ToString ( ) , Directory . EnumerateFileSystemEntries ( folder ) . Select ( fullName => Path . GetFileName ( fullName ) ) . ToArray ( ) ) } " :
210
+ "" ) . ToArray ( ) ;
211
+ string message = string . Join ( " " , messages ) ;
212
+ throw new Exception ( $ "Py.Import(\" { moduleName } \" ) failed before setting PythonEngine.PythonPath. sys.path={ path } { message } ", ex ) ;
205
213
}
206
214
}
207
215
You can’t perform that action at this time.
0 commit comments