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

ImportPython UDFs Error #494

Closed
davidl5 opened this issue Jun 21, 2016 · 35 comments
Closed

ImportPython UDFs Error #494

davidl5 opened this issue Jun 21, 2016 · 35 comments

Comments

@davidl5
Copy link

davidl5 commented Jun 21, 2016

Hello

I am a beginner in Python.

I tried to execute a sample file called "udf.xlsm" to understand xlwings but I get an error message every time (see below) : [Error 2] The specified file can not be found

capture

Can you help me to solve this issue ?

Thank you for your help.

David

@fzumstein
Copy link
Member

Did you unzip the zip file before trying the example?

Also, when you open a command prompt and type the following, does it all work?

C:\Users\Felix>python
>>> import xlwings as xw
>>> xw.__version__
'0.7.2'

@davidl5
Copy link
Author

davidl5 commented Jun 22, 2016

The file is unzip and your previous command work.
I can read/write into Excel with Python using xlwings. The problem happen only when I try to use a Python function in Excel.

@fzumstein
Copy link
Member

Does the Fibonacci sample work?

@davidl5
Copy link
Author

davidl5 commented Jun 22, 2016

When I click on "ImportPython UDFs" I have the same error.

When I click on the "Lite" button from Fibonacci, I get the following error message:

Error

Traceback (most recent call last):
File "", line 1, in
File "h:\a recherche\python\xlwings-master\examples\fibonacci\fibonacci.py", line 31, in xl_fibonacci
n = Range('B1').options(numbers=int).value
AttributeError: 'Range' object has no attribute 'options'

Press Ctrl+C to copy this message to the clipboard.

OK

@davidl5
Copy link
Author

davidl5 commented Jun 22, 2016

sorry for the police

@fzumstein
Copy link
Member

Looks like it's going against an xlwings version < 0.7.2? Do you have multiple installations of Python?

@davidl5
Copy link
Author

davidl5 commented Jun 22, 2016

I have only the version 2.7

@nedwardsnae
Copy link

I'm also experiencing a similar issue to the OP, although I'm getting a different error message. Just installed xlwings 0.7.2 on a Win10 machine using Excel 2016 with the add-in installed. Clicking the "Import Python UDFs" button results in the error below being displayed.
image
Calling the python functions from macros seems to work fine (can generate the fibonacci sequence by clicking on the "Lite" button in the sample), just seems to be the add-in not behaving correctly.

@den-run-ai
Copy link

I wonder if python and excel bitness (32 or 64 bit) have to match for this
COM interop?

On Wed, Jun 22, 2016 at 9:28 AM, Nick Edwards notifications@github.com
wrote:

I'm also experiencing a similar issue to the OP, although I'm getting a
different error message. Just installed xlwings 0.7.2 on a Win10 machine
using Excel 2016 with the add-in installed. Clicking the "Import Python
UDFs" button results in the error below being displayed.
[image: image]
https://cloud.githubusercontent.com/assets/3097360/16270193/6148a79c-388d-11e6-9f7f-ffb8054e7bd4.png
Calling the python functions from macros seems to work fine (can generate
the fibonacci sequence by clicking on the "Lite" button in the sample),
just seems to be the add-in not behaving correctly.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#494 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AHgZ5bNQS5cjXZEDj15-E4PekumAvBOvks5qOUaHgaJpZM4I64Ds
.

@fzumstein
Copy link
Member

No, nothing to do with the bitness as things run out-of-process. xlwings supports a mix of any version of python with any version of Excel and any version of Windows.

@fzumstein
Copy link
Member

@nedwardsnae check if a reboot of Windows helps. Also check if you get the same errors when do run the udf sample and hit Ctrl+Alt+F9 (without importing).

@davidl5
Copy link
Author

davidl5 commented Jun 22, 2016

an idea to solve the problem ?

@fzumstein
Copy link
Member

@davidl5 can you past the full path to your Python interpreter under PYTHON_WIN in the xlwings VBA module and see if running Fibonnacci Lite does give you the same error as before?

@nedwardsnae
Copy link

check if a reboot of Windows helps

Done this, same error occurs.

Also check if you get the same errors when do run the udf sample

Same error, here is what is displayed:
excel_2016-06-22_15-42-34

When I click the button, the same error is displayed

