Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tony

Pages: [1] 2 3 ... 41
1
Help and Support / Re: Error resizing
« on: December 10, 2017, 10:36:40 PM »
Hi,

are you still having a problem with this?

thanks,
Tony

2
Help and Support / Re: Error resizing
« on: December 01, 2017, 09:33:35 AM »
Hi,

what version of PyXLL are you using? From what you've described it sounds like it could be a problem that was fixed in version 3.3.1. If you're not already on that version please can you try updating?

Also, please could you send me your complete log file?

Best regards,
Tony

3
Help and Support / Re: Error resizing
« on: November 30, 2017, 03:16:42 PM »
Hi,

this error can happen if resizing the array would cause it to intersect with another array function. As you cannot modify cells that are part of the result of an array function, you cannot resize one array function to overlap with another.

Could that explain what's happening?

Best regards,
Tony

4
General Discussion / Re: Change styles on Excel Open
« on: November 24, 2017, 04:20:16 PM »
Hi,

you can run some python code when Excel starts using the @xl_on_open decorator:
https://www.pyxll.com/docs/api/eventhandlers.html#xl-on-open

You can use COM to do anything you're currently doing in VBA. Use xl_app to get the Application COM object:
https://www.pyxll.com/docs/api/utils.html#xl-app

However, you will find that the Application object isn't actually created at the time Excel starts up, it's created a little while later when the first workbook is opened. You'll have to use a timer to keep retrying until xl_app returns with the Application object. Have a look at the _start_timer function in the (now obsolete) shortcuts example here: https://github.com/pyxll/pyxll-examples/blob/869b8e3e32b4d3a69a18e84ce9cb3251495e53ff/shortcuts/shortcuts.py

Once you've got the Application object hopefully translating your existing VBA code into Python shouldn't be too hard.

You may find it easier to play around in an interactive Python prompt first to figure out exactly how the COM api works in Python. You can get an Excel Application object outside of pyxll by doing:

Code: [Select]
from win32com.client import Dispatch
xl = Dispatch("Excel.Application")

Best regards,
Tony

5
General Discussion / Re: Change styles on Excel Open
« on: November 24, 2017, 02:34:56 PM »

6
Help and Support / Re: ImportError: No module named pyxll
« on: November 15, 2017, 05:54:06 PM »
Hi,

are you trying to import pyxll in Python code that isn't running in Excel? (ie running tests or scripts from Eclipse?) If so, you just need to install the stubs pyxll package that comes in the download. If you look in the zip file you should see a .whl file, which you can install with pip, eg:

pip install <pyxll wheel file>

If it's a problem importing when running in Excel, please set your logging level to debug in pyxll.cfg and send me your log file and I'll take a look at it for you.

Best regards,
Tony

7
Help and Support / Re: pyxll_utils.extension loader
« on: November 15, 2017, 05:31:40 PM »
Hi Daryl,

