Excel To PDF in Python without win32com - python-2.7

I am trying to convert XLSX file to PDF.
I cannot use win32com as that machine is a server and it has no MS Office in it and there are no plans to do so.
I can't use xlrd as there are charts in the generated xl.
And there is no python3 but python2

Related

No module named 'nltk.lm' in Google colaboratory

I'm trying to import the NLTK language modeling module (nltk.lm) in a Google colaboratory notebook without success. I've tried by installing everything from nltk, still without success.
What mistake or omission could I be making?
Thanks in advance.
.
Google Colab has nltk v3.2.5 installed, but nltk.lm (Language Modeling package) was added in v3.4.
In your Google Colab run:
!pip install -U nltk
In the output you will see it downloads a new version, and uninstalls the old one:
...
Downloading nltk-3.6.5-py3-none-any.whl (1.5 MB)
...
Successfully uninstalled nltk-3.2.5
...
You must restart the runtime in order to use newly installed versions.
Click the Restart runtime button shown in the end of the output.
Now it should work!
You can double check the nltk version using this code:
import nltk
print('The nltk version is {}.'.format(nltk.__version__))
You need v3.4 or later to use nltk.lm.

Pytesseract - using .traineddata file on hosted server (Heroku)

I have a Vue, Django integrated project. I hosted the Vue project on Netlify and the Django project on Heroku. A python script (integrated into Heroku) is called on certain buttons which extract data and posts this to the Django API to be viewed on the frontend.
I have trained a font type for my pytesseract OCR script. However, when i run it on Heroku, it seems like i can only use the 'eng' (normal font) as 'language' for my pytesseract image_to_string function. If I have the .traineddata file of the font type that I want to use, how can I use this file within the pytesseract functions? I can call the individual file, but I need the right TESSDATA_PREFIX as well. Does someone know how to deal with this?
Thanks!
I had the same issue. It is olved by setting TESSDATA_PREFIX Config Var to a custom directory and inserting all .traineddata files to that directory.

Python to Excel basics using xlwings

I am new to xlwings and only have a basic knowledge of Python, I use excel for club statistics and graphs and can see how Python will help speed up these tasks. I am however, struggling with the basics of the Python to Excel process. "Instantiate" a workbook for example, Is there a primer for a dunce like me?
If you've got xlwings installed correctly, you should be able to use the xlwings command line client to create the quickstart workbook like so:
xlwings quickstart myproject
Once you've done that, working through the quickstart tutorial should get you started interacting with excel using a python script.

NLTK Wordnet Download Out of Date

New to Python, tying to get started with NLTK. After a rough time installing Python on my Windows 7 64-bit system, I am now having a rough time downloading Wordnet and other NLTK data packages located here:
http://nltk.org/nltk_data/
Some packages download, some say "Out of Date"
import nltk
nltk.download()
When I use the above to download, the program doesn't let me cancel if I hit the cancel button.
So, I just shut it down and go directly to the link above to try and download it manually. When I try to download Wordnet for example, the download starts in my browser but stops mid-way through download!
This is very frustrating for me as a beginner. Is there an alternative way to download Wordnet for nltk?
I was facing the same issue. The issue in my case was that when the NLTK downloader started it had the server index as
http://nltk.github.com/nltk_data/
This needs to be changed to
http://nltk.org/nltk_data/
You can change this by going into the NLTK Downloader window and the File->Change Server Index.
Regards,
Bonson

play online mp3 music in python

I'm writing an app in python which inclues playing online mp3 resouces , the mp3 file is represented by an url like http://xxxxx.mp3, Is there any suitable modules can handle this?
I'm using Ubuntu system and python 2.7.2.