My current project in python has hit a problem.
The API I wrote to connect to Sharepoint needs to be run in 64-bit python. And the Oracle API needs to be run from python 32 bits (because of server issues).
When I run the scripts separately (each one with its own venv) everything runs perfectly.
However, when I import the sharepoint script in the 32-bit code, it gives an error. And the opposite too, when importing the oracle script into the Sharepoint code.
Note: When I refer to import it would be importing another python file as a module:
from oracle import OracleCon
from sharepoint import SharePointCon
sharepoint connection string:
'Provider = Microsoft.ACE.OLEDB.12.0; WSS;IMEX= 2;RetrieveIds=Yes; DATABASE=site_url; LIST= list_id'
I tried to configure two virtual environments but without success when importing another python file.
Also tried a different connection string to interface with Sharepoint with no success:
'Provider = Microsoft.JET.OLEDB.4.0; WSS;IMEX= 2;RetrieveIds=Yes; DATABASE=site_url; LIST= list_id'
Need: Or find a reliable way to run two versions of python. Or find a way to connect to Sharepoint in 32-bit Python.
Running two different Python versions (32-bit and 64-bit) in the same process is not feasible. In most cases, you can't load both 32-bit and 64-bit libraries and DLLs simultaneously, so it's not practical to have two different Python environments in the same process.
One potential approach to solving your problem is to have the 32-bit and 64-bit components communicate through an intermediary process or service. Here's how you can do it:
Create two separate scripts, one for the 32-bit component (Oracle) and another for the 64-bit component (Sharepoint).
Create an API service or a separate script that runs as a standalone process, which can communicate with both the 32-bit and 64-bit components. This service can act as a bridge between the two parts of your application.
The API service should expose endpoints or methods for the 32-bit and 64-bit components to interact with. This can be done using technologies like REST APIs, message queues, or any other suitable inter-process communication (IPC) mechanism.
In your 32-bit and 64-bit scripts, use libraries or modules to make requests to the API service for data exchange.
The API service will handle requests from both components and mediate the data exchange between them.
This approach decouples the 32-bit and 64-bit components, allowing them to run in separate environments while still enabling them to communicate effectively. It may require some additional development and setup, but it should provide a reliable way to connect the two parts of your application.
As for connecting to Sharepoint in 32-bit Python, you may want to explore alternative libraries or approaches that are compatible with 32-bit Python. Unfortunately, some libraries and drivers may have specific requirements, and you may need to consult the official documentation or support channels for Sharepoint to find a suitable solution for 32-bit Python.