pythonsubprocessplagiarism-detection

Using sherlock to check for plagiarism through python subprocess module


When i write on terminal:

./sherlock *.txt

it works

but when I try to do the same using python subprocess like

import subprocess 
subprocess.call(['./sherlock','*.txt'])


import subprocess
subprocess.call('./sherlock','*.txt',shell=True)

import subprocess
subprocess.call('./sherlock','*.txt',shell=False)

Neither of this is working please help.


Solution

  • Shell expand *, subprocess.call does not. Expand the * yourself using glob.glob.

    And beside that, the argument that represent the command to be issued should be a list or a string object (not multiple arguments).

    import glob
    import subprocess
    subprocess.call(['./sherlock'] + glob.glob('*.txt'), shell=False)