WKHTMLTOPDF options - python-3.x

I can run the following comand under Win cmd box:
"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --header-html "C:\temp\Header.html" http://google.de "C:/temp/out_new1.pdf"
Output looks like expected and includes the Header.html
However, if I try to place it in Python it will return errors.
I've tryed the following configruration:
path_wkthmltopdf = "'C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe' --header-html 'C:/temp/Header.html'"
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
I'm receiving the following error:
OSError: No wkhtmltopdf executable found: "'C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe' --header-html 'C:/temp/Header.html'"
Can u help please?
Thank you very much in advance
Andreas

thanks for the tips.
I figured out how it works.
I try somesing like:
path_wkthmltopdf = r"'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe' options=pdf_options"
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
which is not working.
You have to put the option to the call like
pdfkit.from_string(data, outputfile_name, configuration=config, options=pdf_options)
Best regards
Andreas

Related

.exe has stopped working when use thread module

I just copy the code from the example on nim's offical documentation:
import std/locks
var
thr: array[0..4, Thread[tuple[a,b: int]]]
L: Lock
proc threadFunc(interval: tuple[a,b: int]) {.thread.} =
for i in interval.a..interval.b:
acquire(L) # lock stdout
echo i
release(L)
initLock(L)
for i in 0..high(thr):
createThread(thr[i], threadFunc, (i*10, i*10+5))
joinThreads(thr)
deinitLock(L)
$ nimble build --threads:on
Verifying dependencies for thread#0.1.0
Building thread/thread.exe using c backend
$ .\thread
then thread.exe crashed...
thread.exe
0.0.0.0
630c5e83
libwinpthread-1.dll
6.3.9600.20512
62cdfc6e
c0000135
00000000000ed1b0
1fc8
01d8bb71e28918ba
F:\MyProjects\Nim\thread\thread.exe
libwinpthread-1.dll
2044d161-2765-11ed-827a-6c86063c07b4
I have no ideas about it...Can anybody help me? Thanks a lot.
Gave it a try in Windows 8.1, it does fail.
Apparently is a recent regression in nim you can make it work if you compile it with --threads:on --tlsEmulation:on (or make sure mingw binaries is on your PATH).

Running Detectron2 locally - windows - [Pytorch Config error]

I am trying to run this code locally:
https://gist.github.com/shashank524/74d8f46d5de633b84e2265fcc34774de#file-tabledetection-ipynb
After installing required packages, when I am trying to run this line:
import layoutparser as lp
# PubLayNet
model = layoutparser.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config',extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.81],label_map={0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"})
I receive this error:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\username/.torch/iopath_cache\\s/f3b12qc4hc0yh4m\\config.yml?dl=1.lock'
I looked into the directory and there was no config file available.
I tried to download the config file from here (https://layout-parser.readthedocs.io/en/latest/notes/modelzoo.html) and put it in the directory but it didn't solve the issue!
Even I got a similar error. I tried out manually some work around in Windows.
I am using your case as example: OSError: [Errno 22] Invalid argument: 'C:\Users\username/.torch/iopath_cache\s/f3b12qc4hc0yh4m\config.yml?dl=1.lock'
Please follow the following process.
Navigate to C:\Users\username/.torch/iopath_cache\s/f3b12qc4hc0yh4m\config.yml
Open that config.yaml file
Scroll down to WEIGHTS: https://www.dropbox.com/s/h7th27jfv19rxiy/model_final.pth?dl=1 should be around 265 line.
Copy that link and paste it in your browser, a 'model_final.pth' will be downloaded. Copy this file to your desired folder.
Now replace the path to WEIGHTS: your_desired_folder\model_final.pth
Save it and run the code it works!
But there is a small work around I think before you do this (if you have not done)
iopath work around
https://github.com/Layout-Parser/layout-parser/issues/15 (Github link to the issue)
Hope this helps!

Imaplib syntax error in Terminal but not in IDLE

I'm starting out learning Python 3 on Linux and am attempting to write a script to notify me when I receive emails from certain people. The following code works fine in IDLE3 but I am encountering an invalid syntax error when I try to run it from Terminal:
tcd = imaplib.IMAP4_SSL('outlook.office365.com')
tcd.login(addr, password)
tcd.select('INBOX', readonly=False)
The Terminal error is as follows:
File "mailcheck.py", line 22
tcd = imaplib.IMAP4_SSL('outlook.office365.com')
^
SyntaxError: invalid syntax
Any advice would be greatly appreciated!
Turns out I was missing a closing parenthesis at the end of the line before this. Rookie mistakes >:-/

AutoIt Script to run .exe file

I want to run an application which is located in the following directory:
C:\LCR 12\stu.exe
With AutoIt, what would be the code to run the above stu.exe file?
Like this:
Run("C:\LCR 12\stu.exe")
Hope this is what you were after.
You can do by using a variable as below:
Local $exeLocation = "C:\LCR 12\stu.exe"
Run($exeLocation)

MFMailComposeController

i m trying to implement MFMailViewComposeViewController... but getting some following error plz tell why this is happing.. i am new to iPhone...
Line Location Tool:0: ".objc_class_name_MFMailComposeViewController", referenced from:
Line Location Tool:0: symbol(s) not found
Line Location Tool:0: literal-pointer#__OBJC#__cls_refs#MFMailComposeViewController in FriendShoppingListViewController.o
thanks in advance if possible provide the code..
You have to import MessageUI.framework to your project to make MFMailViewComposeViewController work.

Resources