944,108 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 2238
  • Python RSS
Oct 31st, 2006
0

Script wont run on different computer

Expand Post »
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:

Quote ...
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

Quote ...
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

python Syntax (Toggle Plain Text)
  1.  
  2. import wx
  3.  
  4. ID_MENU_EXIT = 101
  5. ID_MENU_ABOUT = 102
  6. ID_RADIO_FORWARDS = 201
  7. ID_RADIO_STATIONARY = 202
  8. ID_RADIO_BACKWARDS = 203
  9. ID_SPEED_LABEL = 204
  10. ID_SPEED_SLIDER = 301
  11. ID_SPEED_SLIDER_0 = 302
  12. ID_SPEED_SLIDER_10 = 303
  13. ID_SPEED_JUDDER = 304
  14. Speed = 0
  15. Cylinders = 3
  16. Bristles = 2
  17.  
  18. class Frame1(wx.Frame):
  19. def __init__(self, parent, title):
  20. wx.Frame.__init__(self, parent, -1, title, pos=(150, 150))
  21.  
  22. ### MENU ###
  23.  
  24. # Create a menubar at the top of the frame
  25. MenuBar = wx.MenuBar()
  26. FileMenu = wx.Menu()
  27. HelpMenu = wx.Menu()
  28. # Add items to the menu
  29. FileMenu.Append(ID_MENU_EXIT, "E&xit\tAlt-F4", "Exit the program")
  30. HelpMenu.Append(ID_MENU_ABOUT, "&About", "About the program")
  31.  
  32. # Bind the menu event to an event handler
  33. self.Bind(wx.EVT_MENU, self.OnMenuExit, id=ID_MENU_EXIT)
  34. self.Bind(wx.EVT_MENU, self.OnMenuAbout, id=ID_MENU_ABOUT)
  35.  
  36. # Put the menu on the menubar
  37. MenuBar.Append(FileMenu, "&File")
  38. MenuBar.Append(HelpMenu, "&Help")
  39. self.SetMenuBar(MenuBar)
  40.  
  41.  
  42. ### STATUS BAR ###
  43.  
  44. self.CreateStatusBar()
  45.  
  46. ### MAIN PANEL ###
  47.  
  48. Main_Panel = wx.Panel(self)
  49. Main_Panel.SetBackgroundColour((225,245,255))
  50.  
  51. ### TITLE PANEL ###
  52.  
  53. Title_Panel = wx.Panel(Main_Panel)
  54.  
  55. Title_Label = wx.StaticText(Title_Panel, -1, "Sequence Driven Controller")
  56. Title_Label.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, True))
  57. Title_Label.SetForegroundColour('#00009F')
  58. Title_Sizer = wx.BoxSizer(wx.HORIZONTAL)
  59. Title_Sizer.Add(Title_Label, 1, wx.EXPAND)
  60.  
  61. Title_Panel.SetSizer(Title_Sizer)
  62. Title_Panel.Layout()
  63.  
  64. ### CONTROL PANEL setup ###
  65. Control_Panel = wx.Panel(Main_Panel)
  66. Control_Sizer = wx.BoxSizer(wx.HORIZONTAL)
  67.  
  68. ### AUTOMATIC CONTROL setup ###
  69. Automatic_Control_Panel = wx.Panel(Control_Panel)
  70. Automatic_Control_Sizer = wx.BoxSizer(wx.VERTICAL)
  71.  
  72. ### DIRECTION PANEL ###
  73. Direction_Panel = wx.Panel(Automatic_Control_Panel)
  74.  
  75. RadioButtonForwards = wx.RadioButton(Direction_Panel, ID_RADIO_FORWARDS, "Forwards")
  76. RadioButtonStationary = wx.RadioButton(Direction_Panel, ID_RADIO_STATIONARY, "Stationary")
  77. RadioButtonBackwards = wx.RadioButton(Direction_Panel, ID_RADIO_BACKWARDS, "Backwards")
  78. Speed_Label = wx.StaticText(Direction_Panel, ID_SPEED_LABEL, "Speed = %d" % Speed)
  79. Direction_Sizer = wx.BoxSizer(wx.HORIZONTAL)
  80. Direction_Sizer.Add(RadioButtonForwards, 1, wx.ALIGN_CENTER_VERTICAL)
  81. Direction_Sizer.Add(RadioButtonStationary, 1, wx.ALIGN_CENTER_VERTICAL)
  82. Direction_Sizer.Add(RadioButtonBackwards, 1, wx.ALIGN_CENTER_VERTICAL)
  83. Direction_Sizer.Add(Speed_Label, 1, wx.ALIGN_CENTER_VERTICAL)
  84.  
  85. Direction_Panel.SetSizer(Direction_Sizer)
  86. Direction_Panel.Layout()
  87.  
  88. ### SPEED SLIDER & JUDDER ###
  89. Speed_Slider_Panel = wx.Panel(Automatic_Control_Panel)
  90. Speed_Slider = wx.Slider(Speed_Slider_Panel, ID_SPEED_SLIDER, 0, 0, 10)
  91. Speed_Slider_0 = wx.StaticText(Speed_Slider_Panel, ID_SPEED_SLIDER_0, " 0")
  92. Speed_Slider_10 = wx.StaticText(Speed_Slider_Panel, ID_SPEED_SLIDER_10, "10")
  93. #self.Bind(wx.EVT_SLIDER, self.OnSlider, id=ID_SPEED_SLIDER)
  94. Speed_Judder = wx.ToggleButton(Speed_Slider_Panel, ID_SPEED_JUDDER, "Judder")
  95.  
  96. Speed_Slider_Sizer = wx.BoxSizer(wx.HORIZONTAL)
  97. Speed_Slider_Sizer.Add(Speed_Slider_0, 1, wx.ALIGN_CENTER_VERTICAL)
  98. Speed_Slider_Sizer.Add(Speed_Slider, 10, wx.ALIGN_CENTER_VERTICAL)
  99. Speed_Slider_Sizer.Add(Speed_Slider_10, 1, wx.ALIGN_CENTER_VERTICAL)
  100. Speed_Slider_Sizer.Add(Speed_Judder, 2, wx.ALIGN_CENTER_VERTICAL)
  101. Speed_Slider_Panel.SetSizer(Speed_Slider_Sizer)
  102. Speed_Slider_Panel.Layout()
  103.  
  104. ### AUTOMATIC CONTROL layout ###
  105. Automatic_Control_Sizer.Add(Direction_Panel, 1, wx.ALIGN_CENTER_HORIZONTAL)
  106. Automatic_Control_Sizer.Add(Speed_Slider_Panel, 1, wx.ALIGN_CENTER_HORIZONTAL)
  107. Automatic_Control_Panel.SetSizer(Automatic_Control_Sizer)
  108. Automatic_Control_Panel.Layout()
  109.  
  110. ### MANUAL CONTROL ###
  111. Manual_Control_Panel = wx.Panel(Control_Panel)
  112. Bristles_Panel = wx.Panel(Manual_Control_Panel)
  113. Cylinders_Panel = wx.Panel(Manual_Control_Panel)
  114. Manual_Control_Sizer = wx.BoxSizer(wx.HORIZONTAL)
  115. Bristles_Sizer = wx.BoxSizer(wx.VERTICAL)
  116. Cylinders_Sizer = wx.BoxSizer(wx.VERTICAL)
  117. Bristles = []
  118. Cylinders = []
  119.  
  120. for x in Bristles:
  121. Bristles_x = wx.CheckBox(Manual_Control_Panel, 400+x, "Bristle %d" %d)
  122. Bristles_Sizer.Add(Bristles_x, 1, wx.ALIGN_RIGHT)
  123. for x in Cylinders:
  124. Cylinders_x = wx.CheckBox(Manual_Control_Panel, 500+x, "Cylinnder %d" %d)
  125. Cylinders_Sizer.Add(Cylinders_x, 1, wx.ALIGN_RIGHT)
  126. Bristles_Panel.SetSizer(Bristles_Sizer)
  127. Bristles_Panel.Layout()
  128. Cylinders_Panel.SetSizer(Cylinders_Sizer)
  129. Cylinders_Panel.Layout()
  130. Manual_Control_Sizer.Add(Bristles_Panel, 1, wx.ALIGN_CENTER_VERTICAL)
  131. Manual_Control_Sizer.Add(Cylinders_Panel, 1, wx.ALIGN_CENTER_VERTICAL)
  132. Manual_Control_Panel.SetSizer(Manual_Control_Sizer)
  133. Manual_Control_Panel.Layout()
  134.  
  135.  
  136. ## CONTROL PANEL layout ###
  137. Control_Sizer.Add(Automatic_Control_Panel, 1, wx.EXPAND)
  138. #Control_Sizer.Add(Manual_Control_Panel, 1, wx.EXPAND)
  139. Control_Panel.SetSizer(Control_Sizer)
  140. Control_Panel.Layout()
  141.  
  142. ### MAIN SIZER CONTROL ###
  143.  
  144. Main_Sizer = wx.BoxSizer(wx.VERTICAL)
  145. Main_Sizer.Add(Title_Panel, 1, wx.ALIGN_CENTER_HORIZONTAL)
  146. Main_Sizer.Add(Control_Panel, 8, wx.ALIGN_CENTER_HORIZONTAL)
  147.  
  148. Main_Panel.SetSizer(Main_Sizer)
  149. Main_Sizer.Layout()
  150.  
  151. ### MENU EVENTS ###
  152.  
  153. def OnMenuExit(self, evt):
  154. self.Close()
  155.  
  156. def OnMenuAbout(self, evt):
  157. dlg = wx.MessageDialog(self, "Sequence Driven Controller\n"
  158. "Mark Walker 2006/07\n"
  159. "Final Year Engineering Project", "Sequence Driven Controller",
  160. wx.OK | wx.ICON_INFORMATION)
  161. dlg.ShowModal()
  162. dlg.Destroy()
  163.  
  164. ### CONTROLLER DRIVEN EVENTS ###
  165. def OnSlider(self, evt):
  166. Speed = Speed_Slider_Panel.Speed_Slider.GetValue()
  167. Direction_Panel.Speed_Label.Refresh()
  168.  
  169.  
  170. class wxPyApp(wx.App):
  171. def OnInit(self):
  172. frame = Frame1(None, "Sequence Driven Controller")
  173. self.SetTopWindow(frame)
  174. frame.Show(True)
  175. return True
  176.  
  177. app = wxPyApp(redirect=True)
  178. app.MainLoop()

