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

使用报错 #54

Open
FynnFbc opened this issue Nov 8, 2022 · 25 comments
Open

使用报错 #54

FynnFbc opened this issue Nov 8, 2022 · 25 comments

Comments

@FynnFbc
Copy link

FynnFbc commented Nov 8, 2022

AttributeError: module 'asyncio' has no attribute 'coroutine'. Did you mean: 'coroutines'?
image

@lixxu
Copy link
Owner

lixxu commented Nov 9, 2022

这是因为3.11 移除了 asyncio.coroutine, 后面看看怎么兼容一下

@FynnFbc
Copy link
Author

FynnFbc commented Nov 9, 2022

非常感谢大佬

@lixxu
Copy link
Owner

lixxu commented Nov 10, 2022

新版本应该解决了这个问题, 试试吧.

@FynnFbc
Copy link
Author

FynnFbc commented Nov 10, 2022

出现了如下错误
image

@FynnFbc
Copy link
Author

FynnFbc commented Nov 10, 2022

image

@lixxu
Copy link
Owner

lixxu commented Nov 10, 2022

没有jinja.init_app()

@FynnFbc
Copy link
Author

FynnFbc commented Nov 10, 2022

image

@lixxu
Copy link
Owner

lixxu commented Nov 10, 2022

这个是新版jinja2的问题,issue里有提到,你去翻一下看看。

@FynnFbc
Copy link
Author

FynnFbc commented Nov 10, 2022

必须降级jinja2版本吗?

@lixxu
Copy link
Owner

lixxu commented Nov 10, 2022

这里跟你的问题一样的,#42

@lixxu
Copy link
Owner

lixxu commented Nov 11, 2022

试试 jinja.init_app(app, pkg_name="RandomImg")

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

还是无法解决
image

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

我看之前提到的issue 是进行降级,本来就是用新特性,降级就没意义了

@lixxu
Copy link
Owner

lixxu commented Nov 11, 2022

你方便把程序发我一下不? 我本地调试一下看看.

@lixxu
Copy link
Owner

lixxu commented Nov 11, 2022

不用了, 我在调试.

@lixxu
Copy link
Owner

lixxu commented Nov 11, 2022

手动传一个 loader 作参数, 类似这样.


from jinja2 import FileSystemLoader

loader = FileSystemLoader("templates")
jinja = SanicJinja2(app, loader=loader)

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

好的,谢谢大佬

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

那你的包可以添加loader选项吗?
比如这个
image

@lixxu
Copy link
Owner

lixxu commented Nov 11, 2022

什么是添加loader选项?

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

你这里不是只有默认的这个?
image
希望能加上这个
image
对于大多数人来说这个更为方便,更简单

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

大多数是从flask,django过来的吧

@lixxu
Copy link
Owner

lixxu commented Nov 11, 2022

稍等我发一个新版, 在PackageLoader失败后使用FileSystemLoader

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

好的,非常感谢

@lixxu
Copy link
Owner

lixxu commented Nov 11, 2022

已发, 请试试吧.

@FynnFbc
Copy link
Author

FynnFbc commented Nov 11, 2022

可以正常使用了,非常感谢

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