-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError occurs when I run device_detector.py #35
Comments
Please include the python version you're using, and the exact code you're executing. |
I probably don't have a grasp on what I'm supposed to be running. I am a NOOB to Python, even though I am starting to develop Python test tools for a living. All I am doing is running the following at the command prompt: Which you indicated is not the way to run it. I looked at the Usage Notes, but all I see is the results of running the tool. Could you please provide me with some guidance. I don't want to keep bugging you about this. It's probably very easy to run in your eyes, but I am a bit confused. Please let me know how I am supposed to run this script so that I get results. Thank you. BTW: My python version is 3.8.5. |
Open your python interpreter and paste the following lines (from the Usage Notes) from device_detector import DeviceDetector
ua = 'Mozilla/5.0 (Linux; Android 4.3; C5502 Build/10.4.1.B.0.101) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.136 Mobile Safari/537.36'
device = DeviceDetector(ua).parse()
device.all_details If you want to parse a file of UA strings, you'll have to write your own python script to do it. Something like so: ua_parser.py #!/usr/bin/env python3
from device_detector import DeviceDetector
with open('/path/to/ua/strings.txt', 'r'): as ua_file:
for ua in ua_file:
dd = DeviceDetector(ua.strip()).parse()
print(dd.all_details) And with that, I'll close the ticket as this is not a bug. Thanks for checking out |
This is the resulting error.
Traceback (most recent call last):
File "device_detector.py", line 1, in
from .lazy_regex import RegexLazyIgnore
ImportError: attempted relative import with no known parent package
The text was updated successfully, but these errors were encountered: