Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executable paths not found #18

Closed
hlasimpk opened this issue Sep 2, 2018 · 6 comments
Closed

Executable paths not found #18

hlasimpk opened this issue Sep 2, 2018 · 6 comments
Labels

Comments

@hlasimpk
Copy link
Collaborator

hlasimpk commented Sep 2, 2018

System information

  • PyJob version: 0.2.0
  • Python version: ccp4-python
  • Environment (if applicable): CCP4

Problem description

When running cexec I get a PyJobExecutableNotFoundError.

This seems to come from the line in cexec:

if not os.path.isfile(cmd[0]):
        raise PyJobExecutableNotFoundError('Cannot find executable: %s' % cmd[0])

Commenting the line out bypasses the problem. At first glance the error appears to arise because we're giving just the executable name rather than the full path to the executable. Therefore it searches the directory you're running the job in for the executable.

Example

#!/usr/bin/env ccp4-python

import cexec
from pyjob.platform import EXE_EXT

stdout = cexec(['pdbcur' + EXE_EXT], permit_nonzero=True)

Traceback

     stdout = cexec(['pdbcur' + EXE_EXT], permit_nonzero=True)
cexec
   raise PyJobExecutableNotFoundError('Cannot find executable: %s' % cmd[0])
PyJobExecutableNotFoundError: Cannot find executable:  pdbcur.exe
@hlasimpk
Copy link
Collaborator Author

hlasimpk commented Sep 2, 2018

Hmm, i'm also getting an error after this point where the MR log file can't be found, again using os.path.isfile(), despite the fact that the log file exists.

@fsimkovic fsimkovic added the bug label Sep 2, 2018
@fsimkovic
Copy link
Owner

Thanks for reporting the issue. Could you try in SIMBAD to add the full path for pdbcur.exe to see if it resolves the issue? I could try and infer the absolute path in pyjob with os.path.abspath but that does not guarantee to find what you’re looking for.

@hlasimpk
Copy link
Collaborator Author

hlasimpk commented Sep 2, 2018

Can confirm that giving the full path to the pdbcur executable does work, and that using os.path.abspath doesn't. We could add a note to cexec explaining that the full path is needed for windows or alternatively we could remove the call to check that the executable is a file and raise an error when the job fails.

@fsimkovic
Copy link
Owner

fsimkovic commented Sep 2, 2018

Okay, that's good to know. Could you try the following:

$ ccp4-python
>>> import subprocess
>>> subprocess.call(['pdbcur.exe'])
 
 ###############################################################
 ###############################################################
 ###############################################################
 ### CCP4 7.0.061: PDBCUR           version 7.0.061 :         ##
 ###############################################################
 User: felix  Run date:  2/ 9/2018 Run time: 21:30:46 


 Please reference: Collaborative Computational Project, Number 4. 2011.
 "Overview of the CCP4 suite and current developments". Acta Cryst. D67, 235-242.
 as well as any specific reference in the program write-up.

 ***** ERROR #43 READ:

 Logical file name not found.

1

This should print something like above to STDOUT, could you please confirm?

Note, do not use the absolute path.

@hlasimpk
Copy link
Collaborator Author

hlasimpk commented Sep 2, 2018

Can confirm that it prints out Logical file name not found

@fsimkovic fsimkovic added invalid and removed bug labels Sep 2, 2018
@hlasimpk
Copy link
Collaborator Author

hlasimpk commented Sep 2, 2018

Tested 494d508 on windows and the full executable path is now being found.

@hlasimpk hlasimpk closed this as completed Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants