设置py.Saunter时saunter.ini的IO错误

时间:2013-02-14 01:19:03

标签: python selenium webdriver

在我的系统上设置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)))

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

2 个答案:

答案 0 :(得分:0)

这里没有足够的诊断问题。但是,在examples目录中实际上有两个不同的项目(ebay和酱) - 你必须在其中一个,而不是顶部。

另外,Py.Saunter不会为你创建saunter.ini。您需要创建它(最容易通过重命名saunter.ini.default)。

哦,不要尝试从Github的结账处运行它 - 它确实需要来自一个鸡蛋。如果http://element34.ca/products/saunter/pysaunter中缺少某些位阻止您开始使用,请告诉我,我会修改该页面。

(现在,如果我只记得SO凭证......)

答案 1 :(得分:0)

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

应确保从主目录执行。