Skip to content

Commit 6a1bf43

Browse files
jamesramsden-bhFraser Greenroyd
authored andcommitted
Moved VirtualEnv to Query and deleted from Create
1 parent c85ad90 commit 6a1bf43

File tree

3 files changed

+13
-54
lines changed

3 files changed

+13
-54
lines changed

Python_Engine/Create/VirtualEnvironment.cs

Lines changed: 0 additions & 51 deletions
This file was deleted.

Python_Engine/Python_Engine.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
<Compile Include="Compute\Logging.cs" />
7878
<Compile Include="Convert\ToPython.cs" />
7979
<Compile Include="Modify\AddQuotesIfRequired.cs" />
80-
<Compile Include="Create\VirtualEnvironment.cs" />
8180
<Compile Include="Query\VirtualEnv.cs" />
8281
<Compile Include="Query\VirtualEnvPythonExePath.cs" />
8382
<Compile Include="Query\VirtualEnvDirectory.cs" />
@@ -102,7 +101,9 @@
102101
<Private>False</Private>
103102
</ProjectReference>
104103
</ItemGroup>
105-
<ItemGroup />
104+
<ItemGroup>
105+
<Folder Include="Create\" />
106+
</ItemGroup>
106107
<ItemGroup>
107108
<Content Include="Python\src\python_toolkit\bhom\analytics.py" />
108109
<Content Include="Python\src\python_toolkit\bhom\anonymise_filepath.py" />

Python_Engine/Query/VirtualEnv.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ public static partial class Query
3535
[Output("The virtual environment, if it exists.")]
3636
public static PythonEnvironment VirtualEnv(string envName)
3737
{
38-
return new PythonEnvironment() { Executable = VirtualEnvPythonExePath(envName), Name = envName };
38+
string exePath = Query.VirtualEnvPythonExePath(envName);
39+
if (File.Exists(exePath))
40+
{
41+
return new PythonEnvironment() { Name = envName, Executable = exePath };
42+
}
43+
else
44+
{
45+
BH.Engine.Base.Compute.RecordError($"No environment could be found for {envName}. Use the appropriate InstallPythonEnv to install this environment.");
46+
return null;
47+
}
3948
}
4049
}
4150
}

0 commit comments

Comments
 (0)