473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unload extension modules when python22.dll unloads... [using C extension interpreter]

I have a unexpected issue with python modules (well i kind of know
why, but i am trying to find if there is a way around)

Intro:
I am allowing an external application to actually run python scripts.
The external application i am taking about is a test sequencer with a
lots of functionality. So the external application has a lot of gui
and all the testing logic is done in python. Things work fine when i
run regular code and i have been running python code successfully
(several thousand lines of code) for over eight months.

Issue:
Well, now there is an requirement to throw a dialog box from
python. I built a wxpython code and was able to successfully show the
dialog box from python. But when i run the code for the second time,
it wouldnt work..

the wxpython's dll probably does some initialization during
dll_process_attach... but i never see the pyd get unloaded ( i
actually unload python22.dll after each run). this is a big problem
now. i did not really consider about this earlier. so i cannot
actually Guarantee proper fuctioning of the python code...

is there a way for me to *unload dynamically loaded extension module*
each time and then reload it each time when the code is called...

thanks a lot in advance.
Jul 18 '05 #1
3 3180
Anand wrote:
I have a unexpected issue with python modules (well i kind of know
why, but i am trying to find if there is a way around)

Intro:
I am allowing an external application to actually run python scripts.
The external application i am taking about is a test sequencer with a
lots of functionality. So the external application has a lot of gui
and all the testing logic is done in python. Things work fine when i
run regular code and i have been running python code successfully
(several thousand lines of code) for over eight months.

Issue:
Well, now there is an requirement to throw a dialog box from
python. I built a wxpython code and was able to successfully show the
dialog box from python. But when i run the code for the second time,
it wouldnt work..

the wxpython's dll probably does some initialization during
dll_process_attach... but i never see the pyd get unloaded ( i
actually unload python22.dll after each run). this is a big problem
now. i did not really consider about this earlier. so i cannot
actually Guarantee proper fuctioning of the python code...

is there a way for me to *unload dynamically loaded extension module*
each time and then reload it each time when the code is called...

thanks a lot in advance.


Another thought: If you are running on Win32, (iirc) there is a way to
present a dialog box directly from a python script using win32all. This
method, while not portable, has the advantage of not having to go
through all the usual GUI gobbledy-gook to set up and process the dialog
....

import win32gui

retval = win32gui.DialogBox(....)

HTH,
----------------------------------------------------------------------------
Tim Daneliuk tu****@tundraware.com
PGP Key: http://www.tundraware.com/PGP/

Jul 18 '05 #2
Tim,
thanks a lot for your suggestions. this is lot simpler than my
wxpython approach.

Thanks,
Anand.

Tim Daneliuk <tu****@tundraware.com> wrote in message news:<dg************@eskimo.tundraware.com>...
Another thought: If you are running on Win32, (iirc) there is a way to
present a dialog box directly from a python script using win32all. This
method, while not portable, has the advantage of not having to go
through all the usual GUI gobbledy-gook to set up and process the dialog
...

import win32gui

retval = win32gui.DialogBox(....)

HTH,
----------------------------------------------------------------------------
Tim Daneliuk tu****@tundraware.com
PGP Key: http://www.tundraware.com/PGP/

Jul 18 '05 #3
Anand wrote:
Tim,
thanks a lot for your suggestions. this is lot simpler than my
wxpython approach.

Thanks,
Anand.

Tim Daneliuk <tu****@tundraware.com> wrote in message news:<dg************@eskimo.tundraware.com>...
Another thought: If you are running on Win32, (iirc) there is a way to
present a dialog box directly from a python script using win32all. This
method, while not portable, has the advantage of not having to go
through all the usual GUI gobbledy-gook to set up and process the dialog
...

import win32gui

retval = win32gui.DialogBox(....)

HTH,

There is, of course, still _some_ fiddling around you have to do to setup
the Box for native Win32 API calls ... I'd be interested in seeing a
sample of the code when you get it working...

The one downside of doing things this way (beyond the lack of portability)
is that you do have to know the win32 apis well, which I do not. But it
does seem to be a more quick-n-dirty approach than having to go through
all the overhead of wxWin or Tkinter setup ...
--
----------------------------------------------------------------------------
Tim Daneliuk tu****@tundraware.com
PGP Key: http://www.tundraware.com/PGP/
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Isal | last post by:
hi all, i'm new to python and i'm trying to build a python extension on win98, written in c++, with cygwin. but i keep having the same error message, and i didnt't find much resources on the web...
36
by: Tim Churches | last post by:
If a compiled Python extension module B includes code from some other software A which is licensed only under the GPL, do other Python programmes, C, which import module B also need to be licensed...
10
by: John Underwood | last post by:
Can I use python23_d and python23 to develop an extension for a commercial application uses python22.dll? (Providing that I do not use any new features found only in 2.3.) I would bulld version...
8
by: Torsten Mohr | last post by:
Hi, i write an extension module in C at the moment. This module does some work on some own data types that consist of some values. The functions that can change the data are written in C. ...
7
by: Guy Robinson | last post by:
Hello, I have a directory of python scripts that all (should) contain a number of attributes and methods of the same name. I need to import each module, test for these items and unload the...
1
by: Donkey Cart Racer | last post by:
Hi, I have a page - page1 which opens a window1 where users can look at tasks, in window1 users can click and open window2 where they can create new tasks I want to refresh window1 when...
1
by: tyler | last post by:
I've written a small python extension but I'm having difficulty loading it at runtime. The source for my extension is a module which is a member of a package is organized as follows. ...
1
by: Petr Prikryl | last post by:
Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules...
5
by: Adam Atlas | last post by:
Does anyone know if it would be possible to create a CPython extension -- or use the ctypes module -- to access Python's own embedding API (http://docs.python.org/api/initialization.html &c.)?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.