in order for setuptools to be able to see your extension, the package needs to be installed (being on the python path isn't quite enough).

To install a package you run setup.py with the install command: "python setup.py install"

Alternatively, you can install the package in 'development mode', which just puts a link in your site-packages folder to tell setuptools to look in your development source folder: "python setup.py develop"

I can see this isn't very clear from the pyxll_utils docs, so I will ask for them to be updated.

Best regards,
Tony

8
Hi,

unfortunately I've not been able to reproduce your problem. I have tried creating a dataframe using the strings from your original post and they appear correctly in Excel. I have also tried functions taking a unicode string and returning the same string to Excel without problems.

I've attached my tests so you can see what I've tried. Can you try them and see if they work for you please?

I have included files for both Python 2 and Python 3. In both cases the Python modules are encoded in utf-8 (see the first line of the modules). For the dataframe return type I am using the pyxll_utils.pandastypes module from here: https://github.com/pyxll/pyxll-utils.

I have tested with PyXLL 3.3.1, Python 2.7 and 3.5.

Best regards,
Tony

9
Hi,

I've not come across this problem before so I will have to look into it and get back to you.

Kind regards,
Tony

10
Help and Support / Re: triggering run of VBA macro
« on: October 22, 2017, 09:15:54 PM »
Hi,

yes, you can use the Application.Run function (part of the Excel COM api) in the same way as you can from VBA. Use pyxll.xl_app to get the Excel.Application object (https://www.pyxll.com/docs/api/utils.html#pyxll.xl_app).

If you want to do this from a worksheet function (using xl_func) you will probably need to use pyxll.async_call to call it after the Excel calculation has completed (https://www.pyxll.com/docs/api/utils.html#async-call).

I hope this helps,
Tony

11
Help and Support / Re: Error while loading script with pandas
« on: October 20, 2017, 12:15:30 PM »
Yes I would expect it to fail in both, unless for some reason the ordering of the final python path was different when using pyxll (it shouldn't be).

I'll have to have a play around and see if I can reproduce this. I've never seen a problem with linking develop packages like this, but possibly it's some combination of the pyxll_utils extension loader and script I've just not come across before.

I'll let you know what I find.

cheers,
Tony

12
Help and Support / Re: Error while loading script with pandas
« on: October 20, 2017, 11:41:53 AM »
Hi,

there should be no difference in installing modules in develop mode. That particular errors looks more like an issue with ctypes than anything else. I wonder if it's finding another _ctypes package somewhere else on the pythonpath? Could it be you have one copied somewhere in your dev environment that would only be on the path when you have your module installed with the develop option?

You can now completely disable the pyxll import hook by setting "deep_reload_disable=1" in the PYXLL section of your pyxll.cfg file. It doesn't look like your problem is caused by this, but it would be worth checking.

The console window flashing up will be if something somewhere is using subprocess or multiprocessing, or otherwise starting a child python process. When you configure the executable in your pyxll.cfg change python.exe to pythonw.exe for the windowless version and that should stop that problem.

Best regards,
Tony

13
I'm marking this as solved now as I believe everything should be resolved in the latest release, but if you're still having problems please let me know.

Best regards,
Tony

14
Help and Support / Re: Error while loading script with pandas
« on: October 20, 2017, 10:42:07 AM »
Hi,

well, this is embarrassing! There was an error with the deployment of 3.3.0 and this change never actually got included, despite being in the previous beta :(

I'm very sorry for the inconvenience. I've just released a new version (3.3.1), which this time really does include the fix for this. I've tested it for the modules you've listed with the latest pandas and pytest to confirm it really is working now.

I notice you're using the pyxll_utils shortcuts and array resize features. Did you know that both of these things are now supported by PyXLL itself? They haven't been removed from pyxll_utils to avoid breaking peoples code, but you shouldn't really need them anymore.

These are the relevant pages in the docs:
https://www.pyxll.com/docs/userguide/macros.html#keyboard-shortcuts
https://www.pyxll.com/docs/userguide/udfs.html#resizing-array-formulas

Please let me know once you've had a chance to get the latest 3.3.1 release, and whether it fixes your problem or not.

Kind regards,
Tony

15
Help and Support / Re: Pxyll Functions not appearing in Excel
« on: October 11, 2017, 03:10:29 PM »
Hi,

hmm yes that does sound like there could be a problem elsewhere. It sounds like Excel is loading the pyxll.xll file from somewhere else - which could happen if you initially installed it in one location and then tried to move it somewhere else, as Excel still remembers the old location.

The easiest way to check is to go into File -> Options -> AddIns in Excel and check the full path it is using for the PyXLL pyxll.xll file. If that is not where your config file is, that'll be the problem.

If that is the problem, you will need to uninstall the old one by going to "Manage Excel Add-Ins" in the Add-Ins page you were just on and un-check PyXLL. Then close Excel and delete or rename the file Excel was using. Then restart Excel and add the one you want it to use. Deleting or renaming the old file is the easiest way to ensure that Excel doesn't pick it up again as it has a habit of remembering!

Please let me know if this solves your problem or not.

Kind regards,
Tony

Pages: [1] 2 3 ... 41