Hi,

I've just installed python & wxpython on my university computer. I went to run a script that was working just fine on my computer at home last night and i am greeted with this message:

Traceback (most recent call last):
File "C:\Documents and Settings\d22601\My Documents\Project_4\Python Files\Sequence Driven Controller.py", line 7, in <module>
import wx
File "C:\Python25\lib\site-packages\wx-2.7.1-msw-ansi\wx\__init__.py", line 44, in <module>
from wx._core import *
File "C:\Python25\lib\site-packages\wx-2.7.1-msw-ansi\wx\_core.py", line 4, in <module>
import _core_
ImportError: DLL load failed: The specified module could not be found.

Dont really understand what is going on here.

I have also built this program into a .exe using py2exe. On atempting to run the program i am tolf that

This application has failed to start because MSVCP71.dll was not found

despite the face that MSVCP71.dll isin the same directory as the .EXE file (and that same .EXE file worked on my girlfriend's computer last night!)

Im totally puzzled!

Here is the source code incase that is of any help top anyone

import wx
 
ID_MENU_EXIT   = 101
ID_MENU_ABOUT  = 102
ID_RADIO_FORWARDS   = 201
ID_RADIO_STATIONARY = 202
ID_RADIO_BACKWARDS  = 203
ID_SPEED_LABEL      = 204
ID_SPEED_SLIDER     = 301
ID_SPEED_SLIDER_0   = 302
ID_SPEED_SLIDER_10  = 303
ID_SPEED_JUDDER     = 304
Speed = 0
Cylinders = 3
Bristles  = 2
 
class Frame1(wx.Frame): 
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, pos=(150, 150))
 
### MENU ###
 
        # Create a menubar at the top of the frame
        MenuBar = wx.MenuBar()
        FileMenu = wx.Menu()
        HelpMenu = wx.Menu() 
        # Add items to the menu                
        FileMenu.Append(ID_MENU_EXIT, "E&xit\tAlt-F4", "Exit the program")
        HelpMenu.Append(ID_MENU_ABOUT, "&About", "About the program")
 
        # Bind the menu event to an event handler        
        self.Bind(wx.EVT_MENU, self.OnMenuExit, id=ID_MENU_EXIT)
        self.Bind(wx.EVT_MENU, self.OnMenuAbout, id=ID_MENU_ABOUT)
 
        # Put the menu on the menubar
        MenuBar.Append(FileMenu, "&File")
        MenuBar.Append(HelpMenu, "&Help")
        self.SetMenuBar(MenuBar)
 
 
### STATUS BAR ###
 
        self.CreateStatusBar()
 
### MAIN PANEL ###
 
        Main_Panel = wx.Panel(self)
        Main_Panel.SetBackgroundColour((225,245,255))
 
### TITLE PANEL ###
 
        Title_Panel = wx.Panel(Main_Panel)
 
        Title_Label = wx.StaticText(Title_Panel, -1, "Sequence Driven Controller")
        Title_Label.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, True))
        Title_Label.SetForegroundColour('#00009F')
        Title_Sizer = wx.BoxSizer(wx.HORIZONTAL)
        Title_Sizer.Add(Title_Label, 1, wx.EXPAND)
 
        Title_Panel.SetSizer(Title_Sizer)
        Title_Panel.Layout()
 
### CONTROL PANEL setup ###
        Control_Panel = wx.Panel(Main_Panel)
        Control_Sizer = wx.BoxSizer(wx.HORIZONTAL)
 
### AUTOMATIC CONTROL setup ###
        Automatic_Control_Panel = wx.Panel(Control_Panel)
        Automatic_Control_Sizer = wx.BoxSizer(wx.VERTICAL)
 
