1

I have the following small program:

import urllib2,os
urls = ['http://stahlworks.com/dev/sfk/sfk.exe','http://stahlworks.com/dev/sfk/sfk.exe','http://stahlworks.com/dev/sfk/sfk.exe','http://stahlworks.com/dev/sfk/sfk.exe']
for fruit in urls:
url = fruit

file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (file_name, file_size)
os.system('cls')
file_size_dl = 0
block_sz = 8192
while True:
    buffer = u.read(block_sz)
    if not buffer:
        break

    file_size_dl += len(buffer)
    f.write(buffer)
    status = r"%10d  [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
    status = status + chr(8)*(len(status)+1)
    print status,

f.close()

I compiled it using Cython:

python cython.py --embed -o hello.c h.py

then I compiled it using gcc:

gcc.exe -I"c:\python27\include" -L"c:\python27\libs" hello.c -ohello.exe -lpython27

After I compile it it runs fine, until I try it on a computer without python/ python27 renamed to python27x then I get the following error:

The application was unable to start correctly (0xc000007b). Click OK to close the application.

Is there any way I can get around this and build a truly standalone app?

1
  • yes you need... with Cython you only obtain one compiled module which is "importable" from Python Commented Sep 20, 2014 at 14:00

1 Answer 1

1

I have used py2exe (http://www.py2exe.org/) with reasonable success for windows applications. It packages up what's needed to run things in a nice way, including basic python libs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.