"Modul 'OS' hat kein Attribut 'add_dll_directory'",Python

Python-Programme
Guest
 "Modul 'OS' hat kein Attribut 'add_dll_directory'",

Post by Guest »

Ich erhalte den folgenden Fehler, während ich meinen Code in AWS Lambda ausführt. Der Code führt die Datei in VSCODE aus. < /P>
Die Version von Pandas, die ich verwende:(.venv) PS C:\code\data_check_lambda> pip show pandas
Name: pandas
Version: 2.2.3

(.venv) PS C:\code\data_check_lambda> python --version
Python 3.11.4
< /code>
Dies ist das Codesegment im Python -Skript (nur kopieren die relevanten Teile. Es funktioniert einwandfrei, wenn ich in VSCODE (auf einem Windows -Computer) ausführe, aber den Fehler bei der Bereitstellung als AWS Lambda angibt Ich habe verschiedene Python -Version 3.11 und denselben Fehler ausprobiertimport pandas as pd

# Convert the items to a DataFrame
df = pd.DataFrame(items)

# Update primary and secondary contact info with names instead of emails

df['primary'] = df['primary'].apply(lambda x: email_to_name(x) if isinstance(x, (str, list)) else x)
df['secondary_contact'] = df['secondary_contact'].apply(lambda x: email_to_name(x) if isinstance(x, (str, list)) else x)
< /code>

{
"errorMessage": "module 'os' has no attribute 'add_dll_directory'",
"errorType": "AttributeError",
"requestId": "",
"stackTrace": [
" File \"/var/lang/lib/python3.9/importlib/init.py\", line 127, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n",
" File \"\", line 1030, in _gcd_import\n",
" File \"\", line 1007, in _find_and_load\n",
" File \"\", line 986, in _find_and_load_unlocked\n",
" File \"\", line 680, in _load_unlocked\n",
" File \"\", line 850, in exec_module\n",
" File \"\", line 228, in _call_with_frames_removed\n",
" File \"/var/task/lambda_function.py\", line 3, in \n import pandas as pd\n",
" File \"/opt/python/pandas/init.py\", line 12, in \n _delvewheel_patch_1_8_2()\n",
" File \"/opt/python/pandas/init.py\", line 9, in _delvewheel_patch_1_8_2\n os.add_dll_directory(libs_dir)\n"]

}
< /code>
I try using Python 3.9, tried using the PATH variable.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post