I am making an application using python 2.7 on windows and keyring-3.2.1 . In my python code on eclipse I used
import keyring keyring.set_password("service","jsonkey",json_res) json_res= keyring.get_password("service","jsonkey")
works fine as i save json response in keyring. But, when I converted python code to exe using py2exe, it shows import bracketing when creating dist. Suggest how to enable keyring in py2exe.
Traceback (most recent call last): File "APP.py", line 8, in <module> File "keyring\__init__.pyc", line 12, in <module> File "keyring\core.pyc", line 15, in <module> File "keyring\util\platform_.pyc", line 4, in <module> File "keyring\util\platform.pyc", line 29, in <module> AttributeError: 'module' object has no attribute 'system'
Platform Code:
from __future__ import absolute_import import os import platform def _data_root_Windows(): try: root = os.environ['LOCALAPPDATA'] except KeyError:
.Py platform code:
import os import sys # While we support Python 2.4, use a convoluted technique to import # platform from the stdlib. # With Python 2.5 or later, just do "from __future__ import absolute_import" # and "import platform" exec('__import__("platform", globals=dict())') platform = sys.modules['platform'] def _data_root_Windows(): try: root = os.environ['LOCALAPPDATA'] except KeyError: # Windows XP root = os.path.join(os.environ['USERPROFILE'], 'Local Settings') return os.path.join(root, 'Python Keyring') def _data_root_Linux(): """ Use freedesktop.org Base Dir Specfication to determine storage location. """ fallback = os.path.expanduser('~/.local/share') root = os.environ.get('XDG_DATA_HOME', None) or fallback return os.path.join(root, 'python_keyring') # by default, use Unix convention data_root = globals().get('_data_root_' + platform.system(), _data_root_Linux)
json python py2exe python-keyring mercurial-keyring
imp
source share