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

workbook.caller with file on a sharepoint server #215

Closed
sdementen opened this issue Aug 21, 2015 · 7 comments
Closed

workbook.caller with file on a sharepoint server #215

sdementen opened this issue Aug 21, 2015 · 7 comments
Labels
Milestone

Comments

@sdementen
Copy link
Contributor

I can't succeed in using xlwings with an excel workbook on sharepoint (ie not checked out locally).

I see the file on the ROT with a fullname = "https://sharepoint_path/workbook.xlsm"

Calling Workbook(fullname) leads to the stack trace:

Calling Workbook(fullname) leads to the stack trace::
Traceback (most recent call last):
  File "C:/.../test.py", line 18, in <module>
    Workbook("https://sharepoint_path/workbook.xlsm")
  File "C:\...\lib\site-packages\xlwings\main.py", line 49, in __init__
    self.xl_app, self.xl_workbook = xlplatform.get_workbook(self.fullname)
  File "C:\...\lib\site-packages\xlwings\_xlwindows.py", line 50, in get_workbook
    xl_workbook = GetObject(fullname)
  File "C:\...\lib\site-packages\win32com\client\__init__.py", line 72, in GetObject
    return Moniker(Pathname, clsctx)    
  File "C:\...\lib\site-packages\win32com\client\__init__.py", line 87, in Moniker
    moniker, i, bindCtx = pythoncom.MkParseDisplayName(Pathname)
pywintypes.com_error: (-2147221020, 'Invalid syntax', None, None)

An additional potential issue is with blank space in the name ==> fullname has it as " " but name in ROT is with a "%20".

@fzumstein
Copy link
Member

Probably the same issue as this one #192 - I never got around to testing it one these platforms, but your observation is probably part of the issue...

@fzumstein fzumstein added the bug label Aug 21, 2015
@sdementen
Copy link
Contributor Author

Googling the stack trace led me to https://bitbucket.org/cherrypy/cherrypy/issues/194/error-using-win32comclientgetobject-with mentioning some CoInitialise call (and other but very old posts from 2001)

@sdementen
Copy link
Contributor Author

A solution would be to bypass GetObject (ie if the latter throws an exception) and get the object directly from the ROT by comparing the name in the ROT to the the fullname (module some encoding/decoding of the strings re %20 and other discrepancies). Would this work ?
Or I'll test the recommendation from my previous link on next Monday

@fzumstein
Copy link
Member

I guess pywin32 hasn't caught up with the onedrive/sharepoint URLs. Maybe it's worth opening an issue there. However, the changes I made for #203, should also resolve these issues - given the workbook is opened in the first instance.

@fzumstein
Copy link
Member

although that obviously wouldn't help if you want to make a connection from Python to Excel...

@sdementen
Copy link
Contributor Author

The bug is perhaps deeper as a GetObject in vba from excel also fails if I
do recall correctly. To retest

On Saturday, August 22, 2015, Felix Zumstein notifications@github.com
wrote:

although that obviously wouldn't help if you want to make a connection
from Python to Excel...


Reply to this email directly or view it on GitHub
#215 (comment)
.

@fzumstein fzumstein added this to the v0.4.0 milestone Sep 27, 2015
@fzumstein
Copy link
Member

Resolved with HWND refactor, as confirmed on #235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants