eudicots / Cactus

Static site generator for designers. Uses Python and Django templates.
BSD 3-Clause "New" or "Revised" License
3.47k stars 314 forks source link

Exception on file changed reload #108

Open macedd opened 9 years ago

macedd commented 9 years ago

When I change a file, cactus serve triggers and action and rebuild the code, but apparently is not able to reload the browser.

Cactus 2 @ Osx 10.6 and Safari (python 2.6.1)

Unhandled exception in thread started by <bound method Listener._loop of <cactus.listener.Listener object at 0x101927550>>
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/Cactus-2.3.1-py2.6.egg/cactus/listener.py", line 53, in _loop
    self._run()
  File "/Library/Python/2.6/site-packages/Cactus-2.3.1-py2.6.egg/cactus/utils.py", line 164, in f_retry
    return f(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/Cactus-2.3.1-py2.6.egg/cactus/listener.py", line 81, in _run
    self.f(result)
  File "/Library/Python/2.6/site-packages/Cactus-2.3.1-py2.6.egg/cactus/site.py", line 232, in rebuild
    browserReloadCSS('http://127.0.0.1:%s' % port)
  File "/Library/Python/2.6/site-packages/Cactus-2.3.1-py2.6.egg/cactus/browser.py", line 110, in browserReloadCSS
    _insertJavascript(url, s4)
  File "/Library/Python/2.6/site-packages/Cactus-2.3.1-py2.6.egg/cactus/browser.py", line 96, in _insertJavascript
    apps = appsRunning(['Safari', 'Google Chrome'])
  File "/Library/Python/2.6/site-packages/Cactus-2.3.1-py2.6.egg/cactus/browser.py", line 113, in appsRunning
    psdata = subprocess.check_output(['ps aux'], shell=True)
AttributeError: 'module' object has no attribute 'check_output'
krallin commented 9 years ago

Can you try and update to Python 2.7? (e;g. you can install it via Homebrew, and use that / create a virtualenv)

check_output was introduced in Python 2.7, which is why you're seeing this issue.

@koenbok — if you decide to backport this for compatibility with Python 2.6, here's a backport of check_output:

https://github.com/Scalr/installer-ng/blob/0d622c57b44eb1dc01dd4c3e8d114c483b6f1232/wrapper/scalr-manage/scalr_manage/library/install/util/python.py#L31-L45

fedelibre commented 9 years ago

I can confirm this behaviour on linux and python 2.7 This is where cactus is installed: /usr/local/lib/python2.7/dist-packages/cactus

I'm just testing cactus for the first time and I did not create a virtualenv yet. When I save an html page, I see that the pages are rebuilt, but Chromium does not refresh automatically. I'm using chromium version 41.0.2272.76-2 from debian sid repository.

fedelibre commented 9 years ago

I cannot reproduce it anymore in Chromium 43.0.2357.130: reload works instantly as soon as the file is saved.