koji-kojiro / matplotlib-d

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot import name 'lowercase' from 'string'

polygonalenippel opened this issue · comments

ImportError: cannot import name 'lowercase' from 'string' (/usr/lib/python3.7/string.py)

Looks like there is something wrong in prebuild.py. Python is not my native language, but I believe the way in lowercase is used is deprecated. In gen_pyplot_functions (L22), removing the import and using plain .lower() resolved the issue for me:

    #from string import lowercase

    functions = filter(lambda i: i[0] != '_' or i[0].lower(),
                       extract_function_names(matplotlib.pyplot))

Can someone who is more fluent in Python check up on this please?

commented

The problem is fixed in the code, but you didn't make a new release.

currently on dub, it's v0.1.5 released on Dec 6, 2018.

While python/prebuild.py has been updated in 2019 already.

Please make a new release!

I've just published new release. Thanks for letting me know.

commented

I got build error:

Invalid variable: MATPLOTLIB_D_PYTHON:-python3

is this syntax correct?

"preBuildCommands": ["${MATPLOTLIB_D_PYTHON:-python3} $PACKAGE_DIR/python/prebuild.py $PACKAGE_DIR"]

  "${MATPLOTLIB_D_PYTHON:-python3} $PACKAGE_DIR/python/prebuild.py $PACKAGE_DIR"
commented

https://unix.stackexchange.com/questions/122845/using-a-b-for-variable-assignment-in-scripts

Looks it's correct, but why it's not working? dub mess it up?

What is your environment?

Maybe the dub.json was working in older versions of dub that way, now you have to use $${MAT...

(This is only needed for environment variables, the dub internal variable PACKAGE_DIR should stay as it is)

commented

yes, double $$ fixed it:

$${MATPLOTLIB_D_PYTHON:-python3} ...

$ dub --version
DUB version 1.21.0, built on May 11 2020   # dmd2/linux/bin64/dub

$ uname -a
Linux 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
commented

@koji-kojiro can you make a new release?

Now v.0.1.7 is available on dub.
The new release includes the above fix.