python - py2app and xml.etree.ElementTree -
I am trying to prepare an app that uses some of the XML data by using Python's built-in xml.etree.ElementTree class uses it. It works properly when I run from the command line, but when I make it, I get an error, "ImportError: No module entry. Elementary" I'm assuming this because I think that module properly I am not importing, but I did not understand how when I use the "included" or "package" instruction, py2app complains with the same error, and when I specifically purchase package_dir (/ System) / Library / ...), I compile it, but still gives me an error I have included a short example to illustrate this problem. Import Elementitry from Xml.etree.ElementTree
if __name__ == '__main__': tree = ElementTree () print tree.parse ('lib. Xml ')
should print it on "xxxxxx> Element Library"> where is the library root name.
Set up setup setup from
> Mac App What is the right way to use this library? Python 2.6.4
Mac OS X 10.6.2
EDIT: I also use the second Mac (PPC 10.5.8) with Python 2.6.2 Tried and achieved the same results.
After resetting and updating Masoliib, Mudrograph, PA2 app, and Setup Tools , I dig a bit more and I found the following error in the following module:
graphmodule.find_modules.find_moduleules = ['xml.etree']) Traceback (the most recent call last): The file " & Lt; stdin & gt; ", line & lt; Module & gt; File "... / MODGraph / search_module_package", find_modules "... / modulegraph / find_modules.py" in line 255, line 182 find_needed_modules file "... / modulegraph / modulegraph.py", "Import_hook file" in line 401. .. / modulegraph / modulegraph.py ", in line 464, load_tail ImportError: a module named xml.etree
so I saw more in the code load_tail
and Import_hook
functions and found that it was importing XML packages correctly for some reasons, but then went to an old installed * _xmlplus for the entry subpackage Per form can not find). Removing the _xmlplus package expired the error and I was able to get the application to work with the following setup.py file: XMLml.etree.ElementTree Setup from Setup Import Import from (name = "Mac XML Test "['Xml.etree.ElementTree']}}, data_files = [(('', ['LibExml', '', '=' ['maxmelz'], option = {'py2app' ])]) The output is displayed in the console.
Comments
Post a Comment