yhur / arduplot

MIT License
41 stars 7 forks source link

cant use plotter #13

Closed Depech101 closed 1 year ago

Depech101 commented 1 year ago

I use: PlatformIO Core, version 6.1.7 Did this: Windows usage with Version Core 6.1.5·Home 3.4.3 In Gui go to PLatforIO sidebar -> Select New Terminal in quick access at the bottom In the Terminal window run the following -> pip install arduplot Close the terminal or type exit

Edit the platform.ini file (with VS or your preference) add or ammend (add ,plotter if the entry line already exists) plotter to the monitor filter flag -> monitor_filters = plotter Got this: Executing task: C:\Users\user\AppData\Local\Programs\Python\Python311\Scripts\platformio.exe device monitor

Warning! Skipping unknown filters plotter. Known filters are colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time --- Terminal on COM7 | 115200 8-N-1 --- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at https://bit.ly/pio-monitor-filters --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H added folder monitor to my project folder: image

Depech101 commented 1 year ago

I just lern how to add filters or configure them. Thnk you for your feedback.

yhur commented 1 year ago

@Depech101 I looked at your screenshot again and found the arduplot code is copied under monitor/arduplot.

The actual location you need to copy is monitor like this.

Screenshot 2023-05-23 at 6 48 51 PM
Depech101 commented 1 year ago

Thank You for Your fast reaction! But unfortunaly after moving files to folder is You said i got this: --- serial_plotter is starting Error: Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio__main.py", line 102, in main cli() # pylint: disable=no-value-for-parameter ^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\cli.py", line 70, in invoke return super().invoke(ctx) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke return
callback(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\command.py", line 152, in device_monitor_cmd
start_terminal(options) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\terminal.py", line 54, in start_terminal
term = new_terminal(options) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\terminal.py", line 102, in new_terminal term = Terminal( ^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\terminal.py", line 28, in init super().init(
args, **kwargs) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\tools\miniterm.py", line 403, in init self.update_transformations() File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\tools\miniterm.py", line 456, in update_transformations self.tx_transformations = [t() for t in transformations] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\tools\miniterm.py", line 456, in self.tx_transformations = [t() for t in transformations] ^^^ File "C:\Users\user\Documents\PlatformIO\Projects\Termorelay\monitor\filter_plotter.py", line 52, in call self.plot = subprocess.Popen([self.arduplot, '-s', str(PORT)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1022, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1491, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified

============================================================

An unexpected error occurred. Further steps:

============================================================

yhur commented 1 year ago

Hmm, I noticed Python 10 introduced some change that break some backward compatibility on other projects and this may be the case. It may take some time for me to work on this version migration. Meanwhile, could you run on the Python3.9?

yhur commented 1 year ago

@Depech101 I installed the VSCode and PIO fresh to plan my time to work on this issue, and concluded the arduplot is working fine even with the new Python11. So fortunately the the change is not affecting the arduplot.

And looking through your reply, I found you're running the Windows default Python not the PIO bundled Python. If you want to run the arduplot with the Windows default Python, then you need to install arduplot to that environment as well.

I guess you already know, but just to document, PIO uses a virtual Python environment. And you had installed the arduplot on to this venv.

Would you check this and let me know? Thanks.

Depech101 commented 1 year ago

Ok, i will do it, and I truly value your involvement! But I need to understand this things about env and so on. As variant You can have access to my computer trough AnyDesk app.

Depech101 commented 1 year ago

Or give me a link for pio and stuff I will try understand with help of chatGPT it worth nothing)

yhur commented 1 year ago

It looks like you have more than two Python versions on your PC, for example, Python 3.11 installed on the Windows system wise, and Python3.9 under ~/.platformio/penv/bin for PIO(PlatformIO). Your first posting on this issue showed you installed the arduplot on the Python3.9 environment.

So you need to open the Terminal from the VSCode project and run it. i.e. pio device monitor -f plotter

Or open a Command Prompt from Windows start menu, install arduplot again to Python 3.11 system wise environment, and run arduplot.

