tags:

views:

46

answers:

1

I am having a xml file and i am reading the data from that xml file. But the problem is that i am making an exe file from all the available .py files (using py2exe).

i dont want to distribute my xml file along with my exe ( because of securiy reasons) as standalone xml file.I want my xml file should be part of exe as all other remaining .py files.

So Any idea can i use my xml file as .py file or anyother method.

Any help really appreciable.

+2  A: 

One thing you can do is include it as a string in a module:

bigxml = '''<?xml ...
  ....
  ....
  ....
</topelement>'''

Then just import it:

from xmldoc import bigxml
Ignacio Vazquez-Abrams
yes this is the right answer. I got how to include how to the use xml file as .py file.You need one more step if you want to use xml and play with this.You need to make the xml tree element as given below theXmlDataTree = et.ElementTree(fromstring(ThemesFile)) xmlRoot = theXmlDataTree.getroot()once you get root you can do whatever you want
mukul sharma