psychopy.org | Reference | Downloads | Github

Problem with adding external module to Psychopy - ftd2xx

Hello,

I’m having trouble adding an external module to Psychopy.

I’ve searched through this forum and found the following discussion:

I’m having the same issue following the instructions on the Psychopy website(http://www.psychopy.org/recipes/addCustomModules.html#addmodules) however I can’t seem to resolve it.

I tried copying the ftd2xx folder to the site-packages folder, and then I added the folder path to the preferences/general dialogue box. When I attempt to import the module using the shell, I get an import error.

I’m wondering if there is something wrong with my path syntax. Here’s the path for the module folder:

C:\Program Files (x86)\PsychoPy2\Lib\site-packages\ftd2xx-1.0

When I return to the dialogue box, here is how the path is formatted:
[‘C:\Program Files (x86)\PsychoPy2\Lib\site-packagestd2xx-1.0’]

TIA

Hi @David_C, you appear to have a typo in your path that you have added to the preferences dialogue box - you have missed the backslash following site-packages. It should be:

[‘C:\Program Files (x86)\PsychoPy2\Lib\site-packages\ftd2xx-1.0’]

Also, if you are using this method, you must first import psychopy before importing your new module - see here.

Thank you dvbridges - I had a feeling it was a dumb mistake. I did however remember to import psychopy first.

On closer inspection, I see what the culprit was: Untitled

the \f was re-formatted automatically to the Venus symbol. Instead of two \ 's.

Thanks again for your response!

In Python, it is safest to avoid backslashes in path names, because they can act to trigger escape sequences. Sure, you can escape them with \\, but it is easier to just use single forward slashes /. Python will interpret those correctly in a cross-platform way.

1 Like

Good to know, thank you Michael!