Forum Archive

console.quicklook() crashes when pass a sequence of paths

nicktimebreak

I am learning python with Pythonista.
Recently I am writing a script to download images from a website.
Now I can get the images and I want to preview all the images.
The documents says It is possible to pass a sequence of paths (e.g. a list), in order to preview multiple files at once.
It is working well when I pass one image filepath to quicklook() like this:

console.quicklook(img1_path)

But when I pass a squence of image files to quicklook() like this:

console.quicklook([img1_path, img2_path])

Pythonista crashes and returns to home screen.
Is there any misunderstanding in using the function here๏ผŸ

ccc

What happens when you remove [ and ]?

zipit

Is there any misunderstanding in using the function here?

I do not think so, the documentation of the method states clearly that you can also pass a list of paths for file_path. The app also does crash for me both on passing a list of relative and absolute file paths as file_path.

Phuket2

Appears it's a bug to be reported... I also had the app crash. But can do something like the below to work around it until it's addressed.

import console

img1_path = 'IMG_1265.PNG'
img2_path = 'IMG_1241.JPG'

lst =[img1_path, img2_path]

#print(help(console.quicklook))
#print(dir(console.quicklook))
#console.quicklook(img1_path) + console.quicklook(img2_path)

for img in lst:
    console.quicklook(img)

for img in lst:
    console.show_image(img)
cvp

@Phuket2 Happy to see you back ๐Ÿ˜

Phuket2

@cvp , thanks good to be back. but i have forgotten everything now :) I have to start all over :(

omz

This does look like a bug. It seems to work in Python 2 mode though.

Welcome back, @Phuket2!

cvp

@Phuket2 The application will be even more profitable, with regard to the number of hours of fun for paid dollars ๐Ÿ˜‚

nicktimebreak

Finally I found it is a bug, the function work well in python 2. And a workaround for this bug is add #!python2 before console.quicklook()

Phuket2

@nicktimebreak , I submitted a bug report