psychopy.org | Reference | Downloads | Github

Problems with gui dialog box on 1.85.2 (related to wxPython)


#1

I’m on Windows 10 and just freshly installed the latest versions of Psychopy (1.85.2) and wxPython (4.0.0b1), but for the first time I’m getting problems making dialog boxes. Everything else in PsychoPy seems to work great.

Here’s the error I get whenever I try to make a dialog box:

Traceback (most recent call last):
  File "D:/Dropbox/Yale/Projects/Prototype Effect/code/prototype_effect_razer.py", line 261, in <module>
    expInfo = enterSubInfo(expName)
  File "D:/Dropbox/Yale/Projects/Prototype Effect/code/prototype_effect_razer.py", line 24, in enterSubInfo
    dlg = gui.DlgFromDict(dictionary=expInfo, title=expName, fixed=['dateStr'])
  File "C:\Python27\lib\site-packages\psychopy\gui\wxgui.py", line 249, in __init__
    Dlg.__init__(self, title)
  File "C:\Python27\lib\site-packages\psychopy\gui\wxgui.py", line 64, in __init__
    wx.Dialog.__init__(self, None, -1, title, pos, size, style)
TypeError: Dialog(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 4 has unexpected type 'NoneType'

Process finished with exit code 1

Here’s the code I’m using (which has worked on multiple operating systems, machines, and PsychoPy installations before):

def enterSubInfo(expName):  # GUI for entering experiment info
    try:
        expInfo = misc.fromFile(
            expName + '_' + '#' + '_' + 'lastParams.pickle')  # note the '#', for file-ordering purposes
    except:
        expInfo = {'Experiment': expName, 'Testing Location': '', 'Experimenter Initials': 'sdu',
                   'Subject Initials': '', 'Subject ID': '', 'Subject Age': '', 'Subject Gender': ''}
    expInfo['dateStr'] = data.getDateStr()
    dlg = gui.DlgFromDict(dictionary=expInfo, title=expName, fixed=['dateStr'])
    if dlg.OK:
        misc.toFile(expName + '_' + '#' + '_' + 'lastParams.pickle',
                    expInfo)  # note the '#', for file-ordering purposes
    else:
        core.quit()

    return expInfo

expName = 'PE1'
expInfo = enterSubInfo(expName)

Any thoughts as to how I can fix the problem?


#2

Your error

argument 4 has unexpected type 'NoneType'

is referencing the fixed = ['dateStr'] argument in the gui.DlfFromDict() function.

Essentially, it isn’t finding your key ‘dateStr’ in your expInfo dictionary, which means that the data.getDateStr() function isn’t returning anything, so the ‘dateStr’ key isn’t being created in the first place. To check, run:

expInfo['dateStr'] = data.getDateStr()
print data.getDateStr()
print expInfo.get('dateStr') 

and see what is returned. I don’t know where the .getDateStr() function comes from, but an alternative would be to use datetime64 objects from numpy.


#3

@oguayasa’s idea is a good one but I don’t think that’s the problem (data.getDateStr() should always return a string, and if I insert None in its place the dialog still works for me).

I think the issue is the installation of wxPython 4.0.0. PsychoPy wasn’t compatible with wx4 at release 1.85.2. We’ve now got the repository working with that but you’ll have to wait for 1.86.0 to use wx4.0

cheers,
Jon


#4

Hello, I’m new with PsychoPy and I have this same problem when using gui to create a dialog box in my Mac, do you have any solution already?

Tank u


#5

I have Linux, so the only version of Psychopy I can use is 1.85.3. What are my options in this case? I cannot update Psychopy in order to use the wxPython 4 and I have installed python-wxtools, although I get the same error message. I have tried installing psychopy through anaconda and mannaged to install wxpython v3, but now I have the error:

Traceback (most recent call last):
  File "/home/joserodas/Documents/c_tasks/Columns n-back.py", line 28, in <module>
    from psychopy import visual, core, data, event, gui
  File "/home/joserodas/anaconda2/lib/python2.7/site-packages/psychopy/gui/__init__.py", line 18, in <module>
    import wx
  File "/home/joserodas/anaconda2/lib/python2.7/site-packages/wx-3.0-gtk2/wx/__init__.py", line 45, in <module>
    from wx._core import *
  File "/home/joserodas/anaconda2/lib/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py", line 4, in <module>
    import _core_
ImportError: /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0: undefined symbol: g_log_structured_standard