I am trying to generate code128 barcodes using Python/Elaphe, which is based on Barcode Writer In Pure Postscript (BWIPP). Strangely, the barcodes generated by Elaphe don't match the ones generated by BWIPP and do not conform to code 128 standard.
In particular, I tried a simple example, the generation of a barcode for the letter 'A' (capital A):
from elaphe import barcode
b = barcode('code128', 'A')
b.show()
That works just fine, but the generated barcode is missing the right part. It is 35 pixels wide, where it should be 46. The left part of the barcode matches the one generated by BWIPP and every other code128 generator - it's only the right section that is missing.
Anyone know what's wrong?
(Using elaphe 0.6.0 with python 2.7.10 on Kubuntu 15.10)
See this bug report:
https://bitbucket.org/whosaysni/elaphe/issues/84/code-128-generation-produces-unreadable
It seems that this bug is fixed in the current source version, also the bug is still marked as new.
The the patch which fixed this bug imho:
https://bitbucket.org/whosaysni/elaphe/commits/19dd8f58c76ac75914e3e4d8ae7db1b9489cbcb8?at=develop
This patch is from the 2014-10-22, the current version elaphe 0.6.0 on pypi is from 2013-12-05. If you installed via pip you have the buggy version.
There is a python3 enabled fork of this project https://pypi.python.org/pypi/elaphe3, which was uploaded on the 2016-05-25. So this fork might contain the necessary bugfix. You could remove elaphe and install elaphe3.
However, considering that elaphe (at least the non 3 version) looks pretty abandoned and has GhostScript and PIL as dependencies I would look for another solution.
Related
I saw that psychopy now has support for RTL language:
http://www.psychopy.org/api/visual/textstim.html
https://discourse.psychopy.org/t/reshaping-english-text-to-arabic/4235/16
I used this manual to install the latest version using conda:
http://psychopy.org/installation.html
My version is: 1.90.2 with Python 3.5
However, when init TextStim with languageStyle I get an error:
from psychopy import visual
text_stim = visual.TextStim(self.window, height = height, wrapWidth = wrapWidth, bold= True, text= sentence, pos = (0,0) , color='white', languageStyle='RTL')
Any idea how can I use it?
Yes, #deceze is correct, this feature in the latest beta, available for download from this page: https://github.com/psychopy/psychopy/releases rather than the latest stable release available from http://psychopy.org/installation.html
EDIT: actually I see that you're installing PsychoPy via pip under Anaconda. I guess the pip version is also lagging behind the current beta release. You might need to clone or download from the PsychoPy GitHUb repository if you want the latest developer release running under your own Python installation.
Note that this feature still doesn't handle multi-line text correctly in Python experiments (the text flows from right to left but also from bottom-to-top). This is due to a limitation in the underlying pyglet library we use for drawing text. However, the latest betas also allow for generating online Javascript experiments that can be run from a browser. These handle Arabic text correctly without any issues whatsoever (and with no need to specify the language style setting at all).
OS: Ubuntu 17.10
After an upgrade of Knitr to version 1.20, all my Python-code in latex didn't work anymore
First I had to install "reticulate".
That did the job but the output was missing all empty lines (very unreadable for my students).
And then again: echo=-c(1,2) doesn't work except echo=F
This does just concern using as engine Python and not R.
Any suggestions would be appreciated
Ps: another issue: engine Python does not like an # somewhere in the code
The relevant release notes are here: https://github.com/yihui/knitr/releases/tag/v1.18 Specifically:
[...] if you want the old behavior (new session for each Python code chunk), you can set the chunk option python.reticulate = FALSE
I'm trying to convert a rst document with images to odt, but rst2odt seems to fail to get the images from the third one.
It worked a year ago and I guess there must be some upgrade that has changed former behavior.
A simple doc that reproduces my problem is:
######
Report
######
First try
.. image:: image.png
Second try
.. image:: image.png
Last try
.. image:: image.png
The last one is missing in odt!
I process it with:
$ rst2odt test.rst test.odt
And I get an odt with just two images. The third is missing. When using --verbose option, I don't get any complain.
By the way, rst2odt version is (Docutils 0.12 [release], Python 2.7.9, on linux2)
Trying different tips, I've reinstalled python-imaging package and upgraded pillow with no luck
Curiously enough, rst2pdf is able to place the three images properly.
Any help would be highly appreciated since I have a considerable number of rst with a bunch of images, to translate into odt
EDITED: I've purged docutils from my system (Debian Jessie) and then reinstalled without improvement.
Maybe too late but...
I guess that this is because draw:name attributes in ODT outputs (content.xml) generated by rst2odt is set to fixed strings ("graphics2", etc.) and my experimental patch changes this behavior seems to work as far as I tested.
see also: https://bugzilla.redhat.com/show_bug.cgi?id=1360651
the patch: https://bugzilla.redhat.com/attachment.cgi?id=1248317
I don't think this is necessarily the answer you want, but pandoc seems to do a good job here:
pandoc -f rst -t odt in.rst -o out.odt
I think this is really an outstanding bug in rst2odt, and not the only one (see the python 3 latin-1 to utf-8 encode bug), and it doesn't seem that docutils is as well-maintained as it used to be.
I'm working with Openslide's python bindings. I am using Tif images, which are supported by Openslide. It seems I am able to use the methods read_region and get_thumbnail with a smaller, binary masked Tif of about 100 mb's.
However, with a larger, RGBa Tif of about 1.5 Gb, I get the following error:
openslide.lowlevel.OpenSlideError: Wrong JPEG library version: library
is 90, caller expects 80
I have libjpeg8d installed, and everything seems fine with a smaller Tif. Any suggestions on how fix this issue?
I would guess your smaller TIFF is not JPEG-compressed, but your larger one is.
When libtiff starts the jpeg decoder, it checks that the version number in the libjpeg library binary matches the version number in the libjpeg headers that it was compiled against, and if they do not match, it prints the warning you are seeing.
The error means that you have installed a new jpeg library, but not recompiled libtiff or perhaps openslide.
You don't say what platform you are using, but on linux these issues should all be handled for you by your package manager, as long as you stick to the supported versions. If you've built any parts of the system yourself, you'll need to recheck how each part was configured and installed, and how your environment has been set up.
i'm trying to utilize PIL to open a jpeg image and assign it to a Tkinter's label.
However whenever i try to open the image i get the same problem as this guy
I tried all the suggestions he got and also the ones i found here but it doesn't seem to fix, by installing PIL or Pillow(i tried that too) during the setup i get :
*** TKINTER support not available
*** JPEG support not available
And whenever i run my code i get an IOError: decoder jpeg not available
I'm using python 2.7.
Can someone provide a good method to make PIL or Pillow work with jpeg support? I've been googling extensively for two days, but all the possible fixes that i found don't seem to work for me
Installing libjpeg-dev should do the trick, as proposed by the link you provided. But if it doesn't help (I ran into that as well) you can consider upgrading to Pillow 3, it looks like you are running Pillow 2. This also helped me getting rid of the errors, don't know why exactly..