irrationaljared
irrationaljared
MModular
Created by irrationaljared on 10/23/2023 in #questions
Does this error mean that this python library can not be used in Mojo?
Is it expected that this channel might provide more support or should I inquire elsewhere?
10 replies
MModular
Created by irrationaljared on 10/23/2023 in #questions
Does this error mean that this python library can not be used in Mojo?
Unfortunately this produces the same error:
from python import Python

fn search_images(term: String, max_images: UInt8 = 30):
try:
let duckduckgo_search = Python.import_module("duckduckgo_search")
let ddgs = duckduckgo_search.DDGS()

except e:
print("error:", e)

fn main():
search_images("cats")
from python import Python

fn search_images(term: String, max_images: UInt8 = 30):
try:
let duckduckgo_search = Python.import_module("duckduckgo_search")
let ddgs = duckduckgo_search.DDGS()

except e:
print("error:", e)

fn main():
search_images("cats")
Error:
error: cannot import name 'etree' from 'lxml' (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lxml/__init__.py)
error: cannot import name 'etree' from 'lxml' (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lxml/__init__.py)
10 replies
MModular
Created by irrationaljared on 10/23/2023 in #questions
Does this error mean that this python library can not be used in Mojo?
Did you mean in the mojo environment? This all works in Python and yes, in python if you call from lxml import etree it works fine
10 replies
MModular
Created by irrationaljared on 10/23/2023 in #questions
Does this error mean that this python library can not be used in Mojo?
This code is already Mojo specific, but the python equivalent (as best I can tell) does work: https://colab.research.google.com/drive/1KdgI3Q-BFjNckUJYca_YUXMKwmznbyDr?usp=sharing
10 replies