I posted the issue to the PsychoPy forum already, but was wondering if I could get more input from StackExchange.

So I’m having difficulty establishing connection between the Psychopy running testing machine and the machine with the actual netstation installed. I numbered the summary questions at bottom!

I have the basic following code below, but I’m assuming I am inputting a wrong IPv4 address or port number for the net station.

from __future__ import absolute_import, division, print_function
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging,     clock
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
                            STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
import numpy as np  # whole numpy lib is available, prepend 'np.'
from numpy import (sin, cos, tan, log, log10, pi, average,
               sqrt, std, deg2rad, rad2deg, linspace, asarray)
from numpy.random import random, randint, normal, shuffle
import os  # handy system and path functions
import sys  # to get file system encoding

# Setup for EGI 
import egi.simple as egi # for testing purposes
#import egi.simple as egi
ms_localtime = egi.ms_localtime # gives local time in ms 
ns = egi.Netstation() 
ns.connect('ipv4 address of the testingmachine ', 'port number of netstation machine') # change/ check by Network Utility?

And I get the following error:

File "/Users/abc/Documents/PsychoPy/cfv/cfv_egi.py", line 281, in ns.BeginSession() 

File "/Users/abc/Documents/PsychoPy/cfv/egi/simple.py", line 799, in       BeginSession self._socket.write( message ) 

File "/Users/abc/Documents/PsychoPy/cfv/egi/socket_wrapper.py", line 58, in write self._connection.write( data )
AttributeError: Socket instance has no attribute '_connection' 6.9777 WARNING 
When I change the port to another one with a server, it gives me the below:

Traceback (most recent call last): File    
"/Users/abc/Documents/PsychoPy/cfv/cfv_egi.py", line 281, in ns.BeginSession() 

File "/Users/abc/Documents/PsychoPy/cfv/egi/simple.py", line 804, in BeginSession return self.GetServerResponse() 

File "/Users/abc/Documents/PsychoPy/cfv/egi/simple.py", line 783, in GetServerResponse 
raise Eggog( "unexpected character code returned from server: '%s'" % (code, ) ) 
egi.simple.Eggog: unexpected character code returned from server: 'R'

So summarizing my question,

  1. Is it correct that I am supposed to input the IPv4 address of the NetStation machine?

  2. How do I figure out what port number I need to input? Do I use the port numbers listed from using “Network Utility” app in the mac?

  3. When running the psychopy code that makes me connect to the machine, what needs to be setup in the Netstation computer? ie. do I need to have netstation software running?

Thank you. Any help or pointers would be appreciated!

  • 3
    $\begingroup$ I think a specific question like this is more suitable for the PsychoPi forum and your duplicate question there has four replies. Personally, I do not post any questions on the MATLAB PsychToolbox here either; as the respective forum is more suitable for these kinds of specifics. I went over to Bio Informatics SE and they regard your question as offtopic there, so migration is not an option. It will likely not be answered here either. Would you mind if this question is closed? $\endgroup$
    – AliceD
    Sep 25, 2018 at 9:00
  • $\begingroup$ @AliceD Yes, it's alright. I was hoping I could get more input from here too. Thanks! $\endgroup$
    – Vinci
    Sep 25, 2018 at 14:51
  • $\begingroup$ I'll through this issue on meta as well before closing. It's a well researched question and the topic is great, it's just very specific. Thanks for your understanding. $\endgroup$
    – AliceD
    Sep 25, 2018 at 15:05
  • $\begingroup$ @AliceD how about Computational Science? $\endgroup$
    – Ooker
    Sep 29, 2018 at 7:35
  • $\begingroup$ @Ooker wow thanks for the pointer! I'll head over to their chat once I have my hands free. Thanks! $\endgroup$
    – AliceD
    Sep 29, 2018 at 7:46


Browse other questions tagged or ask your own question.