Hallo, kennt sich hier jemand mit PlatformIO aus? Ich nutzt es mit VSCode um Firmware für einen ESP8266 zu schreiben. Soweit so gut. Aber wie kann ich unter Windows eine EXE Datei starten nachdem die Kompilierung (oder Upload) fertig ist (automatisch)? Ich habe jetzt eine ganze Weile ge-googelt, finde aber nur Infos zu irgendwelchen Python-scripts, ellenlange Dokus zu irgendwelchen Config-files (https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html). Das ist irgendwie alles zu hoch für mich. Geht das nicht einfacher?
platformio.ini -> extra_scripts=pre:runme_pre.py runme_pre.py os.system("S:\Some\PathHalloWelt.exe")
:
Bearbeitet durch User
Danke Jörg, leider funktioniert es nicht (Windows 10): platformio.ini:
1 | [env:d1_mini] |
2 | platform = espressif8266 |
3 | board = d1_mini |
4 | framework = arduino |
5 | lib_ldf_mode = chain+ |
6 | extra_scripts=pre:runme_pre.py |
runme_pre.py:
1 | os.system("c:\windows\notepad.exe") |
Output:
1 | > Executing task: C:\Users\Thomas\.platformio\penv\Scripts\platformio.exe run < |
2 | |
3 | Processing d1_mini (platform: espressif8266; board: d1_mini; framework: arduino) |
4 | ---------------------------------------------------------------------------------------------------------------------------------------- |
5 | Verbose mode can be enabled via `-v, --verbose` option |
6 | NameError: name 'os' is not defined: |
7 | File "C:\Users\Thomas\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 171: |
8 | env.SConscript(item, exports="env") |
9 | File "C:\Users\Thomas\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 541: |
10 | return _SConscript(self.fs, *files, **subst_kw) |
11 | File "C:\Users\Thomas\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 250: |
12 | exec _file_ in call_stack[-1].globals |
13 | File "C:\Users\Thomas\Google Drev\Arduino\PIOminiTest\piomini\pio-d1_mini\runme_pre.py", line 1: |
14 | os.system("c:\windows\notepad.exe") |
15 | ====================================================== [ERROR] Took 1.32 seconds ====================================================== |
16 | The terminal process terminated with exit code: 1 |
17 | |
18 | Terminal will be reused by tasks, press any key to close it. |
Thomas schrieb: > NameError: name 'os' is not defined: Da fehlt ein 'import os', also: runme_pre.py:
1 | import os |
2 | |
3 | os.system("c:\windows\notepad.exe") |
Auch dir Danke. Es geht immer noch nicht.
1 | 'c:\windows' is not recognized as an internal or external command, |
2 | operable program or batch file. |
Aber so funktioniert es:
1 | import os |
2 | |
3 | os.system("c:\\windows\\notepad.exe") |
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.