Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to compile python code that uses boto to access S3?
    primarykey
    data
    text
    <p>I'm trying to compile a simple Python program, that uploads files to an S3 bucket using the boto package, in to a single, redistributable .exe file. I'm open to any compilation method. So far I've tried both <code>bbfreeze</code> and <code>py2exe</code> and both yield the same results. The code in question that causes trouble looks like this:</p> <pre><code>import boto #...snip... fname_base = os.path.basename(fname) s3 = boto.connect_s3(aws_access_key_id=_aws_key, aws_secret_access_key=_aws_secret_key, is_secure=False); bucket = s3.get_bucket(_bucket) key = bucket.new_key(fname_base) key.set_contents_from_filename(fname) </code></pre> <p>Compiled with either executable bundling utility and run I get:</p> <pre><code>Traceback (most recent call last): File "s3stash.py", line 238, in &lt;module&gt; sys.exit(main()) File "s3stash.py", line 225, in main push_file_to_s3(f, options) File "s3stash.py", line 160, in push_file_to_s3 _push_with_boto(fname) File "s3stash.py", line 148, in _push_with_boto s3 = boto.connect_s3(aws_access_key_id=_aws_key, aws_secret_access_key=_aws_secret_key, is_secure=False); File "boto\__init__.pyo", line 104, in connect_s3 File "zipextimporter.pyo", line 82, in load_module File "boto\s3\connection.pyo", line 27, in &lt;module&gt; File "zipextimporter.pyo", line 82, in load_module File "boto\utils.pyo", line 55, in &lt;module&gt; File "email\__init__.pyo", line 79, in __getattr__ ImportError: No module named multipart </code></pre> <p>I'm using ActiveState Python 2.6 on Windows XP SP3. The boto package was installed with:</p> <pre><code>easy_installer --always-unzip boto </code></pre> <p>I used the <code>--always-unzip</code> option based on the information <a href="http://www.py2exe.org/index.cgi/ExeWithEggs" rel="nofollow">found here</a> about <code>py2exe</code> having issues with the egg files that were unpacked. Unfortunately the error I get is the same when I use <code>bb-freeze</code> to build the executable.</p> <p>The output from <code>py2exe</code> includes, near the end, the following bit of information:</p> <pre><code>The following modules appear to be missing ['_scproxy', 'email.Encoders', 'email.MIMEBase', 'email.MIMEMultipart', 'email.MIMEText', 'email.Utils', 'simplejson'] </code></pre> <p>Which lends some hints. I tried methods suggested in other posts to SO where the <code>-i</code> option was recommended when compiling with <code>py2exe</code> and unfortunately nothing helped. In those other questions the users were doing their own explicit inclusion of of the email sub-modules. I could not figure how to adapt those solutions to my case unfortunately and just adding them with <code>-i</code> didn't stop <code>py2exe</code> from warning me of the missing modules, or the resulting bundled exe from failing with the missing module error.</p> <p>Can someone help me get this code bundled for redistribution?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload