Page 1 of 1

Python problem

Posted: Mon Nov 30, 2015 6:35 pm
by dires
Hi everyone,

I'm trying to get the simple blink example in python to work.
I saved the code into the new file /root/examples/blink.py and made it executable.
But I got an import error for the redpitaya_scpi. (ImportError: No module named redpitaya_scpi)

I then found the github folder Link and also copied the file "redpitaya_scpi.py" to the folder /root/examples/.

Then I got a different error in line 11. (IndexError: list index out of range)

I'm totally new to Redpitaya, so can you please help a newbie? :)

Thanks in advance.

Best regards
Sven

Re: Python problem

Posted: Mon Nov 30, 2015 10:05 pm
by Nils Roos
If I had to guess, you ommitted the ip address on the command line. All the python examples need at least the Red Pitaya's address as an argument. That's because they all try to connect to the scpi-server running on the Red Pitaya.

To pre-empt the most likely problem you'll encounter next, the scpi-server is not started automatically when booting, you will have to connect to the Red Pitaya and start it by hand (see here for more details).

edit: In case you are trying to run the python examples on the Red Pitaya, you can just use 127.0.0.1 as address. But you still need to start the scpi-server first.

Re: Python problem

Posted: Mon Nov 30, 2015 10:46 pm
by dires
Thanks a lot for your answer.

I did start the server by hand, as it is stated in the tutorial. And I tried to run the python example on the pitaya.

What would the command line exemplarily look like, to start the code while ommitting the ip address?

Thanks again. :)

Re: Python problem

Posted: Mon Nov 30, 2015 10:52 pm
by Nils Roos
The address is required - if you leave it out, you'll get the 'list index out of range' error. The command would be:

Code: Select all

./blink.py 127.0.0.1

Re: Python problem

Posted: Wed Dec 09, 2015 12:07 am
by dires
Hey Nils,

sorry for the late reply, but I just wanted to say thanks for your help. :)
Everything worked fine now. ;)

Re: Python problem

Posted: Fri Oct 26, 2018 2:05 pm
by chris2121
Hello Everyone,

If you want to improve your programming skill as well as your concepts. You need to just through with the Python Tutorial. It helped me a lot. I suggest you to go through with this link.

Thanks

Re: Python problem

Posted: Thu Dec 27, 2018 2:20 pm
by maria7654
Hey,

I was also getting some error in the python. I want to learn python Can anyone tell me where can I get a good knowledge of python. please suggest.
Thank you!