Blank screen in Psychopy!

I am trying to run Python scripts for a Brain Computer Interface Paradigm that uses Psychopy as GUI to create a visual stimuli. I am using Mac OS and the scripts are tun through the terminal I get the following message: “This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac.”

I am using Python 2.7 and latest version of Psychopy.

Running the scripts via coder view pops-up a new blank Psychopy screen. Does it has something to do with the command " from pylab import * " in the python scripts?

Thanks in Advance!

Try running your script with pythonw rather than python.

I have tried running scripts using pythonw instead of python and it opens up the Psychopy GUI to enter some initial data… Once I enter those, following message gets displayed on my terminal : "2017-08-10 16:44:12.166 python[52381:2593862] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/cs/_c0k8l3j6m771s2pjk_fj0280000gn/T/com.continuum.python.savedState
/dev/tty.usbserial-DQ007Z1Y
hello_1.csv
/dev/tty.usbserial-DQ007Z1Y
<type ‘str’>
10.0
<type ‘float’>
60.4073238211

GUI of Psychopy starts loading, but nothing happens! I am still not able to see anything!

This is the error I am getting - Traceback (most recent call last):
File “run.py”, line 46, in
import run_ssvep
File “/Users/divz/Documents/EEG_Toolbox-master/run_ssvep.py”, line 60, in
run()
File “/Users/divz/Documents/EEG_Toolbox-master/run_ssvep.py”, line 48, in run
stimuli12.start()
File “/Users/divz/Documents/EEG_Toolbox-master/SSVEP.py”, line 59, in start
self.collecting()
File “/Users/divz/Documents/EEG_Toolbox-master/SSVEP.py”, line 40, in collecting
self.collector = csv_collector.CSVCollector(fname=self.fname, port= self.port)
File “/Users/divz/Documents/EEG_Toolbox-master/csv_collector.py”, line 22, in init
self.board = OpenBCIBoard(port, baud)
File “/Users/divz/Documents/EEG_Toolbox-master/open_bci.py”, line 60, in init
self.dump_registry_data()
File “/Users/divz/Documents/EEG_Toolbox-master/open_bci.py”, line 121, in dump_registry_data
line = self.ser.readline()
File “/Users/divz/anaconda/lib/python2.7/site-packages/serial/serialposix.py”, line 475, in read
raise SerialException(‘read failed: {}’.format(e))
serial.serialutil.SerialException: read failed: [Errno 6] Device not configured

Can someone please help me out?

We would need to see the code where you initialise your serial port and try to use it. Also describe what software you installed to communicate with the serial port.

Mac’s don’t have serial ports of course, so I’m guessing you have some sort of USB serial adapter, with appropriate driver?

This is the portion of the code where serial port is mentioned.

 '''
 Core OpenBCI object for handling connections and samples from the board.

 EXAMPLE USE:

def handle_sample(sample):
   print(sample.channels)

 board = OpenBCIBoard()
 board.print_register_settings()
 board.start(handle_sample)


'''


import serial
import struct
import numpy as np

SAMPLE_RATE = 250.0  # Hz
START_BYTE = bytes(0xA0)  # start of data packet
END_BYTE = bytes(0xC0)  # end of data packet


def find_port():
  import platform, glob

s = platform.system()
if s == 'Linux':
    p = glob.glob('/dev/tty.usbserial-DQ007Z1Y')

elif s == 'Darwin':
    p = glob.glob('/dev/tty.usbserial-DQ007Z1Y')

if len(p) >= 1:
    return p[0]
else:
    return None

class OpenBCIBoard(object):

'''

Handle a connection to an OpenBCI board.

Args:
port: The port to connect to.
baud: The baud of the serial connection.

'''

def __init__(self, port='None', baud=115200, filter_data=True):
  if not port:
     port = find_port()
  if not port:
    raise OSError('Cannot find OpenBCI port')
    
 port = find_port()
  if not port:
    raise OSError('Cannot find OpenBCI port')

self.ser = serial.Serial(port, baud)
self.dump_registry_data()
self.streaming = False
self.filtering_data = filter_data
self.channels = 8

I am using Open BCI Cyton board for obtaining brain signal. The software is used is OpenBCI_Python (http://docs.openbci.com/OpenBCI%20Software/05-OpenBCI_Python)
I have installed FTDI driver on my Mac.

This is the original github link from where I used the code. (https://github.com/Cognitive-Technology-Group/EEG_Toolbox)

Hi, I have edited the code.

Also, I have one more question. While installing Psychopy, what are the dependencies that need to be installed along with it. Please let me know.

Thanks!

Hi,

All the dependencies are listed on the download/install page here:
http://psychopy.org/installation.html#manual-install

From memory the only thing that was slightly awkward was getting a precompiled version of wxpython for macOS.

I had similar problems to you, and ended up taking Jon Peirce’s advice and using the standalone version as it provides all the necessary dependencies and a working Python 2.7 installation for Psychopy.

Best wishes,

Jon