### DIRECTION PANEL ###
        Direction_Panel = wx.Panel(Automatic_Control_Panel)
 
        RadioButtonForwards = wx.RadioButton(Direction_Panel, ID_RADIO_FORWARDS, "Forwards")
        RadioButtonStationary = wx.RadioButton(Direction_Panel, ID_RADIO_STATIONARY, "Stationary")
        RadioButtonBackwards = wx.RadioButton(Direction_Panel, ID_RADIO_BACKWARDS, "Backwards")
        Speed_Label = wx.StaticText(Direction_Panel, ID_SPEED_LABEL, "Speed = %d" % Speed)
        Direction_Sizer = wx.BoxSizer(wx.HORIZONTAL)
        Direction_Sizer.Add(RadioButtonForwards, 1, wx.ALIGN_CENTER_VERTICAL)
        Direction_Sizer.Add(RadioButtonStationary, 1, wx.ALIGN_CENTER_VERTICAL)
        Direction_Sizer.Add(RadioButtonBackwards, 1, wx.ALIGN_CENTER_VERTICAL)
        Direction_Sizer.Add(Speed_Label, 1, wx.ALIGN_CENTER_VERTICAL)
 
        Direction_Panel.SetSizer(Direction_Sizer)
        Direction_Panel.Layout()
 
### SPEED SLIDER & JUDDER ###
        Speed_Slider_Panel = wx.Panel(Automatic_Control_Panel)
        Speed_Slider = wx.Slider(Speed_Slider_Panel, ID_SPEED_SLIDER, 0, 0, 10)
        Speed_Slider_0 = wx.StaticText(Speed_Slider_Panel, ID_SPEED_SLIDER_0, " 0")
        Speed_Slider_10 = wx.StaticText(Speed_Slider_Panel, ID_SPEED_SLIDER_10, "10")
        #self.Bind(wx.EVT_SLIDER, self.OnSlider, id=ID_SPEED_SLIDER)
        Speed_Judder = wx.ToggleButton(Speed_Slider_Panel, ID_SPEED_JUDDER, "Judder")
 
        Speed_Slider_Sizer = wx.BoxSizer(wx.HORIZONTAL)
        Speed_Slider_Sizer.Add(Speed_Slider_0, 1, wx.ALIGN_CENTER_VERTICAL)
        Speed_Slider_Sizer.Add(Speed_Slider, 10, wx.ALIGN_CENTER_VERTICAL)
        Speed_Slider_Sizer.Add(Speed_Slider_10, 1, wx.ALIGN_CENTER_VERTICAL)
        Speed_Slider_Sizer.Add(Speed_Judder, 2, wx.ALIGN_CENTER_VERTICAL)
        Speed_Slider_Panel.SetSizer(Speed_Slider_Sizer)
        Speed_Slider_Panel.Layout()
 
### AUTOMATIC CONTROL layout ###
        Automatic_Control_Sizer.Add(Direction_Panel, 1, wx.ALIGN_CENTER_HORIZONTAL)
        Automatic_Control_Sizer.Add(Speed_Slider_Panel, 1, wx.ALIGN_CENTER_HORIZONTAL)
        Automatic_Control_Panel.SetSizer(Automatic_Control_Sizer)
        Automatic_Control_Panel.Layout()
 
### MANUAL CONTROL ###
        Manual_Control_Panel = wx.Panel(Control_Panel)
        Bristles_Panel = wx.Panel(Manual_Control_Panel)
        Cylinders_Panel = wx.Panel(Manual_Control_Panel)
        Manual_Control_Sizer = wx.BoxSizer(wx.HORIZONTAL)
        Bristles_Sizer = wx.BoxSizer(wx.VERTICAL)
        Cylinders_Sizer = wx.BoxSizer(wx.VERTICAL)
        Bristles = []
        Cylinders = []
 
        for x in Bristles:
            Bristles_x = wx.CheckBox(Manual_Control_Panel, 400+x, "Bristle %d" %d)
            Bristles_Sizer.Add(Bristles_x, 1, wx.ALIGN_RIGHT)
        for x in Cylinders:
            Cylinders_x = wx.CheckBox(Manual_Control_Panel, 500+x, "Cylinnder %d" %d)
            Cylinders_Sizer.Add(Cylinders_x, 1, wx.ALIGN_RIGHT)
        Bristles_Panel.SetSizer(Bristles_Sizer)
        Bristles_Panel.Layout()
        Cylinders_Panel.SetSizer(Cylinders_Sizer)
        Cylinders_Panel.Layout()
        Manual_Control_Sizer.Add(Bristles_Panel, 1, wx.ALIGN_CENTER_VERTICAL)
        Manual_Control_Sizer.Add(Cylinders_Panel, 1, wx.ALIGN_CENTER_VERTICAL)
        Manual_Control_Panel.SetSizer(Manual_Control_Sizer)
        Manual_Control_Panel.Layout()
 
 
