Comments (18)
Hello - i think with this command when creating the executeable on MacOS i get rid of the error message:
pyinstaller --onefile --collect-datas=fake_useragent myprg.py
from fake-useragent.
Hello - i think with this command when creating the executeable on MacOS i get rid of the error message:
pyinstaller --onefile --collect-datas=fake_useragent myprg.py
ohh,thank u. with the method you offered ,i solve it too!
from fake-useragent.
Interesting. Which python version are you using, if I may ask? On which os?
from fake-useragent.
python3.8 pyinstaller is packaged and run in win2008 server
from fake-useragent.
hm.. I think pyinstaller can't handle importlib-resources package. I will try to fallback to pkg_resources
, lets hope this works.. Otherwise I don't know either
from fake-useragent.
I tried to impl. a fallback mechanism towards pkg_resource
before going to the external website resource. Hopefully this will fetch the data file locally still.
This is available in version 1.1.0.
Update via: pip install --upgrade fake-useragent
from fake-useragent.
it was working fine for me till the last update now i am getting the same error as he got it was working fine before the update i got this one https://i.imgur.com/WX5ix1a.png
:/ @Danger89
from fake-useragent.
i solved it by writing this i don't know what was the problem (ua = UserAgent(use_external_data=True))
from fake-useragent.
it was working fine for me till the last update now i am getting the same error as he got it was working fine before the update i got this one https://i.imgur.com/WX5ix1a.png :/ @Danger89
Why is your Python looking in the AppData\\Local\\Temp
folder? Did you correctly installed Python and pip? This seems not a normal way of using Python.
I would expect that the Python is looking at the following folder instead: C:\\Users\\Yourname\\AppData\\Local\\Packages
.
ua = UserAgent(use_external_data=True)
Yea, that is how you skip reading the local JSON data file all together. Which is maybe not ideal. That being said, even with those errors, it automatically fallback to retrieving the external data. So for example ua.random
will still output data, despite the warnings.
from fake-useragent.
Yea i have installed python and pip correctly it only does this after using pyinstaller and yea it continue after giving the error
from fake-useragent.
Ah you are both using pyinstaller. Hm did might me a clue. Maybe pyinstaller can't be used together with resource files, in order to retrieve this locally installed data file.
from fake-useragent.
win 2008 server The code version can be run directly
pyinstaller Error reported after packaging
Unable to find local data/json file or could not parse the contents using import
lib-resources. Try pkg-resource next.
Traceback (most recent call last):
File "fake_useragent\utils.py", line 128, in load
File "importlib_resources_common.py", line 22, in files
File "importlib_resources_common.py", line 53, in get_package
File "importlib_resources_common.py", line 44, in resolve
File "importlib_init_.py", line 126, in import_module
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 953, in find_and_load_unlocked
ModuleNotFoundError: No module named 'fake_useragent.data'
Could not find local data/json file or could not parse the contents using pkg-re
source. Fallback to external resource.
Traceback (most recent call last):
File "fake_useragent\utils.py", line 128, in load
File "importlib_resources_common.py", line 22, in files
File "importlib_resources_common.py", line 53, in get_package
File "importlib_resources_common.py", line 44, in resolve
File "importlib_init.py", line 126, in import_module
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fake_useragent.data'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "fake_useragent\utils.py", line 143, in load
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\ADMINI~1\Ap
pData\Local\Temp\_MEI24282\fake_useragent\data\browsers.json'
Traceback (most recent call last):
File "urllib\request.py", line 1318, in do_open
File "http\client.py", line 1239, in request
File "http\client.py", line 1285, in _send_request
File "http\client.py", line 1234, in endheaders
File "http\client.py", line 1026, in _send_output
File "http\client.py", line 964, in send
File "http\client.py", line 1400, in connect
File "ssl.py", line 407, in wrap_socket
File "ssl.py", line 814, in init
File "ssl.py", line 1068, in do_handshake
File "ssl.py", line 689, in do_handshake
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c
:841)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "fake_useragent\utils.py", line 54, in get
File "urllib\request.py", line 223, in urlopen
File "urllib\request.py", line 526, in open
File "urllib\request.py", line 544, in _open
File "urllib\request.py", line 504, in _call_chain
File "urllib\request.py", line 1361, in https_open
File "urllib\request.py", line 1320, in do_open
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certifica
te verify failed (_ssl.c:841)>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "fake_useragent\utils.py", line 166, in load
File "fake_useragent\utils.py", line 89, in get_browser_user_agents_online
File "fake_useragent\utils.py", line 74, in get
fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "测试.py", line 4, in
File "fake_useragent\fake.py", line 59, in init
File "fake_useragent\fake.py", line 75, in load
File "fake_useragent\utils.py", line 169, in load
fake_useragent.errors.FakeUserAgentError: Could not load data from external webs
ite
[1556] Failed to execute script '测试' due to unhandled exception!
from fake-useragent.
In your case Python is also looking at C:\Users\<your user>\AppData\Local\Temp\_MEI24282\fake_useragent\data\browsers.json
.. Why would Python look into the Temp folder?
I don't have a Windows machine, I have definitely also not a Win 2008 machine. I also never used pyinstaller to be honest.
from fake-useragent.
Hello - when i package the solution with pyinstaller - i also get this error
ModuleNotFoundError: No module named 'fake_useragent.data'
with the new version
fake-useragent 1.1.0
Is there a suggested way to fix this?
from fake-useragent.
Hello - i get the below error message when running the executeable on MacOS which i create with pyinstaller -
(the programs runs trough - but gives this error message at the beginning - it seems
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
PolziMacs-Mini:~ polzimac$ /Users/polzimac/Documents/DEV/Fiverr/ORDER/robalf/checkMapsSel2 ; exit;
Pls provide name of excel:
Working on checkMaps.xlsx
Checking Browser driver...
Unable to find local data/json file or could not parse the contents using importlib-resources. Try pkg-resource next.
Traceback (most recent call last):
File "fake_useragent/utils.py", line 128, in load
File "importlib_resources/_common.py", line 46, in wrapper
File "importlib_resources/_common.py", line 56, in files
File "functools.py", line 877, in wrapper
File "importlib_resources/_common.py", line 82, in _
File "importlib/__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fake_useragent.data'
Could not find local data/json file or could not parse the contents using pkg-resource. Fallback to external resource.
Traceback (most recent call last):
File "fake_useragent/utils.py", line 128, in load
File "importlib_resources/_common.py", line 46, in wrapper
File "importlib_resources/_common.py", line 56, in files
File "functools.py", line 877, in wrapper
File "importlib_resources/_common.py", line 82, in _
File "importlib/__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fake_useragent.data'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "fake_useragent/utils.py", line 142, in load
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/q1/288l_zvn2sl7_lx4cv34yz3m0000gn/T/_MEIVFKdST/fake_useragent/data/browsers.json'
v1_0 https://www.google.com/maps/search/http%3A%2F%2Fwww.biorochelou.com written to row 6...
v1_0 https://www.google.com/maps/search/http%3A%2F%2Fwww.giovannirana.it written to row 7...
Program finished - pls press <enter> to close the window...
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
from fake-useragent.
Should I document something on the Readme or?
from fake-useragent.
您好 - 我认为在 MacOS 上创建可执行对象时使用此命令,我摆脱了错误消息:
pyinstaller --onefile --collect-datas=fake_useragent myprg.py
thank u, i Solved this problem
from fake-useragent.
Hello - i think with this command when creating the executeable on MacOS i get rid of the error message:
pyinstaller --onefile --collect-datas=fake_useragent myprg.py
Thanks a lot! It works for me
I didn't get the error when creating the executeable, instead, I got the error when running the executeable
My environment is:
- windows 10 x64
- pyinstaller v6.3.0
- fake-useragent v1.4.0
from fake-useragent.
Related Issues (20)
- Outdated package in `conda-forge` HOT 1
- [Bug?] user_agents in Opera contains IE user_agents HOT 2
- Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11 HOT 4
- I used this module, but it doesn't work. Every time it runs, it's the real agent information HOT 3
- Browser version in browsers.json is too old HOT 2
- "Error occurred during getting browser: shape, but was suppressed with fallback." HOT 1
- Visual Code error: Import fake_useragent could not be resolved HOT 2
- Unexpected non-whitespace character after JSON at position 232 HOT 1
- no module named 'fake_useragent.data' HOT 2
- Obtaining the sec-ch-ua-platform, sec-ch-ua and sec-ch-ua-mobile corresponding to the obtained user-agent HOT 6
- 在multiprocessing.Process中会出现[ WARNING] fake.py:171 - Error occurred during getting browser: getstate, but was suppressed with fallback. HOT 4
- Error with EXE compiled with Pyinstaller HOT 1
- Support for Python 3.12 HOT 1
- fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached HOT 5
- How to get user headers for mobile useragent? HOT 3
- having issue when making .exe using pyinstaller HOT 2
- Please add mobile user agents also HOT 4
- fake_useragent.errors.FakeUserAgentError: ('Data list is empty', None) HOT 2
- User agent list seems to be a bit out dated HOT 3
- spaces at end of user agent string break httpx HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fake-useragent.