Skip to content
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: Can't connect to HTTPS URL because the SSL module is not available. #120

Open
Jyodann opened this issue Nov 16, 2024 · 0 comments

Comments

@Jyodann
Copy link

Jyodann commented Nov 16, 2024

I'm attempting to use the requests module to make a HTTPS request to the internet from Python. It seems like the SSL module is not bundled when using the package command.

Steps to reproduce:

main.py

import requests
requests.get("https://youtube.com");

Package Command:
dart run serious_python:main package --requirements=requests --platform Darwin ./python/

When the app runs, this error appears:

Screenshot 2024-11-16 at 12 31 41

Even after allowing it in Privacy Settings, it will appear whenever app runs.

The Debug Console shows the following:

Launching lib/main.dart on macOS in debug mode...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-000405541E91801E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00006000-000405541E91801E, name:My Mac }
✓ Built build/macos/Build/Products/Debug/Luvbi.app
2024-11-16 12:33:37.758 Luvbi[6273:3897556] +[IMKClient subclass]: chose IMKClient_Modern
2024-11-16 12:33:37.758 Luvbi[6273:3897556] +[IMKInputSession subclass]: chose IMKInputSession_Modern
Connecting to VM Service at ws://127.0.0.1:55609/nFVjc29X4X4=/ws
Connected to the VM Service.
flutter: extractAssetOrFile directory: /Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app
flutter: Start unpacking archive: app/app.zip
flutter: Finished unpacking application archive in 0:00:00.376002
2024-11-16 12:33:40.284 Luvbi[6273:3897556] Swift runPython(appPath: /Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/main.py, modulePaths: [])
/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/requests/__init__.py:86: RequestsDependencyWarning: Unable to find acceptable character detection dependency (chardet or charset_normalizer).
  warnings.warn(
Traceback (most recent call last):
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/main.py", line 3, in <module>
    requests.get("https://youtube.com");
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/urllib3/connectionpool.py", line 768, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/urllib3/connectionpool.py", line 294, in _get_conn
    return conn or self._new_conn()
                   ^^^^^^^^^^^^^^^^
  File "/Users/jyodann/Library/Containers/com.example.luvbiGui/Data/Library/Application Support/com.example.luvbiGui/flet/app/__pypackages__/urllib3/connectionpool.py", line 1059, in _new_conn
    raise ImportError(
ImportError: Can't connect to HTTPS URL because the SSL module is not available.
Python program completed with error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant