Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: A thread import problem

Thread Tools

Re: A thread import problem

Dennis Lee Bieber
Posts: n/a
On Sat, 21 Jul 2012 17:10:05 -0600, Bruce Sherwood
<(E-Mail Removed)> declaimed the following in

> Thanks, but the problem I need to solve does not permit putting a
> function like runner in the main program. I'm constrained to being
> able to handle the API of VPython (, which lets you write
> programs like the following (call it, which animates a 3D
> cube moving to the right, using OpenGL:
> from visual import box
> b = box()
> while True:
> b.pos.x += 0.001

Well, based on that sample, wrap THAT as "runner"

def runner():
from visual import box
b = box()
while True:
b.pos.x += 0.0001

and don't /call/ runner() until after all the main system is configured.
(And runner could, if need be, be "called" as a thread).

Not having a Mac, I can't do tests... but everything I've seen so
far comes down to NOT IMPORTING anything that tries to spawn threads
/during the import/.

A properly designed module (as I showed with my only
"runs" stuff if loaded as the main program; any other use (import) only
does imports and defines module level entities -- running anything is
deferred for the program that did the import to invoke AFTER the import
Wulfraed Dennis Lee Bieber AF6VN Removed) HTTP://

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: A thread import problem Dieter Maurer Python 0 07-19-2012 08:31 AM
Re: A thread import problem Dennis Lee Bieber Python 0 07-19-2012 12:47 AM
A thread import problem Bruce Sherwood Python 0 07-18-2012 11:03 PM
problem(s) with import from parent dir: "from ../ import sir_robin" per9000 Python 7 02-27-2006 06:36 PM
Problem with import "from omniORB import CORBA, PortableServer" Stefan Seefeld Python 3 04-11-2005 08:54 PM