Additional info:

  1. PIO(PlatformIO) Web Site : https://platformio.org
  2. venv stands for 'virtual environment' and it's a virtual environment for the Python. You can create many virtual environment for the Python so you can have many isolated Python environment. For example you can install library A, B, C on one environment where you run a Python script, and A, D, and older version of B on a different environment to run a different Python script since this one needs older version.
Depech101 commented 1 year ago

image

Depech101 commented 1 year ago

Microsoft Windows [Version 10.0.19044.2965] (c) Microsoft Corporation. All rights reserved.

C:\Users\user>cd C:\Users\user\Documents\PLATFORMIO\PROJECTS\Termorelay

C:\Users\user\Documents\PLATFORMIO\PROJECTS\Termorelay>pio device monitor -f plotter --- serial_plotter is starting Error: Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio__main.py", line 102, in main cli() # pylint: disable=no-value-for-parameter ^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\cli.py", line 70, in invoke return super().invoke(ctx) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke return callback(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\command.py", line 152, in device_monitor_cmd start_terminal(options) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\terminal.py", line 54, in start_terminal term = new_terminal(options) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\terminal.py", line 102, in new_terminal term = Terminal( ^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\platformio\device\monitor\terminal.py", line 28, in init super().init(args, **kwargs) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\tools\miniterm.py", line 403, in init self.update_transformations() File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\tools\miniterm.py", line 456, in update_transformations self.tx_transformations = [t() for t in transformations] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\serial\tools\miniterm.py", line 456, in self.tx_transformations = [t() for t in transformations] ^^^ File "C:\Users\user\Documents\PLATFORMIO\PROJECTS\Termorelay\monitor\filter_plotter.py", line 52, in call self.plot = subprocess.Popen([self.arduplot, '-s', str(PORT)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1022, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1491, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified

============================================================

An unexpected error occurred. Further steps:

============================================================

C:\Users\user\Documents\PLATFORMIO\PROJECTS\Termorelay>

yhur commented 1 year ago

When you see the log, you find the following string. "C:\Users\user\AppData\Local\Programs\Python\Python311\"

And "Python311" in that string means it's running Python 3.11 that is outside of PIO. The latest PIO uses Python 3.9 for now.

Depech101 commented 1 year ago

Yeah! Sounds magic)) I will try later

Depech101 commented 1 year ago

Got this: Executing task: C:\Users\user\AppData\Local\Programs\Python\Python311\Scripts\platformio.exe device monitor How can I change it to Python3.9?

yhur commented 1 year ago

In order to use the PIO bundled Python, you need to open the terminal from the VSCode with the Project open. That is

  1. start VSCode
  2. open the PIO project
  3. open the terminal by clicking the terminal icon as below. Screenshot 2023-05-26 at 10 28 30 AM

Then, you can run either arduplot or pio device monitor -f plotter

And if you want to know which version of Python you're running, just type pip -V, then you will see the actual pip that matches the Python

Hope this helps.

Depech101 commented 1 year ago

Thank you! Here what i got: изображение

yhur commented 1 year ago

@Depech101 Close the terminal, and open a terminal again with the VSCode status bar icon and see if it change.

The proper one should look like C:\User\user\.platformio\penv\lib\python3.9\site-packages\pip (python 3.9)

Otherwise please take a look at the PIO document and reinstall VSCode and PIO.

Depech101 commented 1 year ago

PS C:\Users\user\Documents\PlatformIO\Projects\Termorelay> py -0p
-V:3.11 * C:\Users\user\AppData\Local\Programs\Python\Python311\python.exe -V:3.10 C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe -V:3.9 C:\Users\user\AppData\Local\Programs\Python\Python39\python.exe

Depech101 commented 1 year ago

Close the terminal, and open a terminal again with the VSCode status bar icon and see if it change. why should it change if I didn't changed it?

The proper one should look like C:\User\user.platformio\penv\lib\python3.9\site-packages\pip (python 3.9)

Otherwise please take a look at the PIO document and reinstall VSCode and PIO.

yhur commented 1 year ago

Please refer to the documentation of a python and the PIO.

Depech101 commented 1 year ago

Oh thank you, I will