Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
User avatar
PhobosK
Posts: 16
Joined: Fri Dec 26, 2008 11:12 pm

HOWTO easy compile SubDownloader on Windows for free

Sat Dec 27, 2008 8:57 am

I hope this post will help all the Windows users of SubDownloader that are dissatisfied with the new silly and insipid "Dual-Licensing" policy of the application concerning Windows OS binaries.

I wrote this HOWTO for the users that want to have SubDownloader packed and independent of any Python on the machine... like in situations when you put it on another MS computer, or you uninstall the Python and it's modules etc.

For those of you that value their time or find it difficult to follow the steps described here, @saxicek has already prepared the free version following the guides and provides it at his Launchpad account. So download it from there and use it.

The steps to follow for the building of SubDownloader on Windows are:

1. Depending on your Windows version, install
Microsoft Visual C++ 2005 Redistributable Package (x86) from here
or
Microsoft Visual C++ 2008 Redistributable Package (x86) from here.

2. Download and install the Windows 2.6.(x) version of Python from here:
http://www.python.org/download/
(the actual link is: http://www.python.org/ftp/python/2.6.1/python-2.6.1.msi)
As an install folder use something simple (for convenience) like:
C:\python26

3. Download and install the PyQt4 for Windows (it should match the Python version you have downloaded in step 1 i.e. PyQt-Py2.6-gpl...) from here:
http://www.riverbankcomputing.co.uk/sof ... t/download
(the actual link is: http://www.riverbankcomputing.co.uk/sta ... .4.4-2.exe )

4. Download and install the py2exe binary (it should match the Python version you have downloaded in step 1 i.e. ...win32-py2.6.exe ) from here:
http://sourceforge.net/project/showfile ... e_id=35995
(the actual link is: http://downloads.sourceforge.net/py2exe ... g_mirror=0)

5. Download the latest sources of SubDownloader from here:
https://code.launchpad.net/subdownloader/+download
(the actual link is: http://code.launchpad.net/subdownloader ... 0.9.tar.gz)

6. Create the folder "PROJECTS" in the install folder of Python from step 1 (C:\python26\PROJECTS)

7. Extract the SubDownloader-2.0.9.tar.gz into C:\python26\PROJECTS.
You may use any archive program for that like IZArc (it is a very good and free application - http://www.izarc.org/download.html)
After the extraction of the archive you should have this directory containing all the files of SubDownloader:
C:\python26\PROJECTS\subdownloader

8. Download and put in the C:\python26\PROJECTS\subdownloader folder these two files:
"setup.py"
"installer.nsi"

9. Download and install the NSIS (Nullsoft Scriptable Install System) from here:
http://sourceforge.net/project/showfile ... e_id=15374
(the actual link is: http://downloads.sourceforge.net/nsis/n ... g_mirror=0)

10. Open Windows command shell (Command Prompt) window and issue these commands in it (copy/paste them one line at a time):

Code: Select all

cd C:\python26\PROJECTS\subdownloader
..\..\python -OO setup.py py2exe


11. You are ready with the build. The result is in the "dist" directory - C:\python26\PROJECTS\subdownloader\dist.
Test if the build works by starting the C:\python26\PROJECTS\subdownloader\dist\SubDownloader.exe file.
If it works you may proceed to next step and use the "dist" folder without making an install package
OR
you may go directly to step 14 to prepare the install package of SubDownloader.

12. Uninstall any previous versions of SubDownloader, copy the "dist" directory to your "Program Files" folder, rename it to: "SubDownloader" and create a shortcut to the "SubDownloader.exe" file.

13. Start the SubDownloader.exe and you will have a working, no time limit and open source, free application for Windows.


Below are the steps to prepare an install package of the already built SubDownloader.exe.

14. Open Windows command shell (Command Prompt) window and issue these commands in it (copy/paste them one line at a time):

Code: Select all

cd C:\python26\PROJECTS\subdownloader
"C:\Program Files\NSIS\makensis.exe" installer.nsi


15. You are ready with the install package. You may find it in the C:\python26\PROJECTS\subdownloader folder as:
C:\python26\PROJECTS\subdownloader\SubDownloader_2.0.9-Installer.exe.
Now you have a python independent and free SubDownloader Windows installer that will uninstall the shareware version you have and install the free version.

If you have any questions i will be glad to help you.

NOTE: In case the above steps produce errors on your OS or something is not working, please try to use the Python 2.5.2 version and all the other versions of the programs listed above for that python version. Links are as follow:
1. Python - http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi
2. PyQt4 - http://www.riverbankcomputing.co.uk/sta ... .4.3-1.exe
3. py2exe - http://downloads.sourceforge.net/py2exe ... irror=kent


Your feedback on this is very welcome because probably some tweaking of this HOWTO is needed for the different Windows versions, but for this to happen you should share your experience in the building and packaging. To do this please answer the following questions no matter if building works or not:
1. What version of Windows you are using (98, XP, Vista)?
2. What version of Python/PyQt4/py2exe did you use?
3. Did you need to install some additional stuff from MS like Microsoft Visual C++ 2005 Redistributable Package (x86) etc.?
4. Did you need to do anything else not described in the HOWTO to make all work?

Thanks in advance...

WARNING: Distributing the installer or the binaries that you get from this HOWTO breaks the EULAs with Microsoft and this makes their distribution ILLEGAL. BTW the same issue is with the official SubDownloader installer/binaries... :)
Last edited by PhobosK on Sun Mar 21, 2010 11:11 am, edited 7 times in total.

User avatar
oss
Site Admin
Posts: 4351
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Sat Dec 27, 2008 12:58 pm

thanks for posting this, I hope it will help to some windows users. Should be nice to have freeware version for windows...we will see, what will happen.

netquim
Posts: 1
Joined: Sat Dec 27, 2008 4:29 pm

Sat Dec 27, 2008 4:35 pm

When compiling you may get an error saying that dll MSVCP90.dll is missing.

It's not very clean but I didn't want to mess with the windows install.
So I copied the libraries from:
C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
to:
C:\Python26\PROJECTS\subdownloader\build\bdist.win32\winexe\bundle-2.6
Then in the does prompt, just added the above path:
set PATH=%PATH%;C:\Python26\PROJECTS\subdownloader\build\bdist.win32\winexe\bundle-2.6

and then re-tun the command:
..\..\python -OO setup.py py2exe

If you don't have MSVCP90.dll DLL in your system, you may need to install the Microsoft Visual C++ 2005 Redistributable Package (x86 (http://www.microsoft.com/downloads/deta ... laylang=en).

zagadka
Posts: 5
Joined: Mon Apr 30, 2007 1:24 pm

Sat Dec 27, 2008 9:15 pm

Any success getting this to work on Windows Vista?

The installer for py2exe keeps crashing for me, but it doesn't give me any information about what went wrong.

BTW, what is the point of using py2exe anyway if you don't distribute the files? Python alone with PyQt4 is enough to run subdownloader2 straight from source.

User avatar
PhobosK
Posts: 16
Joined: Fri Dec 26, 2008 11:12 pm

Sun Dec 28, 2008 4:01 am

Any success getting this to work on Windows Vista?


Yeah i run all that on my Vista... but after your post i tried it on my two other Vista machines and on one of them it had problems... I guess it is some problem with MS shared libs...

In this case try using the Python 2.5.2 version and all the other versions of the programs listed above for that python version. Links are as follow:
1. Python - http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi
2. PyQt4 - http://www.riverbankcomputing.co.uk/sta ... .4.3-1.exe
3. py2exe - http://downloads.sourceforge.net/py2exe ... irror=kent

And it should work on Vista with no problem.


BTW, what is the point of using py2exe anyway if you don't distribute the files? Python alone with PyQt4 is enough to run subdownloader2 straight from source.


Yep you are totally right about the py2exe, but i wrote this HOWTO for people that want to have it packed and independent of any Python on the machine... like in situations when you put it on another MS computer, or you uninstall the Python and it's modules etc.

BTW if you run the SubDownloader from sources with the standard python.exe you will have a command prompt window opened. To avoid that just use the pythonw.exe creating a shortcut containing the command line like this:

Code: Select all

pythonw.exe run.py

stathis95194
Posts: 2
Joined: Sat Oct 04, 2008 8:12 am

Sun Dec 28, 2008 11:54 am

works like a charm.

Thanks a lot PhobosK.

And a Happy New Year to everyone.

User avatar
PhobosK
Posts: 16
Joined: Fri Dec 26, 2008 11:12 pm

Sun Dec 28, 2008 2:26 pm

stathis95194 wrote:works like a charm.


Thanks a lot for the feedback.
But for tweaking the HOWTO so it works best, can you tell us:
1. What version of Windows you use (98, XP, Vista)?
2. What version of Python/PyQt4/py2exe u used?
3. Did you need to install the some additional stuff from MS like Microsoft Visual C++ 2005 Redistributable Package (x86) ?
4. Did you need to do anything else not described in the HOWTO to make all work?

Thanks in advance...

zagadka
Posts: 5
Joined: Mon Apr 30, 2007 1:24 pm

Sun Dec 28, 2008 4:47 pm

Yep you are totally right about the py2exe, but i wrote this HOWTO for people that want to have it packed and independent of any Python on the machine... like in situations when you put it on another MS computer, or you uninstall the Python and it's modules etc.


You make a good point here, sometimes an .exe file is just easier.

BTW if you run the SubDownloader from sources with the standard python.exe you will have a command prompt window opened. To avoid that just use the pythonw.exe creating a shortcut containing the command line like this:

Code: Select all

pythonw.exe run.py



I am well aware of this, but since installing Python associated .py files with python.exe. I just changed the association to pythonw.exe.

User avatar
PhobosK
Posts: 16
Joined: Fri Dec 26, 2008 11:12 pm

Mon Dec 29, 2008 2:19 am

Hi all,
I have updated the HOWTO adding the section for preparing an install package using NSIS (steps 8, 14 and 15).
The install package is old versions sensitive and uninstalls them before proceeding with the installation of the free version.

stathis95194
Posts: 2
Joined: Sat Oct 04, 2008 8:12 am

Mon Dec 29, 2008 7:40 am

PhobosK wrote:
stathis95194 wrote:works like a charm.


Thanks a lot for the feedback.
But for tweaking the HOWTO so it works best, can you tell us:
1. What version of Windows you use (98, XP, Vista)?
2. What version of Python/PyQt4/py2exe u used?
3. Did you need to install the some additional stuff from MS like Microsoft Visual C++ 2005 Redistributable Package (x86) ?
4. Did you need to do anything else not described in the HOWTO to make all work?

Thanks in advance...


1. I run subdownloader on 2 PC's now. The installation of python/PyQt4/py2exe was done on Windows Server 2003 and i just copied the resulting folder to Windows Vista Ultimate w/ SP1. In both PC's subdownloader is working perfectly.
2. I installed Python 2.6.1 and PyQt4 and py2exe to match that release from the 1st post.
3. Even though i was missing MSVCP90.dll i didn't download the Visual C++ Redistributable from Microsoft. I followed the instructions of netquim a couple of posts above:
It's not very clean but I didn't want to mess with the windows install.
So I copied the libraries from:
C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
to:
C:\Python26\PROJECTS\subdownloader\build\bdist.win32\winexe\bundle-2.6
Then in the does prompt, just added the above path:
set PATH=%PATH%;C:\Python26\PROJECTS\subdownloader\build\bdist.win32\winexe\bundle-2.6

and then re-tun the command:
..\..\python -OO setup.py py2exe
4. Nope. Everything worked like described. I just used different paths for the installation, but if anyone uses the default paths used in PhobosK instructions, they shouldn't run into any problems.

tempmani
Posts: 1
Joined: Sun Jan 04, 2009 6:30 pm

The executable logged an ImportError

Sun Jan 04, 2009 6:49 pm

First Thanks a ton for your effort in creating such a tutorial.

Coming back to the issue I had faced...

1. What version of Windows you use
Ans: Windows XP
2. What version of Python/PyQt4/py2exe u used?
Ans: the ones mentioned above, downloaded exactly the same links
3. Did you need to install the some additional stuff from MS like Microsoft Visual C++ 2005 Redistributable Package (x86) ?
Ans: No
4. Did you need to do anything else not described in the HOWTO to make all work?
Ans: Yes:

At this step -

Code: Select all

 11. You are ready with the build. The result is in the "dist" directory - C:\python26\PROJECTS\subdownloader\dist.
Test if the build works by starting the C:\python26\PROJECTS\subdownloader\dist\SubDownloader.exe file.


I tried executing SubDownloader.exe and nothing happened except a log file being generated. The log file contained below

Code: Select all

Traceback (most recent call last):
  File "run.py", line 56, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "gui\__init__.pyo", line 23, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "modules\SDService.pyo", line 28, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "modules\subtitlefile.pyo", line 22, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "languages\Languages.pyo", line 20, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "languages\Languages.pyo", line 20, in <module>
ImportError: No module named autodetect_lang


Hence, I had to comment out the line

Code: Select all

 import languages.autodetect_lang as autodetect_lang
in "languages\Languages.py" and everything worked fine.

Just my 2 cents

c1hermes
Posts: 1
Joined: Sat Jan 10, 2009 6:11 pm

Sat Jan 10, 2009 6:20 pm

Many many thanks for your excellent tutorial.
I am not a programmer but following your instructions I was able to compile the executable and the installer successfully.

My PC is a Windows XP SP3
Installed the Microsoft Visual C++ 2008 Redistributable Package (x86).
Everything else was installed as per your tutorila (python 2.6

One small problem I ran into when creating the installer was an error at line 194 of the installer.nsi (File "dist\*.dll") - since it could not find any dll's in the \dist directory it would abort.

I simply commented out the line and the installer compiled successfully.

I then ran it on another PC (Vista) and it installed correctly.

Many many thanks again.

pko
Posts: 13
Joined: Wed Jan 24, 2007 3:06 pm

Fri Jan 23, 2009 9:29 pm

c1hermes wrote:My PC is a Windows XP SP3
Installed the Microsoft Visual C++ 2008 Redistributable Package (x86).
Everything else was installed as per your tutorila (python 2.6


Not a programmer neither but it worked!!!

I use Windows XP SP3 also and found exactly the same problems and solved them the same way (copy C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375\msvcp90.dll build\bdist.win32\winexe\bundle-2.6\ and comment line 194 in installer.nsi)

By the way, I have now a "SubDownloader_2.0.9-Installer_(no.nags.nor.expiration).exe" file that installs like a charm :P

It is a pity the file being non-distributable :-( How can I know if it is all correct? mine is 8.238.322 bytes long and has the folowing hash:
AB4211F6DDD3B258A86DE1A5067D6983

To calculate the hash, I simply copied it to emule's "incoming" directory and let the program hash it, then you simply look at "details" for the file inside emule.

Are your versions exactly like mine or do they have a different length/hash?

User avatar
PhobosK
Posts: 16
Joined: Fri Dec 26, 2008 11:12 pm

Fri Jan 23, 2009 10:39 pm

The hash usually is unique for every computer the binary is compiled on. It depends on a lot of things like libraries etc. so i cannot say if it is the right or the wrong hash.
If your SubDownloader 2.0.9 works it means the hash is the right one ;)

pko
Posts: 13
Joined: Wed Jan 24, 2007 3:06 pm

Fri Jan 23, 2009 11:02 pm

It gave me some warnings when generating the file but it seems to work OK, I downloaded some subs with it, so apparently it is OK Thank you for your awesome tutorial! :P

Return to “Programs using OS”

Who is online

Users browsing this forum: No registered users and 2 guests