0

This is the error I got:

Traceback (most recent call last):
    File "C:\Python34\lib\tkinter\__init__.py", line 1487, in __call__
return self.func(*args)
    File "interface.py", line 231, in testsubmit
    File "interface.py", line 202, in optimizations
    File "C:\Python34\lib\site-packages\pulp-1.5.6-py3.4.egg\pulp\pulp.py", line 1619, in solve
status = solver.actaualSolve(self,**kwargs)
AttributeError: 'NoneType' object has no attribute 'actualSolve'

I used py2exe of python 3.4 in windows. I can run the same code from python and after converting the .exe file, it doesn't run and gives the above error message. There was no error while converting from .py to .exe. The code is making a GUI using Tkinter and also there is an linear optimization utilizing pulp. Does anyone have any idea why is that? Part of the code:

from tkinter import *
from tkinter.ttk import *
from pulp import *

class Gui(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()
def optimizations(self):
    numberEzroofmtg, lngths, wdths, hghts = self.lengthsEzmtg()        
    prob = pulp.LpProblem('the simple problem', LpMinimize)

    self.indices = ['206_rail','164_rail','124_rail','84_rail']

    self.x = pulp.LpVariable.dict("x_%s", self.indices,lowBound =0, cat = LpInteger)
    # length data
    self.lengths = dict(zip(self.indices, [206, 164, 124, 84]))
    prob += sum([self.x[i]*self.lengths[i] for i in self.indices]) >= lngths
    prob += self.x['124_rail'] <= 1
    prob.solve()

    return int(self.x['164_rail'].value())*2, int(self.x['124_rail'].value())*2
    self.quit()

def testsubmit(self):
    Rails_164, Rails_124 = self.optimizations()

    self.entries['Number of Helio Std. Rail (L=164)'].delete(0,END)
    self.entries['Number of Helio Std. Rail (L=164)'].insert(0, Rails_164 )
Dubar Alam
  • 79
  • 1
  • 10

1 Answers1

1

It looks like the pulp module can't find an available solver. From what I can tell it uses external DLLs and commands to do the solving, and py2exe has no way of knowing this so doesn't include them. You need to tell py2exe explicitly that you're using these files, probably by using the dist-file keyword in your setup.py script.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
  • 1
    Sorry, I am almost new in Python. Can you please give me a direction how can I use the dist-file keyword? – Dubar Alam Jul 22 '14 at 17:13