xlwings Reports Quickstart throws errors - python

Just trying the quickstart described here:
https://docs.xlwings.org/en/stable/reports.html#quickstart
I've copied the small code sample and created the template sheet as described. When I run report.py, I get the following:
Traceback (most recent call last):
File "report.py", line 17, in <module>
book = app.render_template(this_dir / 'mytemplate.xlsx',
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/main.py", line 699, in render_template
return render_template(
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/pro/reports/main.py", line 439, in render_template
wb = app.books.open(output)
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/main.py", line 4988, in open
return Book(impl=self.impl.open(json=json))
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/pro/_xlremote.py", line 217, in open
book = Book(api=json, books=self)
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/pro/_xlremote.py", line 268, in __init__
if api["version"] != __version__:
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "report.py", line 20, in <module>
book.to_pdf(this_dir / 'myreport.pdf')
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/main.py", line 764, in __exit__
self.quit()
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/main.py", line 388, in quit
return self.impl.quit()
File "/home/james/dev/repos/eft/auto-reports/env/lib/python3.8/site-packages/xlwings/base_classes.py", line 50, in quit
raise NotImplementedError()
NotImplementedError
This is essentially out of the box so I can't see that I've done anything wrong. I'm running on Ubuntu 20.04.5 LTS. Python is 3.8.10. I have the follwing dependencies:
numpy==1.23.4
pandas==1.5.1
python-dateutil==2.8.2
pytz==2022.5
six==1.16.0
xlwings==0.28.2
Any suggestions? Thanks.

Traditionally, xlwings only worked on Windows or macOS with an actual installation of Microsoft Excel. More recently (in 2022) it added Linux support for xlwings Server and xlwings File Reader, but xlwings Reports still has to be run in connection with Excel, i.e., runs on Windows and macOS only. While the installation instructions mention this, I'll try to improve the docs to mark the requirements on the respective pages.

Related

Is uniconvertor application broken for debian 10?

From my previous question: "Can't import the Python Imaging Library", I am still trying to convert cdr file to svg file, and the only solution I find for Debian is to use uniconvertor. So for the first time, I was missing the Pillow library (pip install Pillow). When tried to run for the second time, another error arose:
$uniconv image.cdr image.svg
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/uniconvertor/__init__.py", line 76, in <module>
saver(doc, sys.argv[2])
File "/usr/local/lib/python2.7/dist-packages/uniconvertor/app/plugins/plugins.py", line 201, in __call__
module.save(document, file, filename, options)
File "/usr/local/lib/python2.7/dist-packages/uniconvertor/app/plugins/Filters/svgsaver.py", line 299, in save
saver.Save()
File "/usr/local/lib/python2.7/dist-packages/uniconvertor/app/plugins/Filters/svgsaver.py", line 259, in Save
left, bottom, right, top = self.document.BoundingRect()
AttributeError: 'NoneType' object has no attribute 'BoundingRect'
But this time I would have to edit (with no python knowledge) the __init__.py script (main). So I am assuming the whole application is broken? How to fix it, or is there another package to make the conversion (cdr->svg)?

GMIC Python plugin crashing in GIMP

I'm getting a procedure not found error when trying to call gimp_freaky_bw "from gimpfu" pdb.plug_in_gmic. This worked with an earlier installation of GIMP. I have just installed GIMP 2.8.22 and G'MIC 2.1.1. The error is:
Traceback (most recent call last):
File "C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimpfu.py", line 736, in response
dialog.res = run_script(params)
File "C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimpfu.py", line 361, in run_script
return apply(function, params)
File "C:\Users\tommy\.gimp-2.8\plug-ins\DIEGO_ARTISTIC_JamackSketch.py", line 124, in JamackSketch
pdb.plug_in_gmic(newImage, FreakyBW, 1, # 1=input only active layer
error: procedure not found
In recent versions of the GMIC plugin the entry point is:
pdb.plug_in_gmic_qt(image, drawable, input, output, command)
and not plug_in_gmic as in the reported error. So, fix the python script, or contact the author to get it fixed.

Canopy is having difficulties updating packages, "AbortedOperationDetected"

I run Canopy version Version: 2.1.3.3542 (64 bit) on Windows 10.
Canopy cant manage to update any package, all results in the same
log output for a numpy update (for example):
Warming up...
Traceback (most recent call last):
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\package_action_worker.py", line 54, in run
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\package_action.py", line 196, in execute
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\packman.py", line 626, in <lambda>
File "build\bdist.win-amd64\egg\canopy_dashboard\packman\packman.py", line 1051, in _install
File "build\bdist.win-amd64\egg\canopy_platform\cpython_packages_manager.py", line 152, in install_packages_prompt
File "build\bdist.win-amd64\egg\canopy_platform\cpython_packages_manager.py", line 137, in _install_packages_prompt
PackagesInstallationError: installation of packages ['numpy 1.11.3-3'] failed. Details below:
Traceback (most recent call last):
File "build\bdist.win-amd64\egg\canopy_platform\edm_api.py", line 64, in wrapper
File "build\bdist.win-amd64\egg\canopy_platform\edm_api.py", line 384, in install_command
File "build\bdist.win-amd64\egg\canopy_platform\edm_api.py", line 414, in _install_packages_command
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 124, in decorator
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 219, in install_command
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 223, in _install_command
File "build\bdist.win-amd64\egg\edm\core\packages_manager.py", line 549, in _compute_fix_aborted_actions
AbortedOperationDetected: Aborted operation detected in environment 'User'
There is absolutly 0 results on google for this error code, so stackexchange is my last resort
It looks like a previous update was force-aborted, possibly leaving the environment corrupted. Assuming that you are using the standard installer, then it should suffice to
reboot your computer
temporarily disable your anti-virus software if possible (or at least disable its more intrusive / slow functionality, such as online checking each of the tens of thousands of package files that Canopy provides),
from the Canopy Tools menu, select Troubleshoot => Reset Python environment

Can't run python script converted to exe

I have created a python program that sends data to google spreadsheets using the following external libaries:
json
gspread
oauth2client
The program works as expected, however when I tried to convert it to an executable, I would get the following error every time I rune the .exe file:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec(code, m.__dict__)
File "Demo.py", line 13, in <module>
File "C:\Python27\lib\site-packages\oauth2client\util.py", line 140, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 1630, in __init__
_RequireCryptoOrDie()
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 1581, in _RequireCryptoOrDie
raise CryptoUnavailableError('No crypto library available')
oauth2client.client.CryptoUnavailableError: No crypto library available
Would any of you guys know what the problem could be, and what steps I could take to solve it?
Thanks in advance
Edit: I tried to use both cx_freeze and py2exe. I got similar errors in both
Below is the setup.py I used in cx_freeze:
from cx_Freeze import setup, Executable
setup(name = "Demo" ,
version = "1.0" ,
description = "A python Demo" ,
executables = [Executable("Demo.py")])

Firefox Add-on SDK error

I try to launch:cfx runbut I'm getting following error:
(C:\Users\michal smoczyk\Downloads\addon-sdk-1.14) C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\my-addon>cfx run
Using binary at 'C:\Program Files\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\michal~1\appdata\local\temp\tmpkcrwv7.mozrunner'.
Traceback (most recent call last):
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\bin\cfx", line 33, in <module>
cuddlefish.run()
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\__init__.py", line 928, in run
bundle_sdk=options.bundle_sdk)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 706, in run_app
runner.start()
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\mozrunner\__init__.py", line 529, in start
self.process_handler = run_command(self.command+self.cmdargs, self.env, **self.kp_kwargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\mozrunner\__init__.py", line 59, in run_command
return killableprocess.Popen(cmd, env=env, **killable_kwargs)
File "C:\Python27\lib\subprocess.py", line 709, in __init__
errread, errwrite)
TypeError: _execute_child() takes exactly 17 arguments (18 given)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 534, in maybe_remove_outfile
os.remove(outfile)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\michal~1\\appdata\\local\\temp\\harness-stdout-l8remz'
Error in sys.exitfunc:
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 534, in maybe_remove_outfile
os.remove(outfile)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\michal~1\\appdata\\local\\temp\\harness-stdout-l8remz'
My Firefox version: 26. I've installed Python 2.7. OS: Windows Vista, SDK: 1.14
The current 1.15 version of the Add-on SDK seems to be incomaptible with Python 2.7.6.
I got the same error and downgraded to Python 2.7.5 to solve this issue.
Here are some relevant bug reports:
Bug 950894 - [mozprocess] TypeError under windows evironment in cpython 2.7.6
Bug 958609 - Add-on SDK 1.15 incompatible with Python 2.7.6
Update: The bug has been fixed.
I suggest getting the latest version of the SDK (addon-sdk-1.15.zip) from the Mozilla Developer Hub :: Add-ons for Firefox web page. Also make sure to read an follow the instructions in the README file that comes with it (if you haven't already).
One pertinent thing it says is:
If you get an error when running cfx or have any other problems
getting started, see the "Troubleshooting" guide at:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/troubleshooting.html
try to install add-on sdk 1.15 with python 2.6.6 then do this steps
1- Download cp720
2- unzip the zip file.
3- Copy or Move the file cp720.py into your python encodings folder.
Example: C:\Python26\Lib\encodings\

Categories

Resources