Any help would be greatly appreciated!


Thanks,

Mark
Last edited by MarkWalker84; Oct 31st, 2006 at 8:50 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MarkWalker84 is offline Offline
19 posts
since Oct 2006
Oct 31st, 2006
0

Re: Script wont run on different computer

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.
Reputation Points: 404
Solved Threads: 180
Nearly a Posting Virtuoso
bumsfeld is offline Offline
1,422 posts
since Jul 2005
Oct 31st, 2006
0

Re: Script wont run on different computer

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MarkWalker84 is offline Offline
19 posts
since Oct 2006
Oct 31st, 2006
0

Re: Script wont run on different computer

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?
Last edited by bumsfeld; Oct 31st, 2006 at 11:32 am.
Reputation Points: 404
Solved Threads: 180
Nearly a Posting Virtuoso
bumsfeld is offline Offline
1,422 posts
since Jul 2005
Oct 31st, 2006
0

Re: Script wont run on different computer

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MarkWalker84 is offline Offline
19 posts
since Oct 2006
Oct 31st, 2006
0

Re: Script wont run on different computer

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
Reputation Points: 404
Solved Threads: 180
Nearly a Posting Virtuoso
bumsfeld is offline Offline
1,422 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Tkinter weirdness
Next Thread in Python Forum Timeline: Py2exe and Jython - Please help me!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC