PHP exec()将不会执行

I am writing a php file that will take in a word, and then display the synonyms of that word using Wordnet. I am calling a Python script using

exec("python script.py word", $output, $val);

Except, the return value is 1, meaning did not find. The file is in the same folder, I can even run it in the terminal just fine, albeit give it a few seconds.

Here is the Python script:

from nltk.corpus import wordnet as wn
import sys

arg = sys.argv[1]

def synset(word):
   synonyms, synAll, synAllSplit = ([] for i in range(3))
   for i,j in enumerate(wn.synsets(word)):
      word = " ".join(j.lemma_names())
      synonyms.append(word)

   for word in synonyms:
      synAll.append(str(word))

   for word in synAll:
      split = word.split()
      for s in split:
         synAllSplit.append(s)

   return synAllSplit


synonyms = synset(arg)
print synonyms