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

[BUG] Can't import python native ssl module (ImportError) #3051

Open
TaneshimaPopura opened this issue Aug 7, 2024 · 2 comments
Open

[BUG] Can't import python native ssl module (ImportError) #3051

TaneshimaPopura opened this issue Aug 7, 2024 · 2 comments
Assignees
Labels
bug needs_example User input needed

Comments

@TaneshimaPopura
Copy link

TaneshimaPopura commented Aug 7, 2024

nuitka --version

2.4.4
Commercial: None
Python: 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:04:44) [MSC v.1940 64 bit (AMD64)]
Flavor: Anaconda Python
Executable: D:\Projects\carisfilter\env\python.exe
OS: Windows
Arch: x86_64
WindowsRelease: 11
Version C compiler: ~\AppData\Local\Nuitka\Nuitka\Cache\DOWNLO~1\gcc\x86_64\13.2.0-16.0.6-11.0.1-msvcrt-r1\mingw64\bin\gcc.exe (gcc 13.2.0).

Error messages

Traceback (most recent call last):
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\main.py", line 11, in <module>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\check_grid.py", line 10, in <module check_grid>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\src\utils.py", line 13, in <module src.utils>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\src\notify\line.py", line 3, in <module src.notify.line>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\linebot\v3\__init__.py", line 17, in <module linebot.v3>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\linebot\v3\webhook.py", line 25, in <module linebot.v3.webhook>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\linebot\v3\webhooks\__init__.py", line 18, in <module linebot.v3.webhooks>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\linebot\v3\webhooks\api\__init__.py", line 4, in <module linebot.v3.webhooks.api>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\linebot\v3\webhooks\api\dummy.py", line 23, in <module linebot.v3.webhooks.api.dummy>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\linebot\v3\webhooks\api_client.py", line 30, in <module linebot.v3.webhooks.api_client>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\linebot\v3\webhooks\rest.py", line 19, in <module linebot.v3.webhooks.rest>
  File "C:\Users\H0068\AppData\Local\Temp\ONEFIL~1\ssl.py", line 100, in <module>
ImportError

Below is the part of built-in ssl.py file in Python.

import sys
import os
from collections import namedtuple
from enum import Enum as _Enum, IntEnum as _IntEnum, IntFlag as _IntFlag
from enum import _simple_enum

import _ssl             # if we can't import it, let the error propagate

from _ssl import OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_INFO, OPENSSL_VERSION
from _ssl import _SSLContext, MemoryBIO, SSLSession
from _ssl import (
    SSLError, SSLZeroReturnError, SSLWantReadError, SSLWantWriteError,
    SSLSyscallError, SSLEOFError, SSLCertVerificationError
    )
from _ssl import txt2obj as _txt2obj, nid2obj as _nid2obj
from _ssl import RAND_status, RAND_add, RAND_bytes
try:
    from _ssl import RAND_egd
except ImportError:
    # LibreSSL does not provide RAND_egd
    pass

The location of the problematic source code suite.
I imported this package and packaged it into a onefile.

nuitka_command = [
    "nuitka",
    "--onefile",
    f"--output-dir={output_dir}",
    f"--output-filename={output_filename}",
    "--enable-plugin=pyside6",
    f"--windows-icon-from-ico={icon_path}",
    "main.py",
]

However, when importing Python's built-in ssl module, an import error occurs.
When I don't package it into an executable with Nuitka, it runs normally.

  • How did you install Nuitka and Python

    Installed by conda install -c conda-forge nuitka
    environment.zip

@TaneshimaPopura TaneshimaPopura changed the title [BUG] package linebot-sdk can't import ssl module [BUG] can't import python native ssl module (ImportError) Aug 8, 2024
@TaneshimaPopura TaneshimaPopura changed the title [BUG] can't import python native ssl module (ImportError) [BUG] Can't import python native ssl module (ImportError) Aug 8, 2024
@kayhayen
Copy link
Member

There is no reproducing source code though, or is there?

@kayhayen kayhayen self-assigned this Aug 11, 2024
@kayhayen kayhayen added the bug label Aug 11, 2024
@kayhayen
Copy link
Member

I installed the environment and compiled import linebot.v3 which seems to trigger it for you, but I didn't reproduce it.

@kayhayen kayhayen added the needs_example User input needed label Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs_example User input needed
Projects
None yet
Development

No branches or pull requests

2 participants