0

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
  • py2exe can be unzipped to get the pyc files, and it is trivial to see string in a pyc file, and crazy-compilers.com/decompyle can even convert pyc to almost original like python code, so in way you are not securing much, but yes you can use it to stop casual eyes form looking at your data. Commented Feb 22, 2010 at 9:41
  • then what is better way to secure data? if you know some better approach then please let me know. Commented Feb 23, 2010 at 4:35

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.