tags:

views:

48

answers:

2

I recently installed Dogtail, an open source GUI testing tool and automation framework. I downloaded the example script (https://fedorahosted.org/dogtail/browser/examples/gedit-test-utf8-tree-api.py?format=txt) to my computer, but am having trouble getting it work. When I invoke it, I get a message saying:

corey@corey-laptop:~/Desktop/exercise$ ./gedit-test-utf8-tree-api.py 
Traceback (most recent call last):
  File "./gedit-test-utf8-tree-api.py", line 6, in <module>
    from dogtail import tree
  File "/home/joe/Desktop/exercise/dogtail.py", line 6, in <module>
    from dogtail import tree
ImportError: cannot import name tree

I'm using Ubuntu 10.04. I'm not sure why this won't run or how to fix it. Any ideas?

A: 

From your traceback, it looks like you have not installed dogtail.

you are running from the directory ~/Desktop/exercise

The dogtail.py is in the same directory and it should have been a package called dogtail with a file tree.py . Is this dogtail.py writen by you or part of the dogtail framework?

Some thing is amiss here.

pyfunc
+2  A: 

Don't name the file in /home/joe/Desktop/exercise dogtail:

  File "/home/joe/Desktop/exercise/dogtail.py", line 6, in <module>
    from dogtail import tree

Python is importing your dogtail.py instead of the package located at /usr/share/python-support/python-dogtail/dogtail.

To test this theory, you can open the python interpreter and type

import dogtail
dogtail.__file__

to see where dogtail is coming from.

unutbu
good call... thanks for helping out a python newbie!
Corey Jeffco
+1. Good call indeed.
Manoj Govindan