Python interpreter
-
- Posts: 115
- Joined: Fri Jan 09, 2015 6:07 pm
- Location: Babenhausen/Germany
Python interpreter
Hello,
I am trying to install Python and MS Visual Code.
Everything worked okay until:
3. Install appropriate extensions for your coding environment (Python Extension Pack and Better Comments are a good combination for VS Code).
4. Setup or create a new XXX. Here are some for Visual Studio Code.
5. Choose a Python interpreter.
Item (4) is not clear for me, the place where the XXX is shown, is empty. And so I don't know how I can get to the window where I can select a python interpreter in item (5). All the menu items don't show how to get there.
Thanks for any help.
Regards
Dieter
I am trying to install Python and MS Visual Code.
Everything worked okay until:
3. Install appropriate extensions for your coding environment (Python Extension Pack and Better Comments are a good combination for VS Code).
4. Setup or create a new XXX. Here are some for Visual Studio Code.
5. Choose a Python interpreter.
Item (4) is not clear for me, the place where the XXX is shown, is empty. And so I don't know how I can get to the window where I can select a python interpreter in item (5). All the menu items don't show how to get there.
Thanks for any help.
Regards
Dieter
-
- Posts: 799
- Joined: Sat May 23, 2015 5:22 pm
Re: Python interpreter
I use micromamba to install Python. Here is a link to the instructions that work for me:
http://pavel-demin.github.io/red-pitaya ... ng-started
http://pavel-demin.github.io/red-pitaya ... ng-started
-
- Posts: 115
- Joined: Fri Jan 09, 2015 6:07 pm
- Location: Babenhausen/Germany
Re: Python interpreter
I got some more things. The compiler runs so far, without selecting a special interpreter. Maybe it recognizes automatically what is needed. I don't know, I am a beginner -- I programmed a lot in C++ for Arduino and for Microchip PICs as well and even in assembler for older 68HC11 and derivates. Python is rather new for me. But they tell that it is an easy to learn language. So far, so good.
When I ran one of the simple PY programs like 'Blink', I first got errors like
unknown false did you mean False
unknown true did you mean True
unknown null
Okay I changed this, the one with null I changed to None.
The code is:
But there is still an error, which I cannot solve.
rp_s = scpi.scpi(IP)
^^^^^^^^^
AttributeError: module 'redpitaya_scpi' has no attribute 'scpi'
It seems that there is something missing in the library.
Maybe somebody can help with a hint.
Thank you
Dieter
When I ran one of the simple PY programs like 'Blink', I first got errors like
unknown false did you mean False
unknown true did you mean True
unknown null
Okay I changed this, the one with null I changed to None.
The code is:
Code: Select all
#!/usr/bin/env python3
import sys
import time
import redpitaya_scpi as scpi
IP = 'rp-f066c8.local'
rp_s = scpi.scpi(IP)
if (len(sys.argv) > 2):
led = int(sys.argv[2])
else:
led = 0
print ("Blinking LED["+str(led)+"]")
period = 1 # seconds
while 1:
time.sleep(period/2.0)
rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(1))
time.sleep(period/2.0)
rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(0))
rp_s.close()
But there is still an error, which I cannot solve.
rp_s = scpi.scpi(IP)
^^^^^^^^^
AttributeError: module 'redpitaya_scpi' has no attribute 'scpi'
It seems that there is something missing in the library.
Maybe somebody can help with a hint.
Thank you
Dieter
-
- Posts: 115
- Joined: Fri Jan 09, 2015 6:07 pm
- Location: Babenhausen/Germany
Re: Python interpreter
Next step:
I found (my) first mistake: The redpitaya_scpi.py was a wrong file. Then I copied a seemingly file. Now I think I have the right one. At least there is a different error after starting to run the BLINK program:
ModuleNotFoundError: No module named 'numpy'
In the Red Pitaya library there is an import of the module, which seems to be missing.
Okay, I will have a look how to install this module numpy (which should have been done during the Python-installation -- seemingly).
Maybe somebody knows something about that.
Best regards
Dieter
I found (my) first mistake: The redpitaya_scpi.py was a wrong file. Then I copied a seemingly file. Now I think I have the right one. At least there is a different error after starting to run the BLINK program:
ModuleNotFoundError: No module named 'numpy'
In the Red Pitaya library there is an import of the module, which seems to be missing.
Code: Select all
"""SCPI access to Red Pitaya."""
import socket
import struct
import numpy as np
Maybe somebody knows something about that.
Best regards
Dieter
- redpitaya
- Site Admin
- Posts: 912
- Joined: Wed Mar 26, 2014 7:04 pm
Re: Python interpreter
Hello Dieter,
Weirdly, the links for workspace and tutorials do not display for you in the Python instructions... They display just fine on my setup
The line says: "Setup or create a new workspace. Here are some tutorials for Visual Studio Code."
The links are: - https://code.visualstudio.com/docs/editor/workspaces
- https://code.visualstudio.com/docs/gets ... ntrovideos
Weirdly, the links for workspace and tutorials do not display for you in the Python instructions... They display just fine on my setup
The line says: "Setup or create a new workspace. Here are some tutorials for Visual Studio Code."
The links are: - https://code.visualstudio.com/docs/editor/workspaces
- https://code.visualstudio.com/docs/gets ... ntrovideos
- redpitaya
- Site Admin
- Posts: 912
- Joined: Wed Mar 26, 2014 7:04 pm
Re: Python interpreter
Yes, I will fix and test the examples.Bulova wrote: ↑Sun Mar 17, 2024 7:20 pmI got some more things. The compiler runs so far, without selecting a special interpreter. Maybe it recognizes automatically what is needed. I don't know, I am a beginner -- I programmed a lot in C++ for Arduino and for Microchip PICs as well and even in assembler for older 68HC11 and derivates. Python is rather new for me. But they tell that it is an easy to learn language. So far, so good.
When I ran one of the simple PY programs like 'Blink', I first got errors like
unknown false did you mean False
unknown true did you mean True
unknown null
Okay I changed this, the one with null I changed to None.
The code is:
Code: Select all
#!/usr/bin/env python3 import sys import time import redpitaya_scpi as scpi IP = 'rp-f066c8.local' rp_s = scpi.scpi(IP) if (len(sys.argv) > 2): led = int(sys.argv[2]) else: led = 0 print ("Blinking LED["+str(led)+"]") period = 1 # seconds while 1: time.sleep(period/2.0) rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(1)) time.sleep(period/2.0) rp_s.tx_txt('DIG:PIN LED' + str(led) + ',' + str(0)) rp_s.close()
But there is still an error, which I cannot solve.
rp_s = scpi.scpi(IP)
^^^^^^^^^
AttributeError: module 'redpitaya_scpi' has no attribute 'scpi'
It seems that there is something missing in the library.
Maybe somebody can help with a hint.
Thank you
Dieter
For the second error, you have to download the Red Pitaya SCPI library, which you can get from here: https://github.com/RedPitaya/RedPitaya/ ... ya_scpi.py and include it as
Code: Select all
import redpitaya_scpi as scpi
Please also change the IP local address to the one that matches your own board
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
-
- Posts: 115
- Joined: Fri Jan 09, 2015 6:07 pm
- Location: Babenhausen/Germany
Re: Python interpreter
Hello RP,
the reason why some PDFs are not displaying the whole content is probably coming from different readers. I am mostly using Acrobat reader, not Chrome or somehting else.
I can report some success. The simple Python program BLINK.PY now runs perfectly. To solve my last problems, I have done the following steps (just in case, that somebody stumbles over the similar problems like me):
1) The missing module 'numpy' has to be installed first: Simply start Terminal (Windows Powershell) and type
Then the installation should work okay.
2) After starting the Python program there is still a message, that the device cannot be connected. To solve this, run the RP's selection space for apps and select
'Development'
SCPI server
RUN
It will be confirmed by a green text.
Then normally you can start the Python file by pressing RUN under Windows Visual Studio Code.
I hope this helps other people too.
Best regards
Dieter
the reason why some PDFs are not displaying the whole content is probably coming from different readers. I am mostly using Acrobat reader, not Chrome or somehting else.
I can report some success. The simple Python program BLINK.PY now runs perfectly. To solve my last problems, I have done the following steps (just in case, that somebody stumbles over the similar problems like me):
1) The missing module 'numpy' has to be installed first: Simply start Terminal (Windows Powershell) and type
Code: Select all
pip install numpy
2) After starting the Python program there is still a message, that the device cannot be connected. To solve this, run the RP's selection space for apps and select
'Development'
SCPI server
RUN
It will be confirmed by a green text.
Then normally you can start the Python file by pressing RUN under Windows Visual Studio Code.
I hope this helps other people too.
Best regards
Dieter
- redpitaya
- Site Admin
- Posts: 912
- Joined: Wed Mar 26, 2014 7:04 pm
Re: Python interpreter
Hello Dieter,
Thank you for the feedback.
One question, are you viewing the documentation online, or have you downloaded it as a PDF and view it like that? I will check the rendering of the PDF documentation and make sure to fix the bugs.
I assumed the instructions on starting the SCPI and installing Python libraries were clear enough, I will update then with the next patch of documentation.
Thank you for the feedback.
One question, are you viewing the documentation online, or have you downloaded it as a PDF and view it like that? I will check the rendering of the PDF documentation and make sure to fix the bugs.
I assumed the instructions on starting the SCPI and installing Python libraries were clear enough, I will update then with the next patch of documentation.
-
- Posts: 115
- Joined: Fri Jan 09, 2015 6:07 pm
- Location: Babenhausen/Germany
Re: Python interpreter
Hello RP,
for me it looks like the downloaded PDF suppresses some URL links. Internal links are okay, but on page 161 of 2.00-30 from Mar 22 2024 under 4) it says:
4) Setup or create a new ____
Online it comes through that it is meant "Workspace", and behind that it is a URL link to Visual Studio site. It can be that my windows setup suppresses links somewhere else, I am not sure.
Best regards
for me it looks like the downloaded PDF suppresses some URL links. Internal links are okay, but on page 161 of 2.00-30 from Mar 22 2024 under 4) it says:
4) Setup or create a new ____
Online it comes through that it is meant "Workspace", and behind that it is a URL link to Visual Studio site. It can be that my windows setup suppresses links somewhere else, I am not sure.
Best regards
-
- Posts: 115
- Joined: Fri Jan 09, 2015 6:07 pm
- Location: Babenhausen/Germany
Re: Python interpreter
Hello RP,
as I said, most likely the PDF setup causes this problem. I used now the EPUB download instead and opened it with Adobe Digital Edition, and this does not suppress the links. Thank you for taking care.
Best regards
Dieter
as I said, most likely the PDF setup causes this problem. I used now the EPUB download instead and opened it with Adobe Digital Edition, and this does not suppress the links. Thank you for taking care.
Best regards
Dieter
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie
Who is online
Users browsing this forum: No registered users and 103 guests