cicero icon indicating copy to clipboard operation
cicero copied to clipboard

Make it work locally with Windows

Open arnfinn opened this issue 7 years ago • 11 comments
trafficstars

I do not think it is possible at the moment.

How to test it (if you are on a Windows machine with Python 3.6 using Git Bash)

virtualenv venv
source venv/Scripts/activate # Scripts instead of bin on Windows...
pip install git+https://github.com/bast/cicero.git@master#egg=cicero
git clone [email protected]:arnfinn/presentasjoner.git
cicero --file presentasjoner/utf8.md --debug

Then go to http://127.0.0.1:5000/

arnfinn avatar Jun 05 '18 12:06 arnfinn

Error in this line in templates\render.html (see the whole traceback below):

{% include 'engines/' + engine + '/body.html' %}

It has probably something to do with how they do paths on windows.

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [05/Jun/2018 14:03:05] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "p:\venv\lib\site-packages\flask\app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "p:\venv\lib\site-packages\flask\app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "p:\venv\lib\site-packages\flask\app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "p:\venv\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "p:\venv\lib\site-packages\flask\app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "p:\venv\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "p:\venv\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "p:\venv\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "p:\venv\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "p:\venv\lib\site-packages\flask\app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "p:\venv\lib\site-packages\cicero\preview.py", line 59, in home
    engine=config['engine'])
  File "p:\venv\lib\site-packages\flask\templating.py", line 128, in render_template
    context, ctx.app)
  File "p:\venv\lib\site-packages\flask\templating.py", line 110, in _render
    rv = template.render(context)
  File "p:\venv\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "p:\venv\lib\site-packages\jinja2\environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "p:\venv\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "p:\venv\lib\site-packages\jinja2\_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "p:\venv\lib\site-packages\cicero\templates\render.html", line 20, in top-level template code
    {% include 'engines/' + engine + '/body.html' %}
  File "p:\venv\lib\site-packages\flask\templating.py", line 64, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: engines/remark-0.13.0/body.html
127.0.0.1 - - [05/Jun/2018 14:03:05] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
127.0.0.1 - - [05/Jun/2018 14:03:05] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
127.0.0.1 - - [05/Jun/2018 14:03:05] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
127.0.0.1 - - [05/Jun/2018 14:03:05] "GET /?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -
127.0.0.1 - - [05/Jun/2018 14:03:06] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -

arnfinn avatar Jun 05 '18 12:06 arnfinn

I will test it out on Azure - thanks for reporting.

bast avatar Jun 05 '18 12:06 bast

We have to play our cards right in this new Windows era :smile:

arnfinn avatar Jun 05 '18 12:06 arnfinn

Can you try the following:

  • download this repo as a zip file
  • extract
  • go in, and install requirements.txt into a venv
  • $ python cicero.py --file=...

Does this work? Because at least on Azure it worked then (but I got same error when serving from a clone). And the reason was that Windows did not understand symlinks. But I did not try in Git bash but rather from https://www.msys2.org.

bast avatar Jun 05 '18 15:06 bast

I will, tomorrow (only windows @ work).

Thanks for looking at this!

arnfinn avatar Jun 05 '18 16:06 arnfinn

If this works then I need to think what to do about the symlinks. Of course I can get rid of them with some code duplication if needed.

bast avatar Jun 06 '18 07:06 bast

I was not able to make it work.

arnfinn avatar Jun 06 '18 07:06 arnfinn

OK I need to test with Git bash then.

bast avatar Jun 06 '18 07:06 bast

Can we perhaps debug this together? Such an incredible struggle for me to get a Git bash going with Python.

bast avatar Jun 06 '18 20:06 bast

Alternative: can you try on https://www.msys2.org?

bast avatar Jun 06 '18 20:06 bast

I can try to have a look at it next week. It is not very important for me that it is working on Windows, so please do not struggle for me:)

arnfinn avatar Jun 07 '18 08:06 arnfinn