Goodman-lab / DP5

Python workflow for DP5 and DP4 analysis of organic molecules
Other
174 stars 101 forks source link

TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str' #31

Closed edailing closed 4 years ago

edailing commented 4 years ago

I'm receiving the above error and the following traceback when attempting to run from the GUI:

Traceback (most recent call last): File "PyDP4_GUI.py", line 666, in get_current_values shutil.copyfile(f, self.settings.OutputFolder + os.path.sep + f) TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str' Abort trap: 6

This occurs when I include a structure, NMR directory, and output file with nwchem and tinker. If I omit the structure, I don't get the above error and instead see:

Segmentation fault: 11

Happy to provide more details as necessary. Thanks!

KristapsE commented 4 years ago

Ok, that is from today's update, I'll look into it. Should be an easy fix.

KristapsE commented 4 years ago

Ok, I was able to replicate it, and it seems to be gone after the fix I just pushed. Check the latest version from GitHub and let me know if there are still some issues remaining, or if I've broken something else in process.

edailing commented 4 years ago

Thanks! That fixed this issue. I'm getting another error that looks like it's related to tinker.

QLayout: Attempting to add QLayout "" to CalculationTab "", which already has a layout /bin/sh: /Users/.../DP4-AI/DP4-AI-master/sdf2tinkerxyz: cannot execute binary file Traceback (most recent call last): File "PyDP4_GUI.py", line 2130, in runPyDP4 self.NMRData, self.Isomers, self.settings, self.DP4Data = PyDP4.main(ui.table_widget.Tab1.settings) File "/Users/.../DP4-AI/DP4-AI-master/PyDP4.py", line 206, in main TinkerInputs = Tinker.SetupTinker(settings) File "/Users/.../DP4-AI/DP4-AI-master/Tinker.py", line 55, in SetupTinker outp = subprocess.check_output(convinp + inpf + '.sdf', shell=True) File "/opt/anaconda3/lib/python3.7/subprocess.py", line 411, in checkoutput **kwargs).stdout File "/opt/anaconda3/lib/python3.7/subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '/Users/.../DP4-AI/DP4-AI-master/sdf2tinkerxyz -k /Users/.../DP4-AI/DP4-AI-master/default.key <KE1.sdf' returned non-zero exit status 126. Abort trap: 6

The GUI closes immediately after I hit calculate. I've initially entered files into the GUI as shown here. I have the top level tinker and nwchem directories in /DP4-AI-master/. Do the .sdf and NMR files need to be in a particular directory? I also have them in /DP4-AI-master/.
Screen Shot 2020-05-12 at 4 16 09 PM

KristapsE commented 4 years ago

Ok, as you are running MacOS, then the most likely issue is that sdf2tinkerxyz in the DP4-AI folder is a Linux specific binary. You need to download MacOS compatible binary and copy it over. It can be found here: http://sdf2xyz2sdf.sourceforge.net/?Downloads

Probably not an issue in this case, but I would strongly suggest to keep the DP4-AI source folder unmodified, and for calculations make a fresh, empty folder outside DP4-AI folder. Then copy your sdf files and NMR data in there, cd in that folder and then launch PyDP4 or PyDP4_GUI. We have worked hard to ensure as much flexibility as possible in terms of file locations, but this convention is the best tested and keeps your files organised, and avoids one run interfering with the next one.

edailing commented 4 years ago

I was able to find the sdf2tinkerxyz from the link and copy it to the DP4-AI source, but running PyDP4_GUI returns: /bin/sh: /DP4-AI/Output/sdf2tinkerxyz: No such file or directory If I copy sdf2tinkerxyz to /Output, it returns: /bin/sh: /DP4-AI/Output/sdf2tinkerxyz: Bad CPU type in executable

I tried to copy the sdf and NMR files to a new folder outside DP4-AI, cd into that folder and launch PyDP4_GUI, but that doesn't work because I'm outside the DP4-AI source. Can you clarify these instructions? Thank you!

KristapsE commented 4 years ago

Did you download the file for MacOS? I just had a look - the files haven't been updated in a while, so it is possible that Mac no longer supports that old executables. If that utility no longer works, then I'm afraid there are no easy options for TINKER on Mac. You could try to compile sdf2tinkerxyz from source on Mac, or write a Python script that replicates sdf2tinkerxyz functionality. Neither impossible, but both would involve some effort and troubleshooting, so probably not straightforward for the general user.

Probably the easiest approach at this point would be to get a Linux virtual machine running on your computer - we know both DP4-AI and TINKER work fine on that platform.

You can always launch a script from from any folder by typing python /path/to/DP4-AI/folder/PyDP4_GUI.py I'm still stuck in the mindset of using it from command line. Actually where you launch the GUI from isn't particularly important, my point was that it is a good idea to isolate computational files each in their own folder.

edailing commented 4 years ago

Ok, that all makes sense! Giving it a go on Linux now. I think this closes my current issues. Thanks so much for your help!