bmeaut / python_nlp_2018_spring

MIT License
8 stars 10 forks source link

Issue in the test part #13

Closed Dudly01 closed 6 years ago

Dudly01 commented 6 years ago

Hi,

I am currently experiencing this strange issue regarding the third homework. When running the first test: # Test nominative test_compile(esperanto_1, 'esperanto_1.fst') words_valid('esperanto_1.fst', ['hundo', 'kato', 'birdo', 'elefanto']) words_invalid('esperanto_1.fst', ['hund', 'kata', 'bird', 'elefantoo'])

I get the following error: Can you please tell me what could the problem be?


CalledProcessError Traceback (most recent call last)

in test_compile(grammar, fst_file) 4 os.unlink(fst_file) ----> 5 compile_lexc(grammar, fst_file) 6 assert True
in compile_lexc(lexc_string, fst_file) 37 execute_commands('read lexc {}'.format(outf.name), ---> 38 'save stack {}'.format(fst_file), fancy=False) 39 #!foma -e "read lexc {outf.name}" -e "save stack {fst_file}" -s in execute_commands(fancy, *cmds) 23 stderr=subprocess.STDOUT, ---> 24 shell=True).decode('utf-8') 25 print(output) ~\Anaconda3\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs) 335 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, --> 336 **kwargs).stdout 337 ~\Anaconda3\lib\subprocess.py in run(input, timeout, check, *popenargs, **kwargs) 417 raise CalledProcessError(retcode, process.args, --> 418 output=stdout, stderr=stderr) 419 return CompletedProcess(process.args, retcode, stdout, stderr) CalledProcessError: Command 'foma -e "read lexc C:\Users\ANDRIS~1\AppData\Local\Temp\tmp3ey5auye" -e "save stack esperanto_1.fst" -s' returned non-zero exit status 1. During handling of the above exception, another exception occurred: AssertionError Traceback (most recent call last) in () 1 # Test nominative ----> 2 test_compile(esperanto_1, 'esperanto_1.fst') 3 words_valid('esperanto_1.fst', ['hundo', 'kato', 'birdo', 'elefanto']) 4 words_invalid('esperanto_1.fst', ['hund', 'kata', 'bird', 'elefantoo']) in test_compile(grammar, fst_file) 6 assert True 7 except Exception as e: ----> 8 assert False, 'Got exception: {}'.format(e) 9 10 def words_valid(fst_file, words, up=True): AssertionError: Got exception: Command 'foma -e "read lexc C:\Users\ANDRIS~1\AppData\Local\Temp\tmp3ey5auye" -e "save stack esperanto_1.fst" -s' returned non-zero exit status 1.
Dudly01 commented 6 years ago

One thing that I found strange is that the Temp folder is not located there, as my username is not ANDRIS~1. The Temp is located at: C:\Users\Andris-W520\AppData\Local\Temp

Dudly01 commented 6 years ago

I have also committed my current notebook to my git.

DavidNemeskey commented 6 years ago

There must be some problem with your setup, because your notebook runs completely fine on my machine.

A few things to check:

Also, I am not a Windows expert, but as far as I know, in "DOS" mode (?), where file names can only be 8+3 characters long, Andris-W520 might become ANDRIS~1. You should check if the two paths point to the same directory.

Dudly01 commented 6 years ago

The path C:\Users\ANDRIS~1\AppData\Local\Temp point to the same directory as C:\Users\Andris-W520\AppData\Local\Temp foma is not among the installed packages (Am i correct in assumin it is a package?)

DavidNemeskey commented 6 years ago

No, it is not a package, but a separate (C) library. You can download it from its GitHub page. Alternatively, install Docker on your machine, and download the same image we used during the lab -- we have preinstalled foma for you there.

Dudly01 commented 6 years ago

I couldn't get it to work on windows, so I changed to ubuntu.