473,385 Members | 1,409 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.

pulling multiple instances of a module into memory

I have a Python app, spam.py, that uses a C shared library, eggs.so.
This shared library is an interface that makes connections to another
system (Ham), and among other things uses callback functions.
Therefore, if I want to make multiple connections to Ham, I need
eggs.so to be instantiated in memory multiple times so that everything
works fine.

Right now, in spam.py, let's say I want to make two connections to the
Ham system. I call

eggs.start('Connection1')
eggs.start('Connection2')

On the second one, I get a 'duplicate call' error. Because Python is
optimized to only load a module into memory once, I can never make more
than one connection from the same Python script.

Any ideas to work around this would be great.

Gabriel

Jul 19 '05 #1
2 1527
in spam.py, how about something like this:

try:
eggs.someFunction()
except:
import eggs

Jul 19 '05 #2
Do you have control over the eggs.so module? Seems to me the best
answer is to make the start method return a connection object

conn1 = eggs.start('Connection1')
conn2 = eggs.start('Connection2')

Jul 19 '05 #3

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

Similar topics

7
by: Daniel Pryde | last post by:
Hi there. I'm currently trying to learn Python, my aim being to create my final year project at university using only Python instead of Java. I've run into a problem though while trying to make...
1
by: Martin V. | last post by:
Hello, Is the multiple instances capability of SQL2K mature enough for a Production system? We're looking at upgrading our hardware but the proposed solution calls for consolidating two...
11
by: Mike | last post by:
Looking to find any information on how to properly configure multiple instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking for information on how the multiple instance settings...
5
by: Shuaib | last post by:
I wonder if anybody could shed some light on a problem I am encountering. I have written a program in C that runs on Solaris 2.8. At busy times of the day there may be multiple instances of it...
10
by: John | last post by:
I currently have a Windows Service that runs Transactions that are very Processor/Memory Intensive. I have a requirement to deploy multiple instances of the Web service on the Same server. Each...
0
by: CNN_news | last post by:
I would like to run multiple instances of TYPO3 (a cms written in PHP) on a single server. You can run multiple websites in two methods: multisite or multiple instances. In multiple...
5
by: jm.suresh | last post by:
Hi all, .... __slots__ = .... .... __slots__ = .... .... __slots__ = .... Traceback (most recent call last): File "<stdin>", line 1, in <module>
3
by: =?Utf-8?B?VG9kZA==?= | last post by:
What is the memory footprint of static methods of a windows app running on a server when the server spins up multiple instances of the application? In my envirionment, we have a Citrix server...
3
by: Marcin Kalicinski | last post by:
How do I use multiple Python interpreters within the same process? I know there's a function Py_NewInterpreter. However, how do I use functions like Py_RunString etc. with it? They don't take any...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.