Git window opens when running experiment

OS (e.g. Win10):
Windows 11

PsychoPy version (e.g. 1.84.x):
2022.1.4’

Standard Standalone? (y/n) If not then what?:
Yes

What are you trying to achieve?:
Run PsychoPy Builder experiment without a git command window opening.

What did you try to make it work?:
Poked in the PsychoPy source.

What specifically went wrong when you tried that?:
Found the offending source in psychopy/init.py.

When I run an experiment created in the Builder, a git command window pops up.

It appears that this is happening because of the following code in psychopy/init.py:

# for developers the following allows access to the current git sha from
# their repository
if __git_sha__ == 'n/a':
    from subprocess import check_output, PIPE
    # see if we're in a git repo and fetch from there
    try:
        thisFileLoc = os.path.split(__file__)[0]
        output = check_output(['git', 'rev-parse', '--short', 'HEAD'],
                              cwd=thisFileLoc, stderr=PIPE)
    except Exception:
        output = False
    if output:
        __git_sha__ = output.strip()  # remove final linefeed

Is there any way to prevent this? Is there a flag I can set somewhere to specify that I’m not running from a repo?

Thanks for the awesome tool, and the great community involvement!

I think you haven’t installed PsychoPy using any of the recommended methods (pip or Standalone). If you do that then __git_sha__ gets set a fixed value during building, so that we know the exact state of the code in the project history.

I’m guessing you’ve downloaded the files from the repo and just dragged them into you python installation, or something like that, so PsychoPy is doing some checking to see what’s going on (which is by design).

If you really need to use PsychoPy without installing an actual version, then you could try running with pythonw instead of python which may be successful in blocking the visual appearance of the window (but won’t change the call to use it)

Jon

Thanks for the reply Jon.

I installed PsychoPy using pip on a fresh Python 3.8 installation on Windows 11. Can I set that flag manually? If so, what should it be set to?