Hello all,
I’m trying to make a script more generic so it can be run on a Mac while created on a windows (I know I could just change the path manually but I would like a better option).
To do so I’m using the pathlib command but running into issues.
Here is what I have done so far in the coder. in italics are the output from each line:
home = str(Path.home())
*** '/Users/myname' ***
conditionmixer_folder = PureWindowsPath(“\Box\Folder\SubStudy3\conditionmixer\”)
*** PureWindowsPath('/Box/Folder/SubStudy3/conditionmixer') ***
path_on_mac = Path(conditionmixer_folder)
PosixPath(‘\/Box/Folder/SubStudy3_Neurofeedback/Hannah/conditionmixer’)
and then I try generating a path to make it work on the Mac (that includes other options):
listvariable.append({“condfile”:home + str(path_on_mac) + hehe.get(“condfile”)})
it does not work because cannot find the file:
ValueError: Conditions file not found: /Users/beynellc/Box/Folder/SubStudy3_Neurofeedback/conditionmixercond3animal.xlsx
I noticed that there is a backward and forward slashes joining home and the path.
when I looked at the output of str(path_on_mac) I’m getting
***'\\/Box/Folder/SubStudy3_Neurofeedback/conditionmixer'***
and there is still \/ do you know how I can get rid of that?
Thank you !