Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialization exception on windows 7 #47

Closed
iddl opened this issue May 12, 2015 · 6 comments · Fixed by #48
Closed

Initialization exception on windows 7 #47

iddl opened this issue May 12, 2015 · 6 comments · Fixed by #48

Comments

@iddl
Copy link
Member

iddl commented May 12, 2015

Initializing datadogpy on windows7 results in the exception below.

Note: running python 3.4

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    datadog.initialize()
  File "C:\Python34\lib\site-packages\datadog\__init__.py", line 59, in initialize
    api._host_name = host_name if host_name is not None else get_hostname()
  File "C:\Python34\lib\site-packages\datadog\util\hostname.py", line 52, in get_hostname
    config = get_config()
  File "C:\Python34\lib\site-packages\datadog\util\config.py", line 122, in get_config
    config_path = get_config_path(cfg_path, os_name=get_os())
  File "C:\Python34\lib\site-packages\datadog\util\config.py", line 101, in get_config_path
    return _windows_config_path()
  File "C:\Python34\lib\site-packages\datadog\util\config.py", line 68, in _windows_config_path
    common_data = _windows_commondata_path()
  File "C:\Python34\lib\site-packages\datadog\util\config.py", line 62, in _windows_commondata_path
    path_buf = wintypes.create_unicode_buffer(wintypes.MAX_PATH)
AttributeError: 'module' object has no attribute 'create_unicode_buffer'
@iddl iddl added the bug label May 12, 2015
@samanthadrago
Copy link
Contributor

Feedback from customer - it works if using python 2.7. We could add a note to the README?

@yannmh
Copy link
Member

yannmh commented May 12, 2015

Thanks @samanthadrago. Do you know which version they were using ?

@samanthadrago
Copy link
Contributor

@yannmh 3.4

@yannmh
Copy link
Member

yannmh commented May 13, 2015

Thanks @samanthadrago.
Datadogpy should work with Python 3.4 as listed in pypi classifiers, I'll investigate on a Windows lab to figure out what the issue is.

@apoorvab
Copy link

@yannmh, I think I found a solution. I tested it out and it worked for me.

According to a comment by eryksun in "http://stackoverflow.com/questions/626796/how-do-i-find-the-windows-common-application-data-folder-using-python" (provided in the code) ctypes.create_unicode_buffer should be used rather than wintypes.create_unicode_buffer.

This is because "[create_unicode_buffer] was only accidentally in wintypes in PY2 due to its use of from ctypes import *"

I was on Windows 7 using Python 3.4 in a virtual environment with PyCharms as my IDE.

yannmh added a commit that referenced this issue May 18, 2015
Because '[create_unicode_buffer] was only accidentally in wintypes in
PY2 due to its use of from ctypes import *'. More info
http://stackoverflow.com/questions/626796/how-do-i-find-the-windows-common-application-data-folder-using-python
@yannmh
Copy link
Member

yannmh commented May 18, 2015

Thanks a lot @apoorvab.
A new release of Datadogpy is on the launching ramp with the suggested fix.

yannmh added a commit that referenced this issue May 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants