{"action":"opened","issue":{"url":"https://api.github.com/repos/ZoomerAnalytics/xlwings/issues/565","repository_url":"https://api.github.com/repos/ZoomerAnalytics/xlwings","labels_url":"https://api.github.com/repos/ZoomerAnalytics/xlwings/issues/565/labels{/name}","comments_url":"https://api.github.com/repos/ZoomerAnalytics/xlwings/issues/565/comments","events_url":"https://api.github.com/repos/ZoomerAnalytics/xlwings/issues/565/events","html_url":"https://github.com/ZoomerAnalytics/xlwings/issues/565","id":179724449,"number":565,"title":"MemoryError: CreatingSafeArray when getting values from cells","user":{"login":"wikiped","id":5990528,"avatar_url":"https://avatars.githubusercontent.com/u/5990528?v=3","gravatar_id":"","url":"https://api.github.com/users/wikiped","html_url":"https://github.com/wikiped","followers_url":"https://api.github.com/users/wikiped/followers","following_url":"https://api.github.com/users/wikiped/following{/other_user}","gists_url":"https://api.github.com/users/wikiped/gists{/gist_id}","starred_url":"https://api.github.com/users/wikiped/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wikiped/subscriptions","organizations_url":"https://api.github.com/users/wikiped/orgs","repos_url":"https://api.github.com/users/wikiped/repos","events_url":"https://api.github.com/users/wikiped/events{/privacy}","received_events_url":"https://api.github.com/users/wikiped/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-28T09:34:33Z","updated_at":"2016-09-28T09:34:33Z","closed_at":null,"body":"Say there is a file you need to check for a specific cell content:\r\n\r\n    import xlwings as xw\r\n    import pandas as pd\r\n\r\n    xl = xw.App()\r\n    bk = xl.books.active\r\n    sh = bk.sheets[0]\r\n\r\n    # Generate some data to play with:\r\n    first_col = sh.range((1,1),(10,1)).options(pd.Series, index=False, header=False)\r\n    first_col.value = pd.Series(['abc', 'def', None, None, None, None, None, None, 'ghi', 'jkl'])\r\n\r\n    # Now let's read the values and find the cell of interest:\r\n    col_values = first_col.value\r\n    mask = col_values.str.contains('ghi').fillna(False)\r\n    if mask.any():\r\n        r = col_values[mask].index[0]\r\n    else:\r\n        r = 0\r\n\r\n    # Here comes the unexpected problem when we try to reference the cell we found providing tuple of indexes:       \r\n    c = 1\r\n    print(sh.range((r, c)).value)\r\n\r\nThis yields the error:\r\n\r\n    ---------------------------------------------------------------------------\r\n    MemoryError                               Traceback (most recent call last)\r\n    <ipython-input-219-a5ff76065f71> in <module>()\r\n          2 c = 1\r\n    ----> 3 print(sh.range((r, c)).value)\r\n\r\n    D:\\Anaconda\\envs\\py3k\\lib\\site-packages\\xlwings\\main.py in range(self, cell1, cell2)\r\n        821                 raise ValueError(\"Second range is not on this sheet\")\r\n        822             cell2 = cell2.impl\r\n    --> 823         return Range(impl=self.impl.range(cell1, cell2))\r\n        824 \r\n        825     @property\r\n\r\n    D:\\Anaconda\\envs\\py3k\\lib\\site-packages\\xlwings\\_xlwindows.py in range(self, arg1, arg2)\r\n        577             if 0 in arg1:\r\n        578                 raise IndexError(\"Attempted to access 0-based Range. xlwings/Excel Ranges are 1-based.\")\r\n    --> 579             xl1 = self.xl.Cells(arg1[0], arg1[1])\r\n        580         elif isinstance(arg1, numbers.Number) and isinstance(arg2, numbers.Number):\r\n        581             xl1 = self.xl.Cells(arg1, arg2)\r\n\r\n    D:\\Anaconda\\envs\\py3k\\lib\\site-packages\\xlwings\\_xlwindows.py in __call__(self, *args, **kwargs)\r\n        150         for i in range(N_COM_ATTEMPTS + 1):\r\n        151             try:\r\n    --> 152                 v = self._inner(*args, **kwargs)\r\n        153                 t = type(v)\r\n        154                 if t is CDispatch:\r\n\r\n    D:\\Anaconda\\envs\\py3k\\lib\\site-packages\\win32com\\client\\dynamic.py in __call__(self, *args)\r\n        195                 if invkind is not None:\r\n        196                         allArgs = (dispid,LCID,invkind,1) + args\r\n    --> 197                         return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None)\r\n        198                 raise TypeError(\"This dispatch object does not define a default method\")\r\n        199 \r\n\r\n    MemoryError: CreatingSafeArray\r\n\r\nIf instead of tuples we would provide Excel reference (i.e. `'A1'`) the code would work fine.\r\n\r\nThis happens with xlwings `0.10.0`, Excel `15.0`, Python `3.5.2`"}}
{"actor":{"display_login":"wikiped"}}