Django“错误:无法导入名称转义”在窗户上

发布于 2024-08-24 03:29:53 字数 304 浏览 3 评论 0原文

由于此错误(“错误:无法导入名称转义”),我无法运行开发服务器。

我认为这是因为我对项目所做的修改,但我不知道如何找到错误的根源来修复它。

我不会在任何地方导入任何称为“逃逸”的东西。

更新

使用django-admin.py而不是项目manage.py,不知道为什么......

更新2

现在manage.py正在工作。这可能是因为我有一个名为 email.py 的文件,它试图导入 email.mime.text (即尝试导入自身),重命名为 sendemail.py 解决了这个问题。

I cannot run the dev server because of this error ("Error: cannot import name escape").

I assume its because of modifications I've done to the project, but i have no idea how to find where the error is originating from to fix it.

I don't import anything called escape anywhere.

Update

Using django-admin.py rather than the projects manage.py, don't know why...

Update 2

Now manage.py is working. This may be because I had a file called email.py which was trying to import email.mime.text (ie trying to import itself) renaming to sendemail.py solved this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故人如初 2024-08-31 03:29:53

你是对的,这是你的 email.py。删除它可以解决您的问题。这不是 Windows 特有的问题,因为我在 Ubuntu 上也遇到了同样的问题。

您可以通过执行“touch email.py”或使用文本编辑器创建空的 email.py 文件来复制此错误。

我也遇到了同样的问题,你的笔记给了我提示。它似乎突然开始发生。我有几个毫无意义的 .py 文件,其中一个名为 email.py。它并没有试图进口自己或任何东西。我只是将其命名为电子邮件,因为我打算将其通过电子邮件发送给某人。我摆脱了它(和 .pyc),现在一切正常了。我不知道 email.py 有什么特别之处,但这确实是问题所在。

You are correct that it was your email.py. Deleting it will fix your problem. This is not a Windows specific problem as I had the same problem on Ubuntu.

You can duplicate this error by doing "touch email.py" or using a text editor to create an empty email.py file.

I had this same problem and your notes tipped me off. It seemed to start occurring out of nowhere. I have several pointless .py files sitting around and one of them was named email.py. It was not trying to import itself or anything. I only named it email because I was planning on emailing it to someone. I got rid of it (and the .pyc) and now everything works. I don't know what is special about email.py, but that was indeed the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文