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

Confusing error message if rsync is not installed #35

Open
LiaungYip opened this issue Jan 26, 2015 · 2 comments
Open

Confusing error message if rsync is not installed #35

LiaungYip opened this issue Jan 26, 2015 · 2 comments

Comments

@LiaungYip
Copy link

On Windows, running Markdoc without rsync installed causes the following confusing error message to be displayed:

PS C:\Users\lws\Documents\GitHub\morrowind-dnd3.5> markdoc build
Traceback (most recent call last):
  File "C:\Python27\Scripts\markdoc-script.py", line 9, in <module>
    load_entry_point('Markdoc==0.6.6', 'console_scripts', 'markdoc')()
  File "C:\Python27\lib\site-packages\markdoc\cli\main.py", line 38, in main
    return command(config, args)
  File "C:\Python27\lib\site-packages\markdoc\cli\commands.py", line 29, in wrapper
    return function(config, args)
  File "C:\Python27\lib\site-packages\markdoc\cli\commands.py", line 270, in build
    sync_html(config, args)
  File "C:\Python27\lib\site-packages\markdoc\cli\commands.py", line 29, in wrapper
    return function(config, args)
  File "C:\Python27\lib\site-packages\markdoc\cli\commands.py", line 238, in sync_html
    subprocess.check_call(command)
  File "C:\Python27\lib\subprocess.py", line 535, in check_call
    retcode = call(*popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

If we run with the --verbose option we can see this is just after the Markdoc attempts to call rsync which is not installed.

markdoc.sync-html: DEBUG: rsync -vaxq --cvs-exclude --delete --ignore-errors --include=.htaccess --exclude=.* --exclude=_* .tmp/ default-static/ static/ .html/

Markdoc should trap this exception and produce a more useful error message, such as OSError: rsync not installed or could not be found.


Actually it's even worse than this; I do have rsync installed (via cwRsync) but Python can't find it. This is a Windows specific bug. The problem is at commands.py:238 where subprocess.check_call() is called with the default argument of shell=False. To quote from Walter Mundt's StackOverflow answer - "Also, on Windows with shell=False, it pays no attention to PATH at all, and will only look in relative to the current working directory". So even though rsync is on my path, Python on Windows can't find it.

@snoozbuster
Copy link

Aha! I was wondering why this was happening. Enlightening.

@snoozbuster
Copy link

I know this is pretty old, but I forked this project and rewrote the sync stuff in pure Python; as it turns out there's a bug in make_relative at render.py:35 that causes relative resolution to fail on Windows for source files due to differing path separators. So even with rsync, building wouldn't have worked properly.

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

2 participants