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

test/spec_tests.py --program error #345

Closed
XAMPPRocky opened this issue Jul 4, 2015 · 8 comments
Closed

test/spec_tests.py --program error #345

XAMPPRocky opened this issue Jul 4, 2015 · 8 comments

Comments

@XAMPPRocky
Copy link

running python test/spec_tests.py --program program.exe

Traceback (most recent call last):
  File "test/spec_tests.py", line 134, in <module>
    do_test(test, args.normalize, result_counts)
  File "test/spec_tests.py", line 39, in do_test
    [retcode, actual_html, err] = cmark.to_html(test['markdown'])
  File "G:\commonmark\test\cmark.py", line 22, in <lambda>
    self.to_html = lambda x: pipe_through_prog(prog, x)
  File "G:\commonmark\test\cmark.py", line 9, in pipe_through_prog
    p1 = Popen(prog.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE)
  File "C:\Python34\lib\subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Python Version: 3.4.3
OS: Windows 7 Ultimate

@jgm
Copy link
Member

jgm commented Jul 4, 2015

Is program.exe in your working directory? The argument to
--program is the path to the program. It's not enough if
program.exe is in your system PATH.

+++ Aaron Power [Jul 04 15 02:55 ]:

running python test/spec_tests.py --program program.exe
Traceback (most recent call last):
File "test/spec_tests.py", line 134, in
do_test(test, args.normalize, result_counts)
File "test/spec_tests.py", line 39, in do_test
[retcode, actual_html, err] = cmark.to_html(test['markdown'])
File "G:\commonmark\test\cmark.py", line 22, in
self.to_html = lambda x: pipe_through_prog(prog, x)
File "G:\commonmark\test\cmark.py", line 9, in pipe_through_prog
p1 = Popen(prog.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE)
File "C:\Python34\lib\subprocess.py", line 859, in init
restore_signals, start_new_session)
File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Python Version: 3.4.3
OS: Windows 7 Ultimate


Reply to this email directly or [1]view it on GitHub.

References

  1. test/spec_tests.py --program error #345

@XAMPPRocky
Copy link
Author

That worked, however I receive the following error, on example three. Seems to be the same problem as #344. Also what is being passed to the program? Mine is responding with no free arguments error. Is passing the test as a flag? What is the spec-tests.py also expecting to be returned?

Traceback (most recent call last):
  File "test/spec_tests.py", line 134, in <module>
    do_test(test, args.normalize, result_counts)
  File "test/spec_tests.py", line 55, in do_test
    sys.stdout.write(test['markdown'])
  File "C:\Python34\lib\encodings\cp437.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u1f50' in position 13: character maps to <undefined>

jgm added a commit that referenced this issue Jul 4, 2015
@jgm
Copy link
Member

jgm commented Jul 4, 2015

See if the latest push helps with the unicode error.
Note, however, that now I'm forcing output as UTF-8, which
probably won't look right in your Windows console. There's
probably a better approach.

spec_test.py feeds your program the Markdown test input as UTF-8
encoded bytes, and expects it to give HTML output as UTF-8
encoded bytes.

+++ Aaron Power [Jul 04 15 10:40 ]:

That worked however, I receive the following error, on example three.
Seems to be the same problem as [1]#344. Also what is being passed to
the program? Mine is responding with no free arguments error. Is
passing the test as a flag? What is the spec-tests.py also expecting to
be returned?
Traceback (most recent call last):
File "test/spec_tests.py", line 134, in
do_test(test, args.normalize, result_counts)
File "test/spec_tests.py", line 55, in do_test
sys.stdout.write(test['markdown'])
File "C:\Python34\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u1f50' in position
13: character maps to


Reply to this email directly or [2]view it on GitHub.

References

  1. test/spec_tests.py not working #344
  2. test/spec_tests.py --program error #345 (comment)

@XAMPPRocky
Copy link
Author

I checked the printing on cmder, Powershell, and cmd, and it seemed fine. However printing out the argument list, shows nothing being passed to the program.

Example:

Example 184 (lines 2999-3011) List items
  10.  foo

           bar
--- expected HTML
+++ actual HTML
@@ -1,7 +1,3 @@
-<ol start="10">
-<li>
-<p>foo</p>
-<pre><code>bar
-</code></pre>
-</li>
-</ol>
+["G:\\rust-e\\target\\debug\\rust_e.exe"]
+ERROR:
+You must provide a file, or folder path as an argument.

The last three lines are from my program, the first being a printout of the argument list. The 2 being a self made error if nothing is passed to the program.

@cebe
Copy link
Contributor

cebe commented Jul 4, 2015

afaik the markdown is sent to the program using pipes not using a filename argument.

@XAMPPRocky
Copy link
Author

The actual comment isn't important, it fails when there is no arguments passed in. And the line above it shows that when the program has started it doesn't think it has gotten any arguments.

@cebe
Copy link
Contributor

cebe commented Jul 4, 2015

that is what I wrote above, the program will not get any arguments, it will get the content piped to STDIN.

on unix terminal this would look like this:

echo "markdown" | yourprogram.exe

no idea how that works on windows though.

@XAMPPRocky
Copy link
Author

Ah, yes I was only taking in from environment variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants