Bug 53725 - Instant Word count: Does not work, Python Error Message
Summary: Instant Word count: Does not work, Python Error Message
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Extensions (show other bugs)
Version:
(earliest affected)
3.4.5 RC1
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL: http://extensions.libreoffice.org/ext...
Whiteboard:
Keywords:
Depends on:
Blocks: Word-Count
  Show dependency treegraph
 
Reported: 2012-08-19 18:02 UTC by Only A Test Account, do not aadd to CC!
Modified: 2016-10-24 21:20 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Error Message (51.58 KB, image/png)
2012-08-19 18:06 UTC, Rainer Bielefeld Retired
Details
Extension (11.02 KB, application/vnd.openofficeorg.extension)
2013-04-14 14:46 UTC, Leif Lodahl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Only A Test Account, do not aadd to CC! 2012-08-19 18:02:42 UTC
Found with Server Installation (own profile) of "LibreOffice 3.4.5 RC1  - WIN7 Home Premium (64bit) German UI [Build ID: OOO340m1 (Build:501)]": When I try to use "Instant Word count" I get an Error Message as shown in Attachment.

Same with 3.5.6.2
Comment 1 Rainer Bielefeld Retired 2012-08-19 18:05:31 UTC
Sorry, used my test account for bug submission.

Leif, what do you think?
Comment 2 Rainer Bielefeld Retired 2012-08-19 18:06:14 UTC
Created attachment 65789 [details]
Error Message
Comment 3 Leif Lodahl 2012-08-19 19:30:37 UTC
Hmmm.

I must admit that I haven't spend much time on the extension lately because we have a word count in status bar and a 'floating' word count window in LibreOffice.

Its quite some time I created the extension. I'm using it myself almost everyday without any problems. (Linus 32 bit).

I remember some problems with the Python framework from earlier. As I remember it the extension MUST be installed as a user extension (not an administration installed extension). But I don't recall all the details. 

I think we should try with one or two other Python extensions for benchmarking. 

The macro is launched with the following syntax:
vnd.sun.star.script:wordcount.oxt|wc|wc.py$wordCount?language=Python&location=user:uno_packages

Perhaps that syntax is outdated?
Comment 4 Yawar Amin 2013-04-14 06:04:29 UTC
Leif,

Yikes. I've really slacked off on this one :-)

The error is because of a vestigial `print' statement in the wc.py file. Since recent versions of OOo/LibO are using Python 3, the print statement should be turned into a print function--basically line 54 should be changed from `print ...' to `print(...)'.

However even after this change I seem to be having some trouble with counting words in a selection. Working on this now in the BitBucket repo at https://bitbucket.org/yawaramin/oo.o-live-word-count/overview

If anyone can help debug that, would appreciate. Contact me for details....

Thanks,

Yawar
Comment 5 Yawar Amin 2013-04-14 07:10:53 UTC
OK. Selection word count bug fixed and code simplified. Leif, can you package the new version I've just pushed to BitBucket?

Thanks
Comment 6 Leif Lodahl 2013-04-14 14:46:27 UTC
Created attachment 77950 [details]
Extension

The script is now bundled as an extension.

Please note that this extension is LibreOffice only. Open Office will not run it as a result of the Python upgrade.

I have tested on Linux and Windows. 

The counter works fine but it seems that the goal value is not stored as document variable. As a consequence of this the goal is not stored in the document.

I will look into this problem later.
Comment 7 Yawar Amin 2013-04-14 21:10:48 UTC
Hi Leif,

(In reply to comment #6)
[...] 
> Please note that this extension is LibreOffice only. Open Office will not
> run it as a result of the Python upgrade.

Ah, I didn't realise that OOo is still on Python 2. However ... I think it should still work. The newest Python feature that I'm using is probably conditional expressions from 2.5.