I have two script a.py and b.py I need to run b.py script on one virtual env and a.py on one virtual env. Is there any solution. a.py run venv based on header
a.py
#! /var/www/cgi-bin/luemail_new/venv/bin/python
import cgi
import json
import logging
import datetime
import re
import smtplib
from email.utils import parseaddr
from library_script import process_library_jobs
print("Going to library")
if subject == "Library Package":
process_library_jobs(subject)
b.py
#! /var/www/cgi-bin/luemail_new/pypdf_env/bin/python
from PyPDF2 import PdfFileReader
pdf_path=r"/home/flock/Downloads/certificate.pdf"
def process_library_jobs(subject):
with open(pdf_path, 'rb') as f:
pdf = PdfFileReader(f)
information = pdf.getDocumentInfo()
print(information)
number_of_pages = pdf.getNumPages()
print(subject)
return number_of_pages
I have two virtual environment “venv” and “pypdf_env”. a.py should work on venv and b.py should work on pypdf_env. And I am passing subject to second script process_library_jobs(). Is there any solution with best practice.