Skip to content

Commit 6408285

Browse files
Fix uploader for python3 compat and core 2.6.x
The core moved to python3 because python (2) is EOL on January 1, 2020. Move the search paths and platform variables to use python3 instead. Remove the no longer needed --end parameter to upload.py
1 parent 33969c9 commit 6408285

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/ESP8266FS.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private void createAndUpload(){
208208
File espota = new File(platform.getFolder()+"/tools");
209209
File esptool = new File(platform.getFolder()+"/tools");
210210
String serialPort = PreferencesData.get("serial.port");
211-
String pythonCmd = PreferencesData.get("runtime.os").contentEquals("windows") ? "python.exe" : "python";
211+
String pythonCmd = PreferencesData.get("runtime.os").contentEquals("windows") ? "python3.exe" : "python3";
212212
String uploadCmd = "";
213213

214214
//make sure the serial port or IP is defined
@@ -224,15 +224,15 @@ private void createAndUpload(){
224224
uploadCmd = uploadPyFile.getAbsolutePath();
225225
}
226226
// Find python.exe if present, don't fail if not found for backwards compat
227-
String[] paths = { platform.getFolder()+"/tools", platform.getFolder()+"/tools/python", PreferencesData.get("runtime.tools.python.path") };
227+
String[] paths = { platform.getFolder()+"/tools", platform.getFolder()+"/tools/python3", PreferencesData.get("runtime.tools.python3.path") };
228228
for (String s: paths) {
229229
File toolPyFile = new File(s, pythonCmd);
230230
if (toolPyFile.exists() && toolPyFile.isFile() && toolPyFile.canExecute()) {
231231
pythonCmd = toolPyFile.getAbsolutePath();
232232
break;
233233
}
234234
}
235-
// pythonCmd now points to either an installed exe with full path or just plain "python(.exe)"
235+
// pythonCmd now points to either an installed exe with full path or just plain "python3(.exe)"
236236

237237
//find espota if IP else find esptool
238238
if(serialPort.split("\\.").length == 4){
@@ -331,7 +331,7 @@ private void createAndUpload(){
331331
}
332332
System.out.println();
333333
if (!uploadCmd.isEmpty()) {
334-
sysExec(new String[]{pythonCmd, uploadCmd, "--chip", "esp8266", "--port", serialPort, "--baud", uploadSpeed, "write_flash", uploadAddress, imagePath, "--end"});
334+
sysExec(new String[]{pythonCmd, uploadCmd, "--chip", "esp8266", "--port", serialPort, "--baud", uploadSpeed, "write_flash", uploadAddress, imagePath});
335335
} else {
336336
sysExec(new String[]{esptool.getAbsolutePath(), "-cd", resetMethod, "-cb", uploadSpeed, "-cp", serialPort, "-ca", uploadAddress, "-cf", imagePath});
337337
}

0 commit comments

Comments
 (0)