0

A NLP noob here.

I am trying to run some code that constructs a knowledge graph from unstructured text https://github.com/rutvik5/knowledge-graph on mac.

When running relation_extractor.py file, my mac terminal always returns:

PermissionError: [Errno 13] Permission denied: './process_large_corpus.sh'

The corresponding line is:

p = subprocess.Popen(['./process_large_corpus.sh',f,f + '-out.csv'],

I guess it has something to do with the subprocess.Popen() not working with shell scripts on mac?

Thanks

vicmerbia
  • 1
  • 2
  • What are the file permission of the script? If its own permissions are correct, what's the first shebang line, and what are the permissions of its stated interpreter and the dynamic libraries that interpreter requires? Executability requires `+x` permissions. – Charles Duffy May 09 '21 at 16:55
  • BTW, note that using a `.sh` extension on a script is not generally considered good practice. Executables shouldn't have any extension at all, just as you run `pip`, not `pip.py`, and `ls`, not `ls.elf` (on modern Linux, or `ls.mach-o` on MacOS, or `ls.dwarf` on ancient Linux). Using an extension means you can't rewrite your script to use a different interpreter without making its name misleading or forcing all users of the script to be updated with a new name. – Charles Duffy May 09 '21 at 16:56
  • @vicmerbia: Perhaps you did not give the right permission to the file. In the way you invoke the script, it needs read- and executeable permissions. Alternatively you can explicitly run it with `['sh', './process_large_corpus.sh', f, f + '-out.csv']`, in which case only read permission is needed (and `sh` must be in your PATH). – user1934428 May 10 '21 at 07:50

0 Answers0