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

修复 windows 平台 sea new 会报错的问题 #160

Closed
wants to merge 1 commit into from
Closed

修复 windows 平台 sea new 会报错的问题 #160

wants to merge 1 commit into from

Conversation

LKI
Copy link

@LKI LKI commented Apr 22, 2020

原报错信息:

Traceback (most recent call last):
  File "C:\Users\liriansu\.virtualenvs\poseidon-tt7N4OpO\Scripts\sea-script.py", line 11, in <module>
    load_entry_point('sea==2.2.0', 'console_scripts', 'sea')()
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\sea-2.2.0-py3.8.egg\sea\cli.py", line 113, in main
    return _run(root)
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\sea-2.2.0-py3.8.egg\sea\cli.py", line 100, in _run
    return handler(**kwargs)
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\sea-2.2.0-py3.8.egg\sea\cmds.py", line 129, in new
    _gen_project(path, skip=_build_skip_files(extra), ctx=ctx)
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\sea-2.2.0-py3.8.egg\sea\cmds.py", line 117, in _gen_project
    tmpl = env.get_template(relfn)
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\jinja2\environment.py", line 883, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\jinja2\environment.py", line 857, in _load_template
    template = self.loader.load(self, name, globals)
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\jinja2\loaders.py", line 115, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\jinja2\loaders.py", line 177, in get_source
    pieces = split_template_path(template)
  File "c:\users\liriansu\.virtualenvs\poseidon-tt7n4opo\lib\site-packages\jinja2\loaders.py", line 32, in split_template_path
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: app\async_tasks.py.tmpl

因为在 jinja2/loaders.py 中使用的是 / 分隔符,windows 上用的是 \ 分隔符。
而 jinja 的哲学是统一都 replace 为 /……(这个风格不一定对,但他的项目 api 都这样)

所以我们调用的时候先修一下 :)

closes #132

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 93.81% when pulling 2607827 on LKI:fix/windows-jinja into b906ef9 on shanbay:master.

@LKI LKI closed this Apr 22, 2020
@LKI
Copy link
Author

LKI commented Apr 22, 2020

😉 我开一个 fork 分支支持一下 windows

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

Successfully merging this pull request may close these issues.

为什么执行sea new helloworld 报错呢?
2 participants