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

#86 Support returning datetime.time objects from UDFs. #2162

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rudolfbyker
Copy link

@rudolfbyker rudolfbyker commented Feb 7, 2023

In progress … The one pushed commit fixes my use case, but I'm still trying to figure out how testing works in this repo.

Closes #86

@rudolfbyker rudolfbyker marked this pull request as draft February 7, 2023 08:05
@rudolfbyker
Copy link
Author

@fzumstein I'm currently following DEVELOPER_GUIDE.md, and getting stuck at pip install -e ".[all]" due to some issue with Rust. I'm not a Rust developer (yet?) so is there any way to just get tests running in the xlwings repo without having to install Rust?

If this is too complicated, would you consider writing the tests for this PR? I'm pretty sure my code will work as is.

@fzumstein
Copy link
Member

Try python setup.py develop instead.

@rudolfbyker
Copy link
Author

Thanks. I followed that, and the rest of the instructions. I wrote my test UDFs in udf_tests.py, and added them in udf_tests.xlsm. But I'm still not managing to run them. When I click "Import Functions", it hangs for a few minutes, and then stops with this error:

Could not activate Python COM server, hr = -2147221164 1000

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

I searched for this message, and found two things that don't look applicable to my situation:

  • Using Microsoft Office from Store (No, I'm using Office 365)
  • Empty lines in config file (Not using a config file as far as I can tell)

Any ideas?

@fzumstein
Copy link
Member

If you check Show Console you should probably get a better error message

@rudolfbyker
Copy link
Author

In the console, I see:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\aa\xlwings\xlwings\server.py", line 16, in <module>
    raise ImportError(
ImportError: Couldn't find 'pywin32'. Install it via'pip install pywin32' or 'conda install pywin32'.

However, pywin32 is definitely installed in the venv that I'm using, and I have the interpreter set to C:\aa\xlwings\venv\Scripts\python.exe in the ribbon (I have the git repo cloned at C:\aa\xlwings).

After typing exit in the console, I get a popup saying:

Python process exited before it was possible to create the interface object.
Command: cmd.exe /showconsole /K ""C:\aa\xlwings\venv\Scripts\python.exe" -B -c "import sys, os;import xlwings.utils;xlwings.utils.prepare_sys_path(\"true;C:\\aa\\xlwings\\tests\\udfs\\udf_tests.xlsm;C:\\aa\\xlwings\\xlwings\\addin\\xlwings.xlam;;;;\");import xlwings.server; xlwings.server.serve('{d5eab099-116e-462c-9ece-8c975870209f}')""
Working Dir: <unspecified> 1000

I have no idea what to make of this.

@fzumstein
Copy link
Member

In this case, you've got an issue with pywin32 as import win32api fails: https://github.com/xlwings/xlwings/blob/main/xlwings/server.py#L14

@rudolfbyker
Copy link
Author

In this case, you've got an issue with pywin32 as import win32api fails: https://github.com/xlwings/xlwings/blob/main/xlwings/server.py#L14

Now you're just repeating exactly what I said in the first half of my post...

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

Successfully merging this pull request may close these issues.

Add proper support for datetime.time objects/ time-only cell formats
2 participants