学习learn python the hard way习题46, ImportError问题
2013-09-09 21:24
579 查看
在windows下,按照learn python the hard way习题46所说配置,执行nosetests出现如下图所示问题:
根本原因是import的时候找不到NAME,importerror问题详解见http://my.oschina.net/leejun2005/blog/109679
解决方法,在tests文件夹下的NAME_test.py开头如下这样写:
from nose.tools import *
import sys
sys.path.append('NAME')
如果包下没有模板,这样就ok了,如果有再import,
举例如下:learn python the hard way 习题47中,测试代码开头如下:
from nose.tools import *
import sys
sys.path.append('ex47')
from game import Room
根本原因是import的时候找不到NAME,importerror问题详解见http://my.oschina.net/leejun2005/blog/109679
解决方法,在tests文件夹下的NAME_test.py开头如下这样写:
from nose.tools import *
import sys
sys.path.append('NAME')
如果包下没有模板,这样就ok了,如果有再import,
举例如下:learn python the hard way 习题47中,测试代码开头如下:
from nose.tools import *
import sys
sys.path.append('ex47')
from game import Room
相关文章推荐
- Learn Python The Hard Way学习(46) - 一个项目的骨架
- Learn Python The Hard Way中习题46安装distribute包和virtualenv包
- 《learning python the hard way》习题46 项目骨架搭建 问题小结(二)之 自动化测试代码问题
- 《learning python the hard way》习题46 项目骨架搭建 问题小结(一)之软件包的安装
- Learn Python The Hard Way学习(14) - 提示和传递
- Learn Python The Hard Way学习(22) - 到现在我们已经学到了什么?
- Learn Python The Hard Way学习(15) - 读取文件
- [IT学习]Learn Python the Hard Way (Using Python 3)笨办法学Python3版本
- Learn Python The Hard Way学习(23) - 读一些代码
- Learn Python The Hard Way学习(49) - 创建句子
- Learn Python The Hard Way学习(1) - 好的开始
- Learn Python The Hard Way学习(50) - 你的第一个网站
- 【在路上】Learn Python The Hard Way 习题心得(ex11,12,13,14,15)
- Learn Python The Hard Way学习(3) - 数字和数学计算
- Learn Python The Hard Way学习(4) - 变量和命名
- 列表的操作,习题38,learn python the hard way.
- Learn Python The Hard Way学习(0) - 安装
- Learn Python The Hard Way学习(40) - 模块,类和对象
- Learn Python The Hard Way学习(5) - 更多的变量和打印
- Learn Python The Hard Way学习(6) - 字符串和文本