@@ -26,6 +26,9 @@ public PythonPlugin(string filename)
26
26
27
27
var path = Path . Combine ( Constant . ProgramDirectory , JsonRPC ) ;
28
28
_startInfo . EnvironmentVariables [ "PYTHONPATH" ] = path ;
29
+ // Prevent Python from writing .py[co] files.
30
+ // Because .pyc contains location infos which will prevent python portable.
31
+ _startInfo . EnvironmentVariables [ "PYTHONDONTWRITEBYTECODE" ] = "1" ;
29
32
30
33
_startInfo . EnvironmentVariables [ "FLOW_VERSION" ] = Constant . Version ;
31
34
_startInfo . EnvironmentVariables [ "FLOW_PROGRAM_DIRECTORY" ] = Constant . ProgramDirectory ;
@@ -76,15 +79,13 @@ import runpy
76
79
// Plugins always expect the JSON data to be in the third argument
77
80
// (we're always setting it as _startInfo.ArgumentList[2] = ...).
78
81
_startInfo . ArgumentList . Add ( "" ) ;
79
- // Because plugins always expect the JSON data to be in the third argument, and specifying -c <code>
80
- // takes up two arguments, we have to move `-B` to the end.
81
- _startInfo . ArgumentList . Add ( "-B" ) ;
82
82
}
83
83
// Run .pyz files as is
84
84
else
85
85
{
86
- // -B flag is needed to tell python not to write .py[co] files.
87
- // Because .pyc contains location infos which will prevent python portable
86
+ // No need for -B flag because we're using PYTHONDONTWRITEBYTECODE env variable now,
87
+ // but the plugins still expect data to be sent as the third argument, so we're keeping
88
+ // the flag here, even though it's not necessary anymore.
88
89
_startInfo . ArgumentList . Add ( "-B" ) ;
89
90
_startInfo . ArgumentList . Add ( context . CurrentPluginMetadata . ExecuteFilePath ) ;
90
91
// Plugins always expect the JSON data to be in the third argument
0 commit comments