excelpython
excelpython copied to clipboard
Py.Builtin: No module named `__builtin__` & `xlfunc` name changed to `xlsub` name
When I Py.Call Py.Builtin module, there is an Importerror: No module named __builtin__
.
My python version is Python3.4.
In file xlpyserver.py
, line 191, I change:
import __builtin__
to:
import builtins
because I use version 3, however it doesn't work.
How can I fix it, please?
Hi,
Thanks for reporting this: indeed the __builtin__
module has been renamed builtins
in Python 3, so in order for xlpyserver.py
to be compatible with both 2 and 3 it should check the Python version and act accordingly.
However I do not understand why your fix does not work? Did you try restarting Excel or at least Python? The xlpyserver.py
file does not get reloaded automatically upon changes.
Regards,
Eric
Dear Eric,
Thank you for your work! Although I have restarted Excel, the error still exists. So, I have to change Python 3 to Python 2.
And I find another problem: For example,
- I change the name of a function to another name ( i.e. A --> B ) in
file.py
; - Then
Import Python UDFs
; - Save Excel
file.xlsm
and restart it; - Turn to Excel
Develop
Tab -->Marco
, I find the deletedfunction name A
appears as amacro A
, and I can't delete it because theDelete
button is greyed out.
Software Version:
- Excel 2013 64bit
- Python 2.7.10 32bit
- Excelpython 2.0.8
I want to know how to delete the name A ( which is originally the name of a function defined by xlfunc
) in Macro
list.
Regards,
Johnny
Hey Eric this may be unrelated but... Besides having to pull a Microsoft reset every now and then (restart Excel to reflect changes), I often find myself having to delete a bunch of .pyc's... is that not avoidable programatically?
I guess it's possible that that is what is causing the problem, but I think it's unlikely.
The .pyc's are just a feature of Python and not specifically related to ExcelPython - after all the process that ExcelPython launches is just a normal Python process, it really does not have anything special about it.
I have noticed in the past that sometimes .pyc's remain hanging on disk for some reason and don't get regenerated even though the corresponding .py source has changed (e.g. it has sometimes happened to me when using Git, which I guess plays around with file modification timestamps). Given that Python is supposed to take care of .pyc's already and the problem is a generic one, I would be hesitant to add any feature to ExcelPython which tries to circumvent Python's handling of .pyc's.