hit Ctrl+Alt+F9 (without importing).

Nothing happens/changes when I do this, unfortunately.

@fzumstein
Copy link
Member

@nedwardsnae this works for you as follows in a command prompt?

C:\Users\Felix>python
>>> import xlwings as xw
>>> xw.__version__
'0.7.2'

@nedwardsnae
Copy link

Yes:
image

@davidl5
Copy link
Author

davidl5 commented Jun 22, 2016

I have an error almost similar:


Error

Traceback (most recent call last):
File "", line 1, in
File "h:\a recherche\python\xlwings-master\examples\fibonacci\fibonacci.py", line 7, in
from xlwings import Workbook, Range
ImportError: No module named xlwings

Press Ctrl+C to copy this message to the clipboard.

OK

@fzumstein
Copy link
Member

@davidl5 so there seem to be 2 issues: (1) the python installation that you want does not have xlwings installed and (2) the default python installation is also different from the version you want. You would need to put the python installation that you want on your path and make sure it has xlwings installed. My suggestion would be to simply reinstall Anaconda and make sure you have the checkboxes on the last installing step checked, see here

@fzumstein
Copy link
Member

@nedwardsnae can you please also check if you get the same error by pointing PYTHON_WIN to your Python interpreter, see above?

@nedwardsnae
Copy link

Oops - sorry for wasting your time @fzumstein. It seems that Python 3 was in my system path, and while running python in my command line invoked the 2.7 version, process monitor was showing the pythonw.exe from my python 3 installation being run. The excel plugin now works fine having removed that version from my path. Sorry and thanks for the help!

@davidl5
Copy link
Author

davidl5 commented Jun 22, 2016

I have just reinstall the last version of Anaconda with the checkboxes checked and I have still the same problem
image

@den-run-ai
Copy link

@davidl5 maybe this has to do something with French :) what is the full filename in the error?

@davidl5
Copy link
Author

davidl5 commented Jun 23, 2016

[Error 2] The specified file can not be found.
The Excel file name is udf.xlsm

@fzumstein
Copy link
Member

@davidl5 does the file path contain any non ascii characters like é?

@davidl5
Copy link
Author

davidl5 commented Jun 23, 2016

Only ascii characters and same error.

Why there is a "u" before the file name (tests_python) ?

image

@den-run-ai
Copy link

'u' is for unicode strings.

On Thu, Jun 23, 2016 at 7:43 AM, davidl5 notifications@github.com wrote:

Only ascii characters and same error.

Why there is a "u" before the file name (tests_python) ?

[image: image]
https://cloud.githubusercontent.com/assets/20070062/16303397/b99d998e-3950-11e6-9f5b-308b5320f09a.png


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#494 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AHgZ5dWxfudnoJxYWs2syBKV4fT4cRF2ks5qOn9lgaJpZM4I64Ds
.

@fzumstein
Copy link
Member

What path do you get if you do the following in a command prompt:

python
>>> import sys
>>> sys.executable
'C:\\Users\\Felix\\Anaconda3\\python.exe'

@davidl5
Copy link
Author

davidl5 commented Jun 28, 2016

'C:\Users\levydav\AppData\Local\Continuum\Anaconda2\python.exe'

@fzumstein
Copy link
Member

When you do the following, what do you get?

cd C:\Users\levydav\AppData\Local\Continuum\Anaconda2
python
>>> import xlwings
>>> xlwings.__version__

@davidl5
Copy link
Author

davidl5 commented Jun 28, 2016

'0.7.0'

@davidl5
Copy link
Author

davidl5 commented Jun 30, 2016

do you have any idea please ?

@den-run-ai
Copy link

did you try v0.7.2?

@davidl5
Copy link
Author

davidl5 commented Jun 30, 2016

I reinstall python/anaconda and the version 0.7.2 of xlwings
I get the following error message when I click on "ImportPython UDFs"

pic

thank you for your help

@fzumstein
Copy link
Member

Looks like a bit of progress to me... can you try again with a fresh download of an unzipped UDF sample from the homepage? Alternatively, can you send me your Workbook and py file please? Email is on my profile.

@davidl5
Copy link
Author

davidl5 commented Jun 30, 2016

it's works !!!
thanks a lot for your help

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

4 participants