AttributeError: module ‘platform’ has no attribute ‘mac_ver’

I’ve never seen this error before and not quite sure how to debug it. Below is the log from when I try to run the experiment. It seems to be an issue with the locale_setup.py file when I import the platform package. All of my other psychopy experiments work fine. I even tried recreating this one as a new psyexp and I still get the same error. Any ideas on what I’m doing wrong? Please let me know if there is anything else I can provide that would help!

Note: I have not updated Psychopy from the version I always use (3.1.5) and I have not updated my OS or any software recently.

Error:
# Running: /Volumes/psych-cog/bamlab/Experiments/AEPETv2/math/math_lastrun.py ##
Traceback (most recent call last):
  File "/Volumes/psych-cog/bamlab/Experiments/AEPETv2/math/math_lastrun.py", line 14, in <module>
    from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/__init__.py", line 44, in <module>
    from psychopy.preferences import prefs
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/preferences/__init__.py", line 13, in <module>
    from . import preferences as prefsLib
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/preferences/preferences.py", line 9, in <module>
    import platform
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "platform.pyc", line 116, in <module>
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "subprocess.pyc", line 138, in <module>
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "selectors.pyc", line 10, in <module>
  File "/Volumes/psych-cog/bamlab/Experiments/AEPETv2/math/math.py", line 14, in <module>
    from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/locale_setup.py", line 23, in <module>
    macVer = platform.mac_ver()[0]  # e.g., '10.9.5' or '' for non-Mac
AttributeError: module 'platform' has no attribute 'mac_ver'

It seems the “wrong” platform module is being accessed. Do you by any chance have a Python file named platform.py in the same folder as your experiment? If yes, rename it. Otherwise, you can try the following to figure out which module is being loaded: in your experiment folder, create a Python script with the following content:

import platform
print(platform.__file__)

and run it. This should print the file system path of the platform module Python is using.