Pyinstaller: Creating an Executable with Several Dependencies - "TypeError"

1.4k views Asked by At

I have a fairly large wx application I have built and would like to compile it into a executable file. I have done this before, however, the process has become more complicated because I am working with several other dependencies (packages) and my program is composed of multiple .py files. Before I post the code, I'll describe the initial error message.

Error Message

I navigate to the directory where all my script files are saved and execute the following command in the prompt (cmd) window:

pyinstaller -F AMI_GUI.py

Pyinstaller initially runs okay however at the end of process I get this error:

TypeError: iteration over non-sequence

I have posted a screen shot to better show this error.

First Pyinstaller Attempt Gets ValueTypeError

What is interesting is what happens next, I try running the same command again, 'pyinstaller -F AMI_GUI.py'. But this time the error does not occur, instead the process finishes and in my dist directory my executable has been created. I am also able to run the executable.

Run Pyinstaller a second time. No Error!

Has anyone ran into this problem before when compiling applications using pyinstaller? I have not done extensive testing on the executable file yet, but I am worried in trusting it because pyinstaller process failed on the first time.

I have posted part of my code which shows the dependencies and some of my code:

AMI_GUI.py

from sqlalchemy import create_engine, Column, Integer, String, DateTime, Float, UnicodeText, VARCHAR, NVARCHAR, TEXT, DATE, distinct, ForeignKey, Table,or_,and_
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
import math
import wx
import wx.lib.mixins.listctrl  as  listmix
from ObjectListView import ObjectListView, ColumnDefn
from ObjectListView import EVT_CELL_EDIT_STARTING
from ObjectListView import EVT_CELL_EDIT_FINISHING
import os
import time

from wigets import File_Manager,Date_Filter,Log_In,EVT_LOGIN
from AMI_component import engine
from AMI_component import Exception,Meter,Transformer,except_heading,meter_heading
import csv

## Link to Database
Session = sessionmaker( bind=engine )                   ## Import the database engine from component file
session = Session()                                     ## Create session to database

AMI_components.py

import os,math,random,string,operator,logging,csv
from itertools import count

from sqlalchemy import create_engine, Column, Integer, String, DateTime, Float, UnicodeText, VARCHAR, NVARCHAR, TEXT, DATE, distinct, ForeignKey, Table
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from AMI_subroutine import getFiles,incident_filt,getDB,get_manf,dayMonth,check_voltage,violation_filt,rec,get_dateTime
admin_dir = "C:\project\AMI"
# print os.getcwd()
os.chdir(admin_dir)

engine = create_engine("sqlite:///./AMI_case.db", #"oracle://rai:raisys@njnwkora18_oraa.db.pseg.com",
                       echo=False)

Session = sessionmaker( bind=engine )
session = Session()

Not sure if this code will help, but it does show how what import statements I have used...the some of the main file that I am running with the pyinstall command is AMI_GUI.py.

1

There are 1 answers

0
Werner On BEST ANSWER