Python[Issue in converting .py to .exe using py2exe


 
Thread Tools Search this Thread
Top Forums Programming Python[Issue in converting .py to .exe using py2exe
# 1  
Old 08-10-2015
Python[Issue in converting .py to .exe using py2exe

Hi Experts,

Good morning.

I am trying to convert my hello.py to hello .exe file.

I followed the steps as mentioned in the documentation but getting errors in the end. Please help.

What I did as below--


Created hello.py file

Code:
print ("Hello world!")

raw_input('')


Then created setup.py in the same folder.

Code:
from distutils.core import setup
import py2exe

setup(console=['hello.py'])

I did install and it ran fine
python setup.py install

Code:
running install
running build
running install_egg_info
Removing C:\Python33\Lib\site-packages\UNKNOWN-0.0.0-py3.3.egg-info
Writing C:\Python33\Lib\site-packages\UNKNOWN-0.0.0-py3.3.egg-info

While in the last step when I run

python setup.py py2exe it gives error.

Code:
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    setup(console=['hello.py'])
  File "C:\Python33\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Python33\lib\distutils\dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
    cmd_obj.run()
  File "C:\Python33\lib\site-packages\py2exe\distutils_buildexe.py", line 188, i
n run
    self._run()
  File "C:\Python33\lib\site-packages\py2exe\distutils_buildexe.py", line 267, i
n _run
    builder.analyze()
  File "C:\Python33\lib\site-packages\py2exe\runtime.py", line 157, in analyze
    self.mf.import_package(modname[:-2])
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 91, in import_package

    self.import_hook(name)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 117, in import_hook
    module = self._gcd_import(name)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 267, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 320, in _find_and_loa
d
    self._scan_code(module.__code__, module)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 358, in _scan_code
    self.safe_import_hook(name, mod, fromlist, level)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 135, in safe_import_h
ook
    self.import_hook(name, caller, fromlist, level)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 117, in import_hook
    module = self._gcd_import(name)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 267, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 320, in _find_and_loa
d
    self._scan_code(module.__code__, module)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 358, in _scan_code
    self.safe_import_hook(name, mod, fromlist, level)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 135, in safe_import_h
ook
    self.import_hook(name, caller, fromlist, level)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 117, in import_hook
    module = self._gcd_import(name)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 267, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 297, in _find_and_loa
d
    loader = importlib.find_loader(name, path)
  File "C:\Python33\lib\importlib\__init__.py", line 62, in find_loader
    loader = sys.modules[name].__loader__
AttributeError: 'module' object has no attribute '__loader__'


Last edited by Don Cragun; 08-10-2015 at 12:29 AM.. Reason: Change HTML and NOPARSE tags to CODE tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

[Python] - subprocess issue

So I have this basic script, see below import subprocess import shlex command = "gcloud projects list" subprocess.check_output(shlex.split(command)) subprocess.check_call(shlex.split(command)) The subprocess.check_call(shlex.split(command)) actually return what I expect. It returns... (6 Replies)
Discussion started by: scj2012
6 Replies

2. Shell Programming and Scripting

Issue Spliting String in Python

I have a string like below Note: I have have a single to any number of comma "," seperated string assigned to jdbc_trgt variable. I need to split jdbc_trgt using comma(,) as the delimiter. I tried the below but it fails as i dont know how can i read each split string iterately. for... (4 Replies)
Discussion started by: mohtashims
4 Replies

3. Shell Programming and Scripting

Python Thread Execution Issue . . .

Greetings! I set up a basic threading specimen which does the job:#!/usr/bin/python import threading class a(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print("thread a finished") class b(threading.Thread): ... (0 Replies)
Discussion started by: LinQ
0 Replies

4. Shell Programming and Scripting

Weird issue in converting XLSX to TXT

Hi Guys, I have used Perl scripting to convert XLSX file to TXT file using Perl module Spreadsheet::XLSX. I processed one XLSX file having one column and 65k rows of data . Strangely ,It is merging data for every 2047 row and I could see data in TXT file as Ex: Suppose in XLSX file ,if... (2 Replies)
Discussion started by: Rajk459
2 Replies

5. Shell Programming and Scripting

Converting specific Excel file tabs to CSV in Python

Hi list, This is probably something really simple, but I am not particularly familiar with Python so I thought I would ask as I know that python has an excel module. I have an excel document with multiple tabs of data and graphs. One of the tabs is just data which I require to have dumped to... (8 Replies)
Discussion started by: landossa
8 Replies

6. UNIX for Dummies Questions & Answers

Converting EPS to JPG issue

I'm trying to convert a file with the following command: convert -verbose image.eps -resize 500x image.jpg The problem is that the output image loses it's quality and gets all blurred when resized. It shouldn't happen since I'm working with a vector. I'm pretty sure that I'm missing a... (0 Replies)
Discussion started by: rlopes
0 Replies

7. Shell Programming and Scripting

Crontab Permissions Issue with Python

I have a cron on a Linux server that isn't executing properly. CRON (with specific info replaced): MAILTO=emailaddress@server.com */2 * * * * python /data/site/cron.py OUTPUT: python: can't open file '/data/site/cron.py ': No such file or directoryAdditional info - The python path is... (3 Replies)
Discussion started by: theHire
3 Replies

8. Shell Programming and Scripting

Converting perl to exe

Hello All, I want to convert .pl to .exe with all include libraries like: WIN32/OLE..... Please suggest me how i will proceed for this.... (7 Replies)
Discussion started by: suvenduperl
7 Replies

9. Programming

how To edit exe to insert a serial no wich can be usd by runing exe

At time of installation I have to open the resource. and i have to insert a string serial number in the exe. please provide me code to edit the exe (in solaris) to insert a serial number which can be used by exe at run time. (6 Replies)
Discussion started by: ssahu
6 Replies
Login or Register to Ask a Question