boto3 S3 in Windows COM object

310 views
Skip to first unread message

lbate...@gmail.com

unread,
Jun 25, 2017, 9:21:36 AM6/25/17
to boto-users
I'm rewriting a working COM object and upgrading it from boto to boto3 because older version was unable to connect properly with newer regional endpoints. I've worked around the problem where boto3 needs to know where some external files:

aws_data_files = [('data', ['data/_endpoints.json',
                            'data/_retry.json',
                            'data/cacert.pem']),
                  
                  ('data/s3/2006-03-01', ['data/s3/2006-03-01/service-2.json',
                                          'data/s3/2006-03-01/paginators-1.json',
                                          'data/s3/2006-03-01/waiters-2.json'])
                 ]

are located when the program is frozen with py2exe and for normal program this works fine. I've spent about 8 hours trying to figure out where these files should be located when you are using boto3 from inside a Windows COM object. It is unclear where the "data" folder should be placed when you are running inside a COM object and I can't find a workaround that would allow me to explicitly include these files.

I keep getting the following traceback:

Python COM server Internal Error: Unexpected Python Error: Traceback
(most recent call last):
File: "win32com\server\policy.pyc", line 277, in Invoke
File: "winrecom\server\policy.pyc", line 282, in invoke
File: "winrecom\server\policy.pyc", line 585, in invokeex
File: "verifyIAMCOM.pyc", line 103, in validate
File: "boto3\session.pyc", line 263 in client
File: "botocore\session.pyc", line 816 in create_client
File: "botocore\session.pyc", line 691, in get_component
File: "botocore\session.pyc", line 885, in get_component
File: "botocore\session.pyc", line 184, in create_default_resolver
File: "botocore\loaders.pyc", line 123, in _wrapper
File: "botocore\loaders.pyc", line 382, in load_data
DataNotFoundError: Unable to load data for: endpoints

Any help would be greatly appreciated.

Larry Bates

lbate...@gmail.com

unread,
Jun 27, 2017, 11:12:25 AM6/27/17
to boto-users
I added some code to the COM object and have determined that COM objects run with C:\Windows\System32 as their current directory. Give that information I figured that if I put the /data folder in that folder this would work, but it does not.

IMHO the method for getting these files included in a "frozen" working program needs to be refactored. I would REALLY prefer being able to do an EXPLICIT include when/if I require these files instead of the dynamic inclusion that is currently employed.

Larry Bates
Reply all
Reply to author
Forward
0 new messages