![]() makedirs ( folder ) # spit an error if we fail return True def isValidVariableName ( name ): """Checks whether a certain string could be used as a valid variable. is a valid folder) This should also check whether we have write-permissions to the folder but doesn't currently do that! added in: 1.90.00 """ folder = os. compile ( r '\W' ) # will match all bad var name chars def checkValidFilePath ( filepath, makeValid = True ): """Checks whether file path location (e.g. _version_ ) >= parse_version ( '2.4.0' ): # openpyxl moved get_column_letter to utils.cell from import get_column_letter else : from openpyxl.cell import get_column_letter from import load_workbook haveOpenpyxl = True except ImportError : haveOpenpyxl = False haveXlrd = False _nonalphanumeric_re = re. import os import re import ast import pickle import time, datetime import numpy as np import pandas as pd from collections import OrderedDict from pkg_resources import parse_version from psychopy import logging, exceptions from import pathToString from psychopy.localization import _translate try : import openpyxl if parse_version ( openpyxl. # Distributed under the terms of the GNU General Public License (GPL). I suspect I misused this function but have no idea how to fix it.#!/usr/bin/env python # -*- coding: utf-8 -*- # Part of the PsychoPy library # Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd. 'participant': f"",ĭlg = gui.fileOpenDlg(tryFilePath="pilotZone/participant_stimulus_sheet",tryFileName= ,prompt'Select file to open'= ,allowed=None)Įrror message: # Running: /Users/jamesabcd/Desktop/TLBX_experiment/pilotZone/TLBX_Alpha0510core.py #įile "/Users/jamesabcd/Desktop/TLBX_experiment/pilotZone/TLBX_Alpha0510core.py", line 44 ![]() # Store info about the experiment sessionĮxpName = 'TLBX_Alpha0510core' # from the Builder filename that created this script _thisDir = os.path.dirname(os.path.abspath(_file_)) # Ensure that relative paths start from the same directory as this script Import os # handy system and path functions Sqrt, std, deg2rad, rad2deg, linspace, asarray)įrom numpy.random import random, randint, normal, shuffle, choice as randchoice Import numpy as np # whole numpy lib is available, prepend 'np.'įrom numpy import (sin, cos, tan, log, log10, pi, average, STOPPED, FINISHED, PRESSED, RELEASED, FOREVER) ![]() My current code: # - Import packages -įrom psychopy import sound, gui, visual, core, data, event, logging, clock, colors, layoutįrom nstants import (NOT_STARTED, STARTED, PLAYING, PAUSED, If type(filesToOpen) = tuple: # some versions(?) of PyQt return (files, filter)įilesToOpen = [str(fpath) for fpath in filesToOpen If tryFilePath or tryFileName are empty or invalid thenĬurrent path and empty names are used to start search.įdir = os.path.join(tryFilePath, tryFileName)įilesToOpen = (parent=None, Prompt: string (default "Select file to open")Īllowed: string (available since v1.62.01)Į.g. """A simple dialogue allowing read access to the file system.ĭefault file path on which to open the dialog Prompt=_translate("Select file to open"), xlsx files are named "participant_stim1.xlsx, participant_." xlsx files are all in pilotZone/participant_stimulus_sheet folder.Īll the. py file is in folder "pilotZone" and my target. I am trying to use gui.fileOpenDlg() to create a dialog box that allows me to select the condition file (.xslx) before starting my experiment.
0 Comments
Leave a Reply. |