Comments (22)
By the way... the CHANGES.txt mentions "Added Windows executable". What does that mean? I can't find it.
from howdoi.
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.
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.
I believe you would want to use http://www.py2exe.org/
from howdoi.
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.
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.
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.
Sorry, I don't have a windows machine so I can't test it.
from howdoi.
@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.
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!
(yes, download that png and open it as a zip file - this is so github does the hosting!)
from howdoi.
@CamiloMM Neat trick.
from howdoi.
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.
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.
Thx! I put the file in my Dropbox. Will add to the github project soon.
from howdoi.
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.
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.
Hi CamiloMM, Trying to use your exe and having two problems. I'm on a win 7 32bit pc.
- It triggers the UAC every time I try to run it
- 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.
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:
(The manifest is embedded in the file, and hopefully you should see no more sheild overlay icon if you saw one earlier.)
from howdoi.
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.
Glad it worked @isimmons! But I didn't understand - Windows 7 has a /usr/bin
equivalent?
from howdoi.
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.
@isimmons Creative of you! I just drop them in System32 out of mere habit really.
from howdoi.
Related Issues (20)
- pickle.UnpicklingError: the STRING opcode argument must be quoted HOT 4
- Add flag to enable paging / choose pager HOT 3
- Is the tracking parameter t=hj in the duckduckgo URL intentional? HOT 7
- Function `_format_url_to_filename` only used in tests HOT 2
- Error in command `howdoi print in python` HOT 3
- Add checks when it comes to something like `range` HOT 2
- Not installable in python3.5 HOT 3
- Change pull request template "Pull request Type" to checklist HOT 2
- Add page cache to .gitignore HOT 1
- fresh install, stuck at 1.1.9 HOT 4
- Fetch Bing- Chat-GPT HOT 2
- Add method to detect symbols like +, /, etc. in the queries HOT 7
- ERROR: Sorry, couldn't find any help with that topic (use --explain to learn why) HOT 8
- GPT Implementation?
- 403 forbiddeb HOT 2
- Questions about Copilot + Open Source Software Hierarchy
- Coloured output not visible in light terminal window
- Add bash / zsh / fish shell completions
- Add extension to Open VSX registry HOT 1
- Crashes in Python 3.8 (and prior) due to usage of list[str] type annotation by terminaltables3 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from howdoi.