Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Mistake in documentation for FormComponent #6452

Open
paulcbogdan opened this issue May 9, 2024 · 0 comments
Open

[Bug]: Mistake in documentation for FormComponent #6452

paulcbogdan opened this issue May 9, 2024 · 0 comments
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior. 📓 docs & demos Issue with documentation (typos, outdated, etc.) or demos. ▶️ good first issue

Comments

@paulcbogdan
Copy link

PsychoPy Version

2024.1.3

What OS are your PsychoPy running on?

Windows 11

Bug Description

The documentation for Form says that it accepts type = 'free-text'. However, it should be 'free text' (at least per v2024.1.3).

'free-text' causes an error. This should be easy to fix, as I'm just suggesting the documentation is modified? I imagine that you may want to push users toward your other survey options, but it would still be nice. You could also add that "{'radio', 'description', 'heading'}" are other possible options not listed in the documentation

Expected Behaviour

For the documentation, it should just say 'free text'.

Steps to Reproduce

It's the documentation

Additional context

I also encountered some other issues related to the error logging in visual.form._checktypes. I'm not sure if it's worth addressing this because it would be more tedious, but I describe it below.

The error message, msg, is supposed to tell users what the correct types are. However, the error logging itself has an error because msg isn't being defined. This is the error:

Files\PsychoPy\lib\site-packages\psychopy\visual\form.py", line 136, in __init__
    self.items = self.importItems(items)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\form.py", line 326, in importItems
    [_checkTypes(item['type'], item['itemText']) for item in items]
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\form.py", line 326, in <listcomp>
    [_checkTypes(item['type'], item['itemText']) for item in items]
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\form.py", line 253, in _checkTypes
    logging.error(msg)

And here is the error-generating error-logging code:

def _checkTypes(types, itemText):
    """A nested function for testing the number of options given

    Raises ValueError if n Options not > 1
    """
    itemDiff = set([types]) - set(_knownRespTypes)
    # print('known types:', _knownRespTypes) I needed to add this line for my personal debugging

    for incorrItemType in itemDiff:
        if incorrItemType == _REQUIRED:
            if self._itemsFile:
                itemsFileStr =  ("in items file '{}'"
                                 .format(self._itemsFile))
            else:
                itemsFileStr = ""
            msg = ("Item {}{} is missing a required "
                   "value for its response type. Permitted types are "
                   "{}.".format(itemText, itemsFileStr,
                                _knownRespTypes))
            print(msg)
        if self.autoLog:
            logging.error(msg)
        raise ValueError(msg)
        
       ```
@paulcbogdan paulcbogdan added the 🐞 bug Issue describes a bug (crash or error) or undefined behavior. label May 9, 2024
@TEParsons TEParsons added 📓 docs & demos Issue with documentation (typos, outdated, etc.) or demos. ▶️ good first issue labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior. 📓 docs & demos Issue with documentation (typos, outdated, etc.) or demos. ▶️ good first issue
Projects
None yet
Development

No branches or pull requests

2 participants