0

在我的系统上设置 py.saunter 时,我收到 saunter.ini 文件的 IO 错误。

目录结构完全如示例中所示 - https://github.com/Element-34/Py.Saunter-Examples

以下是错误消息 -

IOError: [Errno 2] No such file or directory: '/src/conf/saunter.ini'
ERROR: Module: Tests could not be imported
(file:/Users/.../PythonWorkspace/PySaunter/src/scripts/Tests.py)

我知道有很多与进口相关的问题。他们中的大多数人建议添加init .py 如果还没有的话。我在每个文件夹中添加了init .py。

读取 saunter.ini 的代码片段如下 -

def configure(self, config = "saunter.ini"):
    self.config = ConfigParser.SafeConfigParser()
    self.config.readfp(open(os.path.join("conf", config)))

任何帮助,将不胜感激...

4

2 回答 2

0

There isn't really enough here to diagnose the problem. But, in the examples directory there is actually two different projects (ebay and sauce) -- you have to be in one of them, not the top.

Also, Py.Saunter won't create saunter.ini for you. You need to create it (most easily by renaming saunter.ini.default).

Oh, and don't try and run it from checkout from Github -- it really does need to be from an egg. If there are bits missing from http://element34.ca/products/saunter/pysaunter which prevent you from getting started, let me know and I'll modify the page.

(Now if only I remembered by SO credentials...)

于 2013-02-14T02:51:01.617 回答
0

我从 Eclipse 运行项目作为单元测试,这就是它抛出导入错误的原因。Py.Saunter 是一个固执己见的框架,目前不支持 eclipse 或任何其他 IDE。从命令行执行时它工作正常,如站点所示 - http://element34.ca/products/saunter/pysaunter

应确保从主目录执行。

于 2013-02-25T05:48:09.953 回答