Git Product home page Git Product logo

Comments (22)

CamiloMM avatar CamiloMM commented on August 15, 2024

By the way... the CHANGES.txt mentions "Added Windows executable". What does that mean? I can't find it.

from howdoi.

gleitz avatar gleitz commented on August 15, 2024

Yes I tried adding a windows executable but the existence of the file on PyPI broke the pip installs for linux users so I removed it.

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

Hi @gleitz, could you please tell me how did you make such an executable? I want to make one for a friend. Or if you have time, host it here on GitHub (either the executable or a guide), it would be of benefit to people.

from howdoi.

gleitz avatar gleitz commented on August 15, 2024

I believe you would want to use http://www.py2exe.org/

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

Any specific directions? I had less than success with PyInstaller so I'm asking if you had any pitfall with py2exe or it went just right in the first try.

from howdoi.

gleitz avatar gleitz commented on August 15, 2024

Not sure. Previously I created the exe through the pypi upload process but it didn't work. Let me know if you have better success!

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

I followed the tutorial of py2exe, by adding an import directive to setup.py and running python setup.py py2exe and seemingly it worked but there isn't any howdoi.exe like it thought there would be. The files under ./dist are:

10/04/2012  23:31            59.904 bz2.pyd
11/01/2013  21:08         1.582.231 library.zip
10/04/2012  23:31         2.303.488 python27.dll
10/04/2012  23:31             9.728 select.pyd
10/04/2012  23:31           686.592 unicodedata.pyd
10/04/2012  23:31            49.664 w9xpopen.exe
10/04/2012  23:31           285.184 _hashlib.pyd

(and library.zip only contains python files)

from howdoi.

gleitz avatar gleitz commented on August 15, 2024

Sorry, I don't have a windows machine so I can't test it.

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

@gleitz Luckily, I'm making progress. I had to edit the setup.py script though. I'll post here as soon as I have a working binary.

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

Ok, this took me more time than I'm willing to admit so I don't even know everything I did in detail.
I had to edit setup.py, I think it boils down to:

from setuptools import setup, find_packages
import py2exe // <-- this line
import howdoi
import os

// and the following changes to that `setup()` call parameters:

      console=['howdoi/howdoi.py'],
      options={
        'py2exe': 
        {
            'includes': ['lxml._elementpath', 'gzip'],
        }
      },
      #entry_points={
      #  'console_scripts': [
      #      'howdoi = howdoi.howdoi:command_line_runner',
      #      ]
      #  },

And I think I installed a package or two, but not sure if necessary. Then I had a folder with an exe that I could run. Great! Now, I started removing the files until it broke and placing them back (actually, just renaming) to strip down everything possible. This shaved a lot of size.

Then, I used 7-zip to create a self-extracting exe that takes out that mess and runs it.

The result is a howdoi.exe that's completely self-contained in one .exe file, runs just as fast as a normal script execution, and does not require a Python installed. I even took the liberty of making it have an icon with resource hacker :)

And here it is, it weights just 2.1 MB, really fricking small!
howdoi

(yes, download that png and open it as a zip file - this is so github does the hosting!)

from howdoi.

GUIpsp avatar GUIpsp commented on August 15, 2024

@CamiloMM Neat trick.

from howdoi.

gleitz avatar gleitz commented on August 15, 2024

I downloaded the PNG but I'm on a Mac without 7-zip. When I ran unzip howdoi.zip it created howdoi.zip.cpgz.

Just put the .exe in a Dropbox?

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

I don't use neither Dropbox nor Macs, but since it's a Unix under the hood, this should work as it does in Linux:

wget https://f.cloud.github.com/assets/2404138/61743/529cc4ec-5c79-11e2-8da1-27bc9260dac2.png -O file.zip
unzip file.zip

In other words, you just have to rename it. It gives a warning, but uncompresses it correctly anyway.
The MD5 of howdoi.exe should be: 02cad5ab928d809b3d6d35945514f9a2

from howdoi.

gleitz avatar gleitz commented on August 15, 2024

Thx! I put the file in my Dropbox. Will add to the github project soon.

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

I'm glad, someone will probably welcome it :)

By the way, since it's fixed on r57 (unlike running the script), whenever there's some major change I can make another .exe. So you or someone else can comment here and I take a look at it. I couldn't automate it so I'm not going to make one per revision, but as long as there's an important change and someone is interested I can get into it.

Still it would be awesome to get it automated. I don't use git, otherwise I'd look into making pull requests 'n stuff.

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

Now, I know this is a very small thing, but I think it might be good to indicate next to the download that it doesn't require Python installed - since it's just a bit below the words "requires Python", people might think the executable also does. Just the word "standalone" should be intuitive enough.

from howdoi.

isimmons avatar isimmons commented on August 15, 2024

Hi CamiloMM, Trying to use your exe and having two problems. I'm on a win 7 32bit pc.

  1. It triggers the UAC every time I try to run it
  2. It executes and closes before I can read what it said.

I'm running it from command line and tried both running it directly by being in the directory where it is, and also tried putting it in a directory on my system path. I don't think that's relevant but just in case.

It is trying to run as administrator but in properties it is not set to run as administrator which is why I'm guessing it is firing the UAC.

Oh and also it triggers Avast to start analyzing it. Maybe it's all because it's an unknown publisher? Anyway, any ideas how to get around this without disabling UAC?

Thanks

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

Hah, running XP here so I should have imagined this kind of thing would happen. It shouldn't try to run as administrator, really. I believe this is a problem with 7z sfx module, I think to avoid this one needs to add a manifest of some sort on the .exe.

(Yes, I just confirmed this is a problem with the 7z sfx module...)

Ok, I have added a manifest that should make it compatible with Vista, 7 and 8, so please test it to see if it works:
howdoi

(The manifest is embedded in the file, and hopefully you should see no more sheild overlay icon if you saw one earlier.)

from howdoi.

isimmons avatar isimmons commented on August 15, 2024

Yep, that fixed it. win7 puts the shield on it and wants to run it as administrator when extracted to the desktop but as soon as I copied it over to my User/bin directory it changes to normal and runs fine.

Thanks

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

Glad it worked @isimmons! But I didn't understand - Windows 7 has a /usr/bin equivalent?

from howdoi.

isimmons avatar isimmons commented on August 15, 2024

No, sorry, I just picked it up from using Linux and made my own c:\users\username\bin which is added to the system path and is where I store 3rd party exe, and my .bat, and .cmd files for easy use from the command line.

from howdoi.

CamiloMM avatar CamiloMM commented on August 15, 2024

@isimmons Creative of you! I just drop them in System32 out of mere habit really.

from howdoi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.