File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 2
2
Methods for uploading/managing files on Amazon S3.
3
3
"""
4
4
from seleniumbase .config import settings
5
+ from seleniumbase .fixtures import shared_utils
5
6
6
7
already_uploaded_files = []
7
8
@@ -19,15 +20,23 @@ def __init__(
19
20
selenium_access_key = settings .S3_SELENIUM_ACCESS_KEY ,
20
21
selenium_secret_key = settings .S3_SELENIUM_SECRET_KEY ,
21
22
):
22
- from boto .s3 .connection import S3Connection
23
+ try :
24
+ from boto .s3 .connection import S3Connection
25
+ except Exception :
26
+ shared_utils .pip_install ("boto" , version = "2.49.0" )
27
+ from boto .s3 .connection import S3Connection
23
28
24
29
self .conn = S3Connection (selenium_access_key , selenium_secret_key )
25
30
self .bucket = self .conn .get_bucket (log_bucket )
26
31
self .bucket_url = bucket_url
27
32
28
33
def get_key (self , file_name ):
29
34
"""Create a new Key instance with the given name."""
30
- from boto .s3 .key import Key
35
+ try :
36
+ from boto .s3 .key import Key
37
+ except Exception :
38
+ shared_utils .pip_install ("boto" , version = "2.49.0" )
39
+ from boto .s3 .key import Key
31
40
32
41
return Key (bucket = self .bucket , name = file_name )
33
42
Original file line number Diff line number Diff line change @@ -5498,7 +5498,12 @@ def get_pdf_text(
5498
5498
5499
5499
with warnings.catch_warnings():
5500
5500
warnings.simplefilter("ignore", category=UserWarning)
5501
- from pdfminer.high_level import extract_text
5501
+ try:
5502
+ from pdfminer.high_level import extract_text
5503
+ except Exception:
5504
+ shared_utils.pip_install("pdfminer.six")
5505
+ from pdfminer.high_level import extract_text
5506
+
5502
5507
if not password:
5503
5508
password = ""
5504
5509
if not maxpages:
@@ -5723,7 +5728,11 @@ def save_element_as_image_file(
5723
5728
file.write(element_png)
5724
5729
# Add a text overlay if given
5725
5730
if type(overlay_text) is str and len(overlay_text) > 0:
5726
- from PIL import Image, ImageDraw
5731
+ try:
5732
+ from PIL import Image, ImageDraw
5733
+ except Exception:
5734
+ shared_utils.pip_install("Pillow")
5735
+ from PIL import Image, ImageDraw
5727
5736
5728
5737
text_rows = overlay_text.split("\n")
5729
5738
len_text_rows = len(text_rows)
You can’t perform that action at this time.
0 commit comments