I have a .py file that i want to convert in .exe file. I used cx_Freeze for converting that. But after converting when i'm trying to run the .exe file it shows following error-
H:\Python\Practice\Download Bollywood Song\build\exe.win32-3.5>cmd /K "download_bollywood_song.exe"
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\__init__.py", line 27, in <module>
from . import urllib3
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 28, in <module>
from .packages.six.moves.queue import LifoQueue, Empty, Full
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
ImportError: No module named 'queue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 12, in <module>
__import__(name + "__init__")
File "C:\Program Files\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 24, in <module>
exec(code, m.__dict__)
File "download_bollywood_song.py", line 10, in <module>
File "C:\Program Files\Anaconda3\lib\site-packages\requests\__init__.py", line 63, in <module>
from . import utils
File "C:\Program Files\Anaconda3\lib\site-packages\requests\utils.py", line 24, in <module>
from ._internal_utils import to_native_string
File "C:\Program Files\Anaconda3\lib\site-packages\requests\_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "C:\Program Files\Anaconda3\lib\site-packages\requests\compat.py", line 11, in <module>
from .packages import chardet
File "C:\Program Files\Anaconda3\lib\site-packages\requests\packages\__init__.py", line 29, in <module>
import urllib3
ImportError: No module named 'urllib3'
H:\Python\Practice\Download Bollywood Song\build\exe.win32-3.5>
I tried to install "queue" module using pip install queue
command.
But it shows following error-
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\USER PC>pip install queue
Collecting queue
Could not find a version that satisfies the requirement queue (from versions: )
No matching distribution found for queue
C:\Users\USER PC>
How to solve this issue ?? I'm using python 3.5 on windows 7 32 bit.
EDIT Here is my code that i want to convert to .exe file.
import time;
import requests;
from bs4 import BeautifulSoup;
def get_page(url):
response = requests.get(url);
html = response.text;
return html;
def make_soup(html):
soup = BeautifulSoup(html,"html.parser");
return soup;
def get_movie_link(words):
movie_name = "";
first = True;
for word in words:
if(not first):
movie_name+=" ";
first = False;
movie_name+=word;
movie_link = "";
movie_name = movie_name.title();
first_character = movie_name[0];
url = "http://songsmp3.co/1/bollywood-music/list-" + first_character + ".html";
html = get_page(url);
soup = make_soup(html);
movie_list = soup.find_all("div",class_="list_inside_box");
movies = [];
for movie in movie_list:
movies = movie.find_all("a");
for movie in movies:
name = movie.get_text();
link = movie.get("href");
if(name.find(movie_name) > -1):
movie_link = link;
break;
return movie_name,movie_link;
def get_download_link(movie_name,movie_link):
if(movie_link == ""):
return movie_link;
if(movie_link.find("http://songsmp3.co") == -1):
movie_link = "http://songsmp3.co" + movie_link;
html = get_page(movie_link);
soup = make_soup(html);
links = soup.find_all("div",class_="link-item-zip");
download_link = "";
for link in links:
data = link.find("a");
song_link = data.get("href");
if(download_link == ""):
download_link = song_link;
return download_link;
def download_songs(movie_name,download_link):
if(download_link == ""):
return;
file_name = movie_name + ".zip";
response = requests.get(download_link, stream=True);
file = open(file_name, "wb");
file.write(response.content);
file.close();
return;
start_time = time.clock();
#print("N.B: Becareful about spelling.");
words = input().split();
movie_name,movie_link = get_movie_link(words);
download_link = get_download_link(movie_name,movie_link);
download_songs(movie_name,download_link);
end_time = time.clock();
print("Execution Time: %.2f"%(end_time-start_time));
And here is my setup.py file code-
from cx_Freeze import setup, Executable;
setup(name="Download Bollywood Song",version="1.0.1",description="Download specified movie songs",
executables=[Executable("download_bollywood_song.py")]);
It's hard to tell what the real problem is without pasting your actual code here.
Bear with the fact that in Python 3.x, you have Queue
instead of queue
.(try from multiprocessing import Queue
). As specified in other simillar threads, try doing:
import requests
from multiprocessing import Queue
And get rid of the urllib3
module. requests
may do whatever you're trying to achieve as well.
More, make sure you don't have any queue.py
in your working directory.
As a last resort, I've always found it easier to work with pyinstaller.