在Django,我有一个"fbsurvey"项目,带有"画布"应用程序.
我有另一个"cblib"项目,有一个"调查"应用程序和一个"图形"应用程序.
在"调查"应用程序中,有模型和一些功能.在"图形"应用程序中,只有一个带有2个.py文件的"utils"文件夹 - 一个带有函数"get_chart_info"的文件"get_chart_info"和一个带有一些各种功能的文件"chart_utils"
图形应用程序在"调查"工作中的每个级别上都有一个init .py
但要导入的"get_chart_info"(文件)REFUSES.
如果我尝试在我安装的应用程序中放入"cblib.graphs",当我尝试运行服务器时,它会中断,说"错误:没有名为graph的模块"
如果我把它从我安装的应用程序中删除,我会得到:/ error/chart /中的ImportError没有名为graphs.utils.get_chart_info的模块(顺便说一句,我不明白为什么这说没有名为graphs.utils的模块而不是cblib.graphs .utils)
带有对import语句的行引用.
请注意,所有导入都在shell中工作.即,当我运行:./ manage.py shell import cblib import cblib.survey import cblib.graphs import cblib.graphs.get_chart_info from cblib.graphs.get_chart_info import get_chart_info
没有失败.
有谁知道为什么这会破坏?我觉得我已经检查了一切.
有人提到看到我的项目的ascii树可能很有用(编辑相关性)
cblib看起来像:
.
??? graphs
? ??? admin.py
? ??? __init__.py
? ??? __init__.pyc
? ??? utils
? ??? get_chart_info.py
? ??? get_chart_info.pyc
? ??? graph_utils.py
? ??? graph_utils.pyc
? ??? __init__.py
? ??? __init__.pyc
??? __init__.py
??? __init__.pyc
??? survey
??? admin.py
??? fixtures
? ??? badges.json
? ??? q1-174.json
? ??? q175-271.json
? ??? q272-302.json
? ??? responseoptions_767-1594.json
??? __init__.py
??? __init__.pyc
??? management
? ??? commands
? ? ??? create_fake_users.py
? ? ??? import_fake_user_data.py
? ? ??? import_questions.py
? ? ??? __init__.py
? ??? __init__.py
??? migrations
? ??? 0001_initial.py
? ??? 0002_auto__del_field_votelog_direction.py
? ??? 0003_auto__chg_field_pointlog_action_type.py
? ??? 0004_auto__add_opengraphverb__add_field_question_school_specific_opengraph_.py
? ??? __init__.py
??? models
??? badge.py
??? badge.pyc
??? __init__.py
??? __init__.pyc
??? opengraphverb.py
??? opengraphverb.pyc
??? pointlog.py
??? pointlog.pyc
??? question.py
??? question.pyc
??? responseoption.py
??? responseoption.pyc
Run Code Online (Sandbox Code Playgroud)
和fbsurvey看起来像:
.
??? canvas
? ??? admin.py
? ??? admin.pyc
? ??? brainys.json
? ??? data.csv
? ??? decorators.py
? ??? decorators.pyc
? ??? DefaultInfoObject.py
? ??? DefaultInfoObject.pyc
? ??? DefaultJsonResponse.py
? ??? DefaultJsonResponse.pyc
? ??? fixtures
? ? ??? test-fixture.json
? ??? __init__.py
? ??? __init__.pyc
? ??? level.py
? ??? level.pyc
? ??? management
? ? ??? commands
? ? ? ??? convert_fbuser_to_cbuser.pyc
? ? ? ??? credit_inviters.py
? ? ? ??? __init__.py
? ? ? ??? __init__.pyc
? ? ? ??? reminder_wallposts.py
? ? ? ??? reminder_wallposts.pyc
? ? ? ??? update_user_colleges.py
? ? ??? __init__.py
? ? ??? __init__.pyc
? ??? migrations
? ? ??? 0001_initial.py
? ? ??? 0001_initial.pyc
? ? ??? __init__.py
? ? ??? __init__.pyc
? ??? models.py
? ??? models.pyc
? ??? static
? ? ??? css
? ? ??? img
? ? ??? js
? ??? templates
? ? ??? answers.html
? ? ??? answers-mobile.html
? ? ??? answertest.html
? ? ??? badge-explanation.html
? ? ??? badges.html
? ? ??? baduser.html
? ? ??? bottombar.html
? ? ??? bottombar-mobile.html
? ? ??? browse-stories.html
? ? ??? end.html
? ? ??? friends.html
? ??? tests.py
? ??? tests.pyc
? ??? urls.py
? ??? urls.pyc
? ??? views
? ? ??? answers.py
? ? ??? answers.pyc
? ? ??? badge_explanation.py
? ? ??? badge_explanation.pyc
? ? ??? badges.py
? ? ??? badges.pyc
? ? ??? browse_stories.py
? ? ??? browse_stories.pyc
? ? ??? explanation.pyc
? ? ??? format_for_graph.py
? ??? views.pyc
??? __init__.py
??? __init__.pyc
??? local_settings.py
??? local_settings.pyc
??? local_settings.py.example
??? logclient
? ??? __init__.py
??? manage.py
??? maps.py
??? maps.pyc
??? patch.py
??? pokesite
??? python.exe.stackdump
??? README
??? requirements.txt
??? settings.py
??? settings.pyc
??? survey
? ??? admin.pyc
? ??? data
? ? ??? CBI Questions with percentages v3.csv
? ? ??? data.csv
? ? ??? List of School Nicknames.txt
? ? ??? pquestions.csv
? ? ??? question_pks_and_categories.csv
? ? ??? questions.csv
? ? ??? questions.json
? ??? __init__.py
? ??? __init__.pyc
? ??? localsetting.py
? ??? models.pyc
? ??? tests.py
? ??? views.py
??? surveydump.json
??? sync_badges.py
??? templates
? ??? 404.html
? ??? 500.html
? ??? base.html
? ??? base-mobile.html
??? testdump.json
??? tree.txt
??? urls.py
??? urls.pyc
Run Code Online (Sandbox Code Playgroud)
答案与我的.pyc文件有关...我不知道如何或为什么,但正在运行
找 .-name"*.pyc"-delete
(在我的两个项目目录中,可能会重新生成我的pyc文件)修复了问题.
| 归档时间: |
|
| 查看次数: |
2423 次 |
| 最近记录: |