free-proxy icon indicating copy to clipboard operation
free-proxy copied to clipboard

ImportError: No module named 'fp'

Open abubelinha opened this issue 3 years ago • 2 comments

This happens on WinXP 32bit, Python 3.4. Apparently the installation was successful:

C:\Dropbox\python>c:\python34\scripts\pip install free-proxy
Collecting free-proxy
  Downloading https://files.pythonhosted.org/packages/2e/fa/d01b586a6cca1ae2c75657dac7a2e3b43767182c4d1a2bbcbe7f641acd8a/free_proxy-1.0.0-py3-none-any.whl
Requirement already satisfied: lxml>=4.3.0 in c:\python34\lib\site-packages (from free-proxy) (4.3.1)
Requirement already satisfied: requests>=2.21.0 in c:\python34\lib\site-packages (from free-proxy) (2.21.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\python34\lib\site-packages (from requests>=2.21.0->free-proxy) (2021.5.30)
Requirement already satisfied: idna<2.9,>=2.5 in c:\python34\lib\site-packages (from requests>=2.21.0->free-proxy) (2.7)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\python34\lib\site-packages (from requests>=2.21.0->free-proxy) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python34\lib\site-packages (from requests>=2.21.0->free-proxy) (3.0.4)
Installing collected packages: free-proxy
Successfully installed free-proxy-1.0.0

But then I can't load the module:

from fp.fp import FreeProxy
ImportError: No module named 'fp'

The same script worked in a different machine (Win7 64bit, Python 3.7) But as I recall free-proxy version is the same in both.

abubelinha avatar Nov 19 '21 08:11 abubelinha

I can't reproduce this issue. Try to make a new (clean) virtualenv and install free-proxy: pip install free-proxy Here is the end of my terminal output after installing free-proxy on the newly created virtualenv:

Successfully built free-proxy lxml
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests, lxml, free-proxy
Successfully installed certifi-2021.10.8 charset-normalizer-2.0.7 free-proxy-1.0.4 idna-3.3 lxml-4.6.4 requests-2.26.0 urllib3-1.26.7

Actual free-proxy version is 1.0.4.

jundymek avatar Nov 21 '21 13:11 jundymek

You are right, in my Win7 laptop I have version 1.0.4. But on WinXP Python 3.4 I couldn't go beyond 1.0.0, even with setenv. I suppose it has to do with lower versions of other required libraries (see my first post: lxml, requests ... their versions are lower too), and that could prevent free-proxy 1.0.4 to be installed.

Anyway, is it possible that in free-proxy version 1.0.0 the importing syntax was somehow different? I see a "fix imports" change from 1.0.0 to 1.0.1. Could you tell me how it was before?
I tried this as I saw it here:

from free_proxy import FreeProxy

But I still get an error:

C:\Dropbox\python>c:\python34\python
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from free_proxy import FreeProxy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python34\lib\site-packages\free_proxy\__init__.py", line 1, in <module>
    from .free_proxy import FreeProxy
  File "c:\python34\lib\site-packages\free_proxy\free_proxy.py", line 21
    proxies = [f'{tr_elements[i][0].text_content()}:{tr_elements[i][1].text_content()}' for i in
                                                                                      ^
SyntaxError: invalid syntax

I could make free-proxy 1.0.0 work under Python 3.4, I would modify my script to use a different importing syntax depending on the computer hostname running the script.
Thanks

abubelinha avatar Nov 21 '21 21:11 abubelinha