python-3.5

xlwings with python 3.5 on Windows

帅比萌擦擦* 提交于 2019-12-02 05:25:57
I have been stuck for some time. My configuration is: python 3.5 , xlwings 0.5.0 and Windows 7 . I get the following traceback while trying to import xlwings : Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Program Files\Python 3.5\lib\site-packages\xlwings\__init__.py", line 20, in <module> from . import _xlwindows as xlplatform File "C:\Program Files\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module> import pywintypes File "C:\Program Files\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module> __import_pywin32

Python 3.5, ldap3 and modify_password()

不羁的心 提交于 2019-12-02 03:28:37
I've been pulling my hair out trying to send a request to update my own password via a script. here is the code: #!/usr/bin/python3.5 from ldap3 import Server, Connection, NTLM, ALL server = Server('ldap://192.168.0.80', use_ssl=True) conn = Connection(server, user="local\\dctest", password="Pa55word1", authentication=NTLM, auto_bind=True) dn = "CN=dctest,CN=Users,DC=home,DC=local" conn.extend.microsoft.modify_password(dn, new_password="Pa55word2", old_password="Pa55word1") The error that i get is: {'dn': '', 'type': 'modifyResponse', 'description': 'unwillingToPerform', 'referrals': None,

Python: Venn diagram: how to show the diagram contents?

↘锁芯ラ 提交于 2019-12-02 02:09:28
问题 I have the working code below. from matplotlib import pyplot as plt import numpy as np from matplotlib_venn import venn3, venn3_circles Gastric_tumor_promoters = set(['DPEP1', 'CDC42BPA', 'GNG4', 'RAPGEFL1', 'MYH7B', 'SLC13A3', 'PHACTR3', 'SMPX', 'NELL2', 'PNMAL1', 'KRT23', 'PCP4', 'LOX', 'CDC42BPA']) Ovarian_tumor_promoters = set(['ABLIM1','CDC42BPA','VSNL1','LOX','PCP4','SLC13A3']) Gastric_tumor_suppressors = set(['PLCB4', 'VSNL1', 'TOX3', 'VAV3']) #Ovarian_tumor_suppressors = set(['VAV3',

Defining unicode variables in Python

那年仲夏 提交于 2019-12-01 22:20:13
Recently, I have been reading about the Python source code encoding, especially PEP 263 and PEP 3120 . I have the following code: # coding:utf-8 s = 'abc∂´ƒ©' ƒ = 'My name is' ß = '˚ß˙ˆ†ˆ∆ ßå®åø©ˆ' print('s =', s) print('ƒ =', ƒ, 'ß =', ß) This code works fine for Python3 but results in a SyntaxError in Python2.7 . I do understand that this probably might have nothing to do with source code encoding. So, I would like to know if there is a way to support Unicode variable names in Python2. In all, I am also having a hard time figuring out what pragmatic problem the PEPs exactly aim to solve and

Setting a descriptor in python3.5 asynchronously

社会主义新天地 提交于 2019-12-01 21:20:18
问题 I can write a descriptor returning a future which could be awaited on. class AsyncDescriptor: def __get__(self, obj, cls=None): # generate some async future here return future def __set__(self, obj, value): # generate some async future here return future class Device: attr=AsyncDescriptor() device=Device() Now I can get the value in a coroutine with value=await device.attr . How would I set this attribute? await device.attr=5 -> SyntaxError: can't assign to await expression await setattr

Setting a descriptor in python3.5 asynchronously

我的梦境 提交于 2019-12-01 19:45:26
I can write a descriptor returning a future which could be awaited on. class AsyncDescriptor: def __get__(self, obj, cls=None): # generate some async future here return future def __set__(self, obj, value): # generate some async future here return future class Device: attr=AsyncDescriptor() device=Device() Now I can get the value in a coroutine with value=await device.attr . How would I set this attribute? await device.attr=5 -> SyntaxError: can't assign to await expression await setattr(device, 'attr', 5) -> TypeError: object NoneType can't be used in 'await' expression device.attr=5 ->

I am using jupyter notebook, ipython 3 on windows. Whenever i am starting my python 3, i get the “Kernel Dead” message

醉酒当歌 提交于 2019-12-01 17:45:45
Dead kernel The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened. the above message is shown in notebook dashboard after i start python3. [I 23:07:08.365 NotebookApp] KernelRestarter: restarting kernel (4/5) WARNING:root:kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb restarted Traceback (most recent call last): File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\runpy.py" ,

Neat way of popping key, value PAIR from dictionary?

柔情痞子 提交于 2019-12-01 16:43:23
pop is a great little function that, when used on dictionaries (given a known key) removes the item with that key from the dictionary and also returns the corresponding value. But what if I want the key as well? Obviously, in simple cases I could probably just do something like this: pair = (key, some_dict.pop(key)) But if, say, I wanted to pop the key-value pair with the lowest value, following the above idea I would have to do this... pair = (min(some_dict, key=some.get), some_dict.pop(min(some_dict, key=some_dict.get))) ... which is hideous as I have to do the operation twice (obviously I

typing.Any vs object?

一笑奈何 提交于 2019-12-01 15:00:40
Is there any difference between using typing.Any as opposed to object in typing? For example: def get_item(L: list, i: int) -> typing.Any: return L[i] Compared to: def get_item(L: list, i: int) -> object: return L[i] Martijn Pieters Yes, there is a difference. Although in Python 3, all objects are instances of object , including object itself, only Any documents that the return value should be disregarded by the typechecker. The Any type docstring states that object is a subclass of Any and vice-versa: >>> import typing >>> print(typing.Any.__doc__) Special type indicating an unconstrained

typing.Any vs object?

元气小坏坏 提交于 2019-12-01 13:46:17
问题 Is there any difference between using typing.Any as opposed to object in typing? For example: def get_item(L: list, i: int) -> typing.Any: return L[i] Compared to: def get_item(L: list, i: int) -> object: return L[i] 回答1: Yes, there is a difference. Although in Python 3, all objects are instances of object , including object itself, only Any documents that the return value should be disregarded by the typechecker. The Any type docstring states that object is a subclass of Any and vice-versa: