confluent-kafka-python
confluent-kafka-python copied to clipboard
AttributeError: module 'os' has no attribute 'add_dll_directory' - Python 3.9 - Lambda Function in AWS
Description
I have created a layer with confluent_kafka-2.0.2 in lambda function. when I simply run it, I get error at import statement.
Code :
Attached Zip file used for creating layer : confluentkafka.zip
How to reproduce
Checklist
Please provide the following information:
- [ ] confluent-kafka-python and librdkafka version (
confluent_kafka 2.0.2)andconfluent_kafka.libversion()): - [ ] Apache Kafka broker version:
- [ ] Client configuration:
{...} - [ ] Operating system: windows
- [ ] Provide client logs (with
'debug': '..'as necessary) - [ ] Provide broker log excerpts
- [x] Critical issue
The issue seems similar to https://github.com/confluentinc/confluent-kafka-python/issues/1462. Please check.
#1462 was resolved by switching to Linux. I need to get it resolved in windows
#1462 was resolved by switching to Linux. I need to get it resolved in windows
can you describe the fix in more details?
#1462 got resolved when the operating system was switched to Linux.
were you able to fix this issue
Experienced the same issue; using windows os environment in development, AWS Lambda (AWS Linux) python 3.11 runtime in production.
The error is resolved by creating package within linux/unix environment using virualization. add_dll_directory applies to windows os. runtime and is not compatible when running on linux. For more read #1462
@ANJALI2980 is this issue still needing to be resolved or were you able to find a solution?
Does anyone in this thread have a compatible lambda-function layer for AWS Lambda with any version between python3.9-3.11?. There are lots of questions with outdated answers on this.