I have this line of code:
xl = win32.gencache.EnsureDispatch("Excel.Application")
This works fine when I run the script.
However, I exported the python script to be an exe with py2exe, and after running the exe, it gives this error:
KeyError: '{000208D5-0000-0000-C000-000000000046}'
All I did was:
setup.py
from distutils.core import setup
import py2exe
setup(console=['xerxes2excel.py'])
Related
I have converted my .py file to .exe using pyinstaller by
pyinstaller newpass.py
and it makes exe file successfully! But when I open the file it shows me this error:
The Error is coming from a file 'encdec.py' line 1 but my Code in that file is as follows.
from passlib.context import CryptContext
from cryptography.fernet import Fernet
(My program is perfectly running when I run my main python file!)
As soon as I open the file it shows this error and the program closes.
Note:- I am not importing 'config parser' in any of the files.
My files structure are as follows:-
Here, newpass.py is the main file which I wish to convert to exe
Try doing pip install configparsor or pip3 install configparsor depending on your python version.
Using py2exe I create an exe version of my script with instructions I found here. The script compiles well and generates a dist and build folder each but when I run the program on the command line it gives this error. N.B the script works fine on my IDE environment, however I intend give a colleague the exe version.How can I fix this error?
Traceback (most recent call last):
File "tester2.py", line 4, in <module>
ImportError: No module named mechanize
here is the setup.py file:
from distutils.core import setup
import py2exe
setup(
console = ['tester2.py'],
zipfile = None,
)
You have to declare your dependencies.
This is my setup
setup(
executables=executables,
options=options,
name='bla',
version='0.3',
packages=[...],
url='',
license='',
author='',
author_email='',
description='', requires=['pandas', 'unidecode', 'click',
'xlsxwriter'] // you would have to add mechanize here
)
Have you added files to the build?
Pls have a look at include option in setup.py: exe built with cx_Freeze, PyQt5, Python3 can't import ExtensionLoader_PyQt5_QtWidgets.py and run
Also here's my solution to similar problem, how to add files to build and run them later: Python - create an EXE that runs code as written, not as it was when compiled
I have successfully converted .py file to .exe file using py2exe.
I can successfully run the .py file,if i run it standalone.However, when iam trying to run the .exe file, it throws an error as seen in attached image.
In my .py file, i have the below import statements:
import xlrd,xlwt,xlutils.copy,re,time,openpyxl,os
from openpyxl.styles import Alignment
from openpyxl import load_workbook
I have also accordingly tweaked setup.py file to include these packages as below setup.py code shows
from distutils.core import setup
import py2exe
setup(
console=['vu_t2.py'],
options = {
'py2exe': {
'packages': ['xlrd','xlwt','xlutils','openpyxl','openpyxl.workbook']
}
}
)
Please refer the attached error snapshot
I used the below command to run py2exe
python setup.py py2exe
openpyxl only supports distribution via pip.
I am a beginner in python and django. This error keeps coming, even after installing cx_freeze from http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
I am trying to make an executable file and I want to run my server through it, which I normally do by:
manage.py runserver
I am currently using commands:
setup.py build
I have already tried:
pyinstaller --name=mysite myproject_dir/manage.py
and my setup.py file contains
import sys
from distutils.core import setup
from cx_Freeze import setup, Executable
setup(
name = "Management System",
version = "1.0",
description = "A Database Management System",
py_modules=['virtualenv'],
executables = [Executable("manage.py", base = "Win32GUI")])
I have also tried py2exe, it doesn't work. You can also suggest to read something for this knowledge.
Here is the image of error that keeps appearing on running the exe file
If I use this command:
Barcode.exe runserver
There also comes an error
WindowsError: [Error 3] The system cannot find the path specified:'C:\\Users\\D ell\\AppData\\Local\\Temp\\_MEI85~1\\Entry\\migrations/*.*'
I have created a python application which fetches data from a google spreadsheet and performs the required operation and outputs files with the data accordingly. The application works fine through my ide and the console. I'm using gspread and Tkinter for accessing the google sheets and for the GUI respectively.
However when I try to create it into an exe. I keep running into errors.
First I tried using py2exe but I keep getting the error
ImportError: No module named gspread
My setup.py is
from distutils.core import setup
import py2exe
setup(console = ["app.py"], options={"py2exe":{"includes":["gspread"]}})`
and I run it with the command python setup.py py2exe
I also tried pyInstaller using the command pyinstaller app.py and I get the same error. Although in this case the command executes completely and the exe is created but when I run it the console window flashes saying
ImportError: No module named gspread
I also tried using cx_freeze to create the executable. The command I use is
python setup.py build_exe -s -p gspread,json,oauth2client.client,os
This creates the executable but I get the error
I\O operation failed
for line 187 of my code
credentials = oauth2client.client.GoogleCredentials.get_application_default()
credentials = credentials.create_scoped(['https://spreadsheets.google.com/feeds'])
gc = gspread.authorize(credentials) #line 187
which I've caught using a try/except block on line 187