Forums

Any possibility to use Windows as the Web server ? (Need to use py2exe)

Hi,

Am building a Website for my School project, I need to use py2exe since am trying to convert .py files to .exe where users can download .exe and run on their Windows machines. Since the web server provided by pythonanywhere is Linux, am unable to use py2exe.

Is there any solution for my problem ? Appreciate your help / suggestions.

Thanks, San

You can always use py2exe locally on your Windows machine and upload the result so it can be served by the site.

Yes, it sounds like they're just static files that you can serve like any other content. If you really do need to generate them dynamically then perhaps you could explain what you need in more detail so we can try and offer suggestions.

EDIT

By the way, obviously I'm just a user and the PA devs would have the official word; but personally I think it's quite unlikely that Windows will be supported any time soon. I've had the "fun" of managing headless remote Windows servers before and believe me, those scare quotes are well earned.

Am building a Web App for my School project. This App runs on Pythonanywhere Server which is a Linux OS. But I want Window users to use this Web App. My challenge: I need to create a .exe file for the users who write Python code (.py) using Web browser.

My obstacle: Since Web server is Linux am unable to create .exe file.

Its basically a Remote IDE.

User Scenario: Users will log onto my website and start writing a python script, As soon as they enter submit button, I must create a .exe from the inputted code, and then give back the .exe to them...

I tried py2exe and Pyinstaller, but they both require windows machine to create .exe files.

Any solution for this problem ? Appreciate your help, and suggestions.

Thanks, San

Hmm, tricky. I don't think you're going to have any luck with pyexe on PA unless the devs somehow found a way to run Windows virtual machines, and honestly I don't think that's likely right now.

I got optimistic when I found this SO question, the answer to which seems to imply that PyInstaller can cross-compile Windows executables on Linux. However, a quick look at the top of the PyInstaller FAQ reveals that this feature never worked properly and was later removed - they suggest using Wine, but that's not going to fly on a virtualised environment like PA.

Sorry!

Ah. I see what you mean. That's a pretty cool idea, but I don't think we're going to be able to help you. Generating binaries for one system from another is possible, but the gap between Windows and Linux is too great for it to be a reasonable proposition.

Oh ok, thanks a lot for your suggestions, I think I need to tweak my Design and let my Professor know about this obstacle, am not sure if he will be happy :(

Thanks, San

you could rent an extra vps with windows and then call that to make the executables. but it is kind of messy I do agree, but it would work. If you are at a school I guess your prof would have access to a windows machine somewhere?

I don't know if this will help, and I'm reluctant to recommend a sort-of competitor to PAW, but you can get a small instance Windows VM from Azure for about $15.00 per month, which will serve a bottle.py web site and run your py2exe compilations. If this is just a school project for a few months, that is entirely possible. In fact, you could get their 90 day free trial and pay nothing, if you'll be done in 90 days.

You can also get tiny instance VMs from Amazon EC2 running Windows, but I find the Azure ones to be far more convenient.

Either one is significantly more work that just putting a Bottle site on PAW, but much less work than making py2exe work on a linux box.

Best wishes,

-greg

Don't worry Greg :-) I think we'll be the first to admit that providing windows server environments isn't really high on our todo list. So any recommendations for places that do provide it are welcome.