Connecting Issues using Python

  • Hello,
    I am a UF undergrad research assistant. I am working on a project and am using the Rodeostat.

    I am having troubles connecting/communicating with the Rodeostat over the Python Interface. I am using Enthought Canopy as my IDE for Python. I have successfully connected to the device using the serial port bridge software on chrome and via Python/Canopy many times. My application requires using Python to interface with the Rodeostat.

    However, when I use run my code I get error messages that the Rodeostat is unable to connect. I can provide the error messages from command window and Canopy. I have used this code successfully many times but inconsistently so I am lead to believe it is not my code causing my problem.

    I can also provide a successful output so I know the connection is possible it is just inconsistent.

    I can temporarily and inconsistently fix my problem by
    *Unplug and plug back in the Rodeostat and rerun the code
    *Restarting the kernel environment where the Python code is compiled/interpreted and rerun the code
    *Restart Canopy (Python IDE) and rerun the code

    Do you have any suggestions on fixing this?

    I have also double checked the file that I am using is current, have you updated your files since last year?

  • Ignore the final line.

  • Hi Andrew,

    I'm not sure what exactly is happening here. Definitely send me the error messages you are getting.

    I'm wondering if perhaps the issue has to do with with use of the Enthought Canopy environment and running the Rodeostat from a REPL with a continuously running kernel. Especially, considering that restarting the kernel and re-plugging the Rodeostat fixes the issue. A quick question. Are you re-connecting to the Rodeostat each time you run your script? i.e., creating a new Potentiostat instance each time the script is run. If so it is possible that you are unable to connect to the Rodeostat on subsequent runs because there is already an existing connection to the device. Note, the behavior can be different on different operating systems. For example on windows creating a new Potentiostat instance ( 2nd connection to the device) will fail if one already exists. Whereas it may work on linux - on my ubuntu 18.04 system I can create multiple connections to the same potentiostat from an ipython REPL. As a test to determine if this is the cause of your issue you might try running your Python programs from the command line instead of from a REPL (with a continuously running kernel). Do you still see the same inconsistency issues?

    The fact that the serialport-bridge is working make me think there is no issue with your hardware. However, with the serialport-bridge a separate process (the serivalport-bridge server) is making and maintaining the USB/serial connection to the potentiostat rather than the python REPL/kernel.

  • Awesome. Thank you so much for your input.
    I will try these suggestions and get back to you with answers to your questions.

  • Hi again,

    I am reconnecting the Rodeostat each time I run my script. I am using a Windows system so the behavior of my system matches the situation you describe.

    I have code that to my knowledge closes the connection to the device at the end of the script to prevent such a situation. Thanks for taking the time to help me I appreciate it.

    Just for clarity's sake, what exactly is a REPL? I will try running my program from the command line and see if my problem persists.

    Thank yo for clarifying that technical difference between serialport-bridge and python REPL/kernel.

    I am unsure how to embed pictures in this forum post or I would show my code and exact error messages.

  • @aplummer

    A REPL is a Read–Eval–Print Loop–eval–print_loop

    The python interactive shell, ipython, etc. are examples of REPLs.

  • Awesome thank for that clarification. I will try that and get back to you.

  • I have tried some things on my own but have not been successful. How do I run a python script in the command window? I am not familiar with this method of using the Python Interpreter. If you could give me some commands or instructions to use that would help I think. Thanks.

  • I have been able to run Python in the command window and run my code consecutively and it worked fine. I double checked that the REPL feature I was using is the cause of my trouble. Thanks for your help.

  • Hello again,

    I am having more trouble connecting to my rodeo stat. I want to be able to run a long chronoamperometric test with lots of cycles. I have already looked thoroughly through the examples, cany anyone offer me some assistance?

  • @aplummer

    I'm happy to try and help. Could you explain in a bit more detail the issue you are having?

  • @Will-Dickson Is there any way you could provide me further documentation of the functions in the API reference?

    If not, could you provide some explanation for the use of a class in the constant voltage logger example.

    Basically, I wrote a python file that contains a function. Outside the function I open a connection to the rodeostat. Then I call the function to perform a chronoamperometric test. It works on the first sweep, but when I try to run the function again the serial connection to the rodeostat fails. I could not figure how to share my code easily or I would.

  • I think I have fixed my problem but now I am getting serial exception with error messages that say that my access is denied?

Log in to reply