hello,
I'v run into a bug that I find hard to understand:
In a python module of mine I import system modules
('sys', say) and then use them from within some functions.
However, during program termination I'm calling
one such function and the module reference ('sys')
is 'None' !
What does that mean ? Have those modules already
been unloaded ? If so, why, given that my
current module still references them ?
Any help is highly appreciated,
Stefan 2 1367
Stefan Seefeld wrote: hello,
I'v run into a bug that I find hard to understand:
In a python module of mine I import system modules ('sys', say) and then use them from within some functions.
However, during program termination I'm calling one such function and the module reference ('sys') is 'None' !
Do You register Your function using atexit() ?
This works perfectly fine and as expected for me. I would wonder if the
interpreter was shut down and tries to execute a cleanup thereafter.
Checkout following example code. You may also have a look at the
/lib/atexit.py module see how it works.
import atexit
import sys
def foo():
print sys
atexit.register(foo)
Ciao,
Kay
Stefan Seefeld wrote: In a python module of mine I import system modules ('sys', say) and then use them from within some functions.
However, during program termination I'm calling one such function and the module reference ('sys') is 'None' !
Are you running any daemon threads? This can generally happen when a
daemon thread continues to access module globals during the interpreter
shutdown sequence. At one stage all globals in all modules are rebound
to None, and there's a chance some of your daemon thread code will
execute just as this is occurring, resulting in that kind of error message.
-Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Grant D. Watson |
last post by:
If this has been answered before, or if my terminology is off, please bear with
me; my Python experience is limited to use in one class and to personal
projects.
I'd like to do something rather...
|
by: Josef Meile |
last post by:
Hi,
Textually from the highlights of python 2.4:
"Assigning to None - the compiler now treats assigning to None as a
SyntaxError."
I think in general assignments to built-in types,...
|
by: Brad Tilley |
last post by:
When memory usage is a concern, is it better to do:
from X import Y
or
import X
Also, is there a way to load and unload modules as they are needed. I
have some scripts that sleep for...
|
by: Ron Adam |
last post by:
Does anyone have suggestions on how to improve this further?
Cheers,
Ron_Adam
def getobjs(object, dlist=, lvl=0, maxlevel=1):
""" Retrieve a list of sub objects from an object. """
|
by: Jan Danielsson |
last post by:
Hello all,
I recently started using Python, and I must say I like it. Both the
language and libraries available for it.
Background: I have written an application which I use to keep track
of...
|
by: Ron |
last post by:
Hello,
I have added a Namespace to my vb.net project. The
namespace is the name of the project. Then I start the
project from Sub Main
Module1
Sub Main()
Application.Run(New MyProj.Form1)...
|
by: Paul Helmuth |
last post by:
All,
(here's an easy one)...
This is probably a stupid question - please bare with me as I am new to
dotNet.
How does one reference objects on a form from a module? In 6.0 you could
simply...
|
by: alf |
last post by:
Hi,
I have a reference to certain objects. What is the most pythonic way to
test for valid reference:
if obj:
if None!=obs:
if obj is not None:
|
by: Steven D'Aprano |
last post by:
I have a function that needs a reference to the module object it is
defined in. (For the reason why, if you care, see the thread "doctest not
seeing any of my doc tests" from a week ago.) I know of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |