sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
524 stars 75 forks source link

sphinx-autobuild does not work on WIndows: can't rebuild file on change #27

Closed bialix closed 9 years ago

bialix commented 9 years ago

I've installed Sphinx 1.3.1 and sphinx-autobuild 0.5 via pip to python 3.3 32 bit on my windows. Run it with command: D:\work\Opensource\intelhex\docs\manual>C:\Python\3.3-32\Scripts\sphinx-autobuild.exe . .build/html

Then started to edit part1-1.txt and got in the console:

+--------- part1-1.txt changed -------------------------------------------------- Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python\3.3-32\lib\subprocess.py", line 1104, in _execute_child startupinfo) FileNotFoundError: [WinError 2] Can't find specified file

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python\3.3-32\lib\threading.py", line 901, in _bootstrap_inner self.run() File "C:\Python\3.3-32\lib\site-packages\watchdog\observers\api.py", line 199, in run self.dispatch_events(self.event_queue, self.timeout) File "C:\Python\3.3-32\lib\site-packages\watchdog\observers\api.py", line 368, in dispatch_events handler.dispatch(event) File "C:\Python\3.3-32\lib\site-packages\watchdog\events.py", line 322, in dispatch self.on_any_event(event) File "C:\Python\3.3-32\lib\site-packages\sphinx_autobuildinit.py", line 41, in on_any_event getattr(event, 'dest_path', event.src_path)) File "C:\Python\3.3-32\lib\site-packages\sphinx_autobuildinit.py", line 132, in call self.build(path) File "C:\Python\3.3-32\lib\site-packages\sphinx_autobuildinit.py", line 150, in build universal_newlines=True).stdout File "C:\Python\3.3-32\lib\subprocess.py", line 819, in init restore_signals, start_new_session) File "C:\Python\3.3-32\lib\subprocess.py", line 1110, in _execute_child raise WindowsError(*e.args) FileNotFoundError: [WinError 2] Can't find specified file

ANy idea which file it wanted to execute? There is sphinx-build.exe in the same directory as sphinx-autobuild.exe, but it's not in the path.

bialix commented 9 years ago

I've tried to execute sphinx-autobuild.exe from the Scripts directory where it's installed, providing full path to my docs sources and html directories, but anyway, no luck with re-build of the docs, now I have different error:

Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python\3.3-32\lib\threading.py", line 901, in _bootstrap_inner self.run() File "C:\Python\3.3-32\lib\site-packages\watchdog\observers\api.py", line 199, in run self.dispatch_events(self.event_queue, self.timeout) File "C:\Python\3.3-32\lib\site-packages\watchdog\observers\api.py", line 368, in dispatch_events handler.dispatch(event) File "C:\Python\3.3-32\lib\site-packages\watchdog\events.py", line 322, in dispatch self.on_any_event(event) File "C:\Python\3.3-32\lib\site-packages\sphinx_autobuildinit.py", line 41, in on_any_event getattr(event, 'dest_path', event.src_path)) File "C:\Python\3.3-32\lib\site-packages\sphinx_autobuildinit.py", line 122, in call path = self.get_relative_path(src_path) File "C:\Python\3.3-32\lib\site-packages\sphinx_autobuildinit.py", line 169, in get_relative_path return os.path.relpath(path) File "C:\Python\3.3-32\lib\ntpath.py", line 564, in relpath raise ValueError(error) ValueError: path is on mount 'D:', start on mount 'C:'

bialix commented 9 years ago

I don't know why you need relative path, but this won't work on windows with its filesystem when there is more than 1 drive present.

bialix commented 9 years ago

OK, it seems the only way to make it work:

GaretJax commented 9 years ago

We could probably make this better by allowing the user to specify/configure the path to the sphinx-build executable: https://github.com/GaretJax/sphinx-autobuild/blob/develop/sphinx_autobuild/__init__.py#L145