Nuitka: Issue about "Can't perform this operation for unregistered loader type"

My script runs correctly and output what I wanted. But I packed my python scripts to exe file, it raised “Can’t perform this operation for unregistered loader type” when I run the exe file.

my nuitka command: python -m nuitka --mingw64 --standalone --show-progress --recurse-all --enable-plugin=numpy --include-package=openpyxl --include-package=markupsafe --include-package=jinja2 --follow-imports --output-dir=exeFiles mytest.py

my envirionmnet: Windows 7 I installed all the packages(nuitka, jinja2,…) by pip

python -m nuitka --version 0.6.8.4 Python: 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)] Executable: C:\Program Files (x86)\Python36-32\python.exe OS: Windows Arch: x86

my source code: #===============mytest.py=========================

import pandas as pd
import numpy as np



def highlight(df, color = "yellow"):

    attr = 'background-color: {}'.format(color)
    df_bool = pd.DataFrame(df.apply(lambda x: [True if x.iloc[0] < v else False for v in x],axis=1).apply(pd.Series),
                      index=df.index)
    df_bool.columns =df.columns
    return pd.DataFrame(np.where(df_bool, attr, ""),
                       index= df.index, columns=df.columns)
                       
if __name__ == "__main__":
    print('writing....')
    dict = {'A': [1, 1, 1, 1, 1], 'B':[2,1,2,1,2], 'C':[1,2,1,2,1]}
    df = pd.DataFrame(dict)
    try:
        df.style. \
            apply(highlight, axis=None).\
            to_excel("teststyled.xlsx", engine="openpyxl")
        print('Done!')
    except Exception as e:
        print('write error')
        print(str(e))

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 50 (45 by maintainers)

Most upvoted comments

There is also command line options for including data files by directory, by pattern, etc. doesn’t have to Yaml for this, only DLLs have no options.

Your question regarding caching @fleimgruber currently I am not aware of any issues that are caused by caching, I never disable them myself and try to work with them being on.

So, new Jinja2 package loader doesn’t use pkg_resources anymore in its package loader, but instead expects a registered loader class, for which now the pkg_resources plugin (always active) create a post-load code to provide that adapter. With that now, not only jinja2.FileSystemLoader but also jinja2.PackageLoader is working, and the later properly allows file embedding for Nuitka commercial.