## CONTROL PANEL layout ###
        Control_Sizer.Add(Automatic_Control_Panel, 1, wx.EXPAND)
        #Control_Sizer.Add(Manual_Control_Panel, 1, wx.EXPAND)
        Control_Panel.SetSizer(Control_Sizer)
        Control_Panel.Layout()
 
### MAIN SIZER CONTROL ###
 
        Main_Sizer = wx.BoxSizer(wx.VERTICAL)
        Main_Sizer.Add(Title_Panel, 1, wx.ALIGN_CENTER_HORIZONTAL)
        Main_Sizer.Add(Control_Panel, 8, wx.ALIGN_CENTER_HORIZONTAL)
 
        Main_Panel.SetSizer(Main_Sizer)
        Main_Sizer.Layout()
 
### MENU EVENTS ###
 
    def OnMenuExit(self, evt):
        self.Close()
 
    def OnMenuAbout(self, evt):
        dlg = wx.MessageDialog(self, "Sequence Driven Controller\n"
                              "Mark Walker 2006/07\n"
                              "Final Year Engineering Project", "Sequence Driven Controller",
                               wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()
 
### CONTROLLER DRIVEN EVENTS ###
    def OnSlider(self, evt):
        Speed = Speed_Slider_Panel.Speed_Slider.GetValue()
        Direction_Panel.Speed_Label.Refresh()
 
 
class wxPyApp(wx.App):
    def OnInit(self):
        frame = Frame1(None, "Sequence Driven Controller")
        self.SetTopWindow(frame)
        frame.Show(True)
        return True
 
app = wxPyApp(redirect=True)
app.MainLoop()

Any help would be greatly appreciated!


Thanks,

Mark

Nice wxPython code! MSVCP71.dll is the Microsoft C++ runtime library used by wxPython. You should install it in C:\WINDOWS\system32\. That should take care of your problems.

I noticed you are using Python25, make sure that wxPython and Py2Exe are also for that version of Python.

Thanks for the help :-)

I just copied the file to system32. There was already one in there so overwrote that (after backup of course! lol) but still no joy :-( either from the py2exe .EXE version or from the python GUI / Shell

Ive tried 2.4 and 2.5 (both with their appropriate wx & py2exe installs) with full un installs inbetween - down to registry level.

REALLY dont want to have to reinstall windows! lol


Mark

The only other DLL I can think of is the interpreter itself in Python25.dll, also in C:\Windows\System32\.
Py2exe puts that right into the .exe file depending on your setup options.

Did you run py2exe with the windows program and single-exe option?

I've tried all the 'setup.py' files i could find in the py2exe folder.

Whats most confusing at the moment though is that the code itself wont even run from the Python Shell (IDLE). Ive been using the basic editor you get with the Python install and just hitting F5 to run the code via the Python Shell but nada, nothing - just that error message.

Looking through your traceback message, the file it can't find is _core_.pyd, which is a Python DLL. On my machine this file is in the C:\Python25\Lib\site-packages\wx-2.6-msw-unicode\wx\ folder. Notice that I have a slightly older version of wxPython for Python25. You might want to check your corresponding folder for this .pyd file

This article has been dead for over six months. Start a new discussion instead.