473,396 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PIL + show() + Vista

Hi!

This code:
import Image
img = Image.open(r"D:\ParisNude.jpg")
img.show()

Don't run on my Vista computer.

I have a solution:
import Image,os
img = Image.open(r"D:\FLundhNoNude.jpg")
os.startfile(img.filename)

It's only in my case?
It's censure? ;-)
PIL does not approve humour?
A solution soon?

@-salutations

Michel Claveau

Nov 30 '07 #1
6 1527
This code:
import Image
img = Image.open(r"D:\ParisNude.jpg")
img.show()

Don't run on my Vista computer.

I have a solution:
import Image,os
img = Image.open(r"D:\FLundhNoNude.jpg")
os.startfile(img.filename)
....
Michel ....

As an alternative you might also try passing the path
to your favorite image viewer as a parameter to the
command argument of the image show method ....

iview = "/mnt/win_c/Program Files/IrfanView/i_view32.exe"

im.show( command = iview )
--
Stanley C. Kitching
Human Being
Phoenix, Arizona

Nov 30 '07 #2
Hi!

Not a true solution ; because people who don't have IrfanView don't use
it.

@-salutations

Michel Claveau

Nov 30 '07 #3
Re!

I have found the problem. On Vista, the Windows-Photo-Galery (soft
default displayer) don't wait. Even with START /WAIT (in Image.py &
_showxv), it don't wait.

Then, like the preview don't wait, the (next) "DEL" run prior the end of
the launch of the software ; and Windows-Photo-Galery don't found the
file...

I don't have a good solution. For force view of image, it's possible to
delete the "DEL /F %s" part ; but that will involve many BMP/temporary
files.

@+ & sorry for my bad english

Michel Claveau
Nov 30 '07 #4
Méta-MCI (MVP) wrote:
Re!

I have found the problem. On Vista, the Windows-Photo-Galery (soft
default displayer) don't wait. Even with START /WAIT (in Image.py &
_showxv), it don't wait.

Then, like the preview don't wait, the (next) "DEL" run prior the end of
the launch of the software ; and Windows-Photo-Galery don't found the
file...

I don't have a good solution. For force view of image, it's possible to
delete the "DEL /F %s" part ; but that will involve many BMP/temporary
files.
I was going to suggest using FindExecutable to find out whatever
your system uses to show pictures... but then I tried it out and
found out that the association is actually via the shimgvw DLL.
So I suppose you'll have to special-case that.

<code>
import win32api
import subprocess

filepath = r"c:\temp\test.jpg"
res, exe = win32api.FindExecutable (filepath)
if exe.endswith ("shimgvw.dll"):
cmd = "rundll32.exe %s,ImageView_Fullscreen %s" % (exe, filepath)
else:
cmd = "%s %s" % (exe, filepath)

subprocess.call (cmd)

</code>

On my XP machine this waits for the ImageViewer to return.
Be interesting to see if that's different under Vista. At
least it offers you a little more control, perhaps?

TJG
Nov 30 '07 #5
Hi!
Sorry, I don't understand english. But, with Babelfish-translation, I
recovered essence...
(you should learn French ; yes! yes! yes!)

I'm glad you found a solution
Thank you for your solicitude

if that executable doesn't honour the wait
I have just try on another CPU, with a very new Vista-premium
(configuration of exit of factory). The assoc est made with the
WindowsPhotoGallery.exe who don't respect the WAIT

universally is the solution.
The universal solution, it's... you!
With forthcoming once.
--
Michel Claveau

Nov 30 '07 #6
Méta-MCI (MVP) wrote:
[Excuse my execrable French below]
Sorry, I don't understand english. But, with Babelfish-translation, I
recovered essence...
(you should learn French ; yes! yes! yes!)
Vraiment!
I have just try on another CPU, with a very new Vista-premium
(configuration of exit of factory). The assoc est made with the
WindowsPhotoGallery.exe who don't respect the WAIT
Ceci fonctionne sur XP et Vista, esperant jusqu'a que
termine le ImageViewer. C'est possible de utiliser le
subprocess, mais j'oublie toujours les options differents.

This works on XP and Vista, waiting until the ImageViewer
has exited. You could use the subprocess module, but I
never remember the different options.

<code>
import os

filepath = "c:/temp/test.jpg"
assoc = os.popen ("assoc .jpg").read ().splitlines ()[0]
_, filetype = assoc.split ("=")
ftype = os.popen ("ftype %s" % filetype).read ().splitlines ()[0]
_, exe = ftype.split ("=")

#
# NB *must* use correct slashes
#
cmd = exe.replace ("%1", os.path.normpath (filepath))
os.system (cmd)

</code>

TJG
Nov 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: salad | last post by:
Due to an earlier posting I read in this newsgroup regarding Office 2007 beta, I downloaded it. After I DL'd it, I got an invitation from MS to get WinVista. I am now wondering if, since both...
56
by: Squishy | last post by:
I tried installing my VS2005 Pro on Vista Ultimate 32 bit RTM today and got errors stating that VS2005 was not compatible with Vista. Microsoft......please pull your finger out of my ass and tell...
6
by: j2ee.singh | last post by:
Hi, I'm looking to buy a new laptop primarily to learn & practice .NET and C#. My Question is: Is there any requirement for .NET and C# in terms of the following Operating Systems: -...
0
by: Jim88 | last post by:
Hi, I'm having a problem to show a screen as vbmodal in the environment below. Platform: windows vista Language: VB 6 Currently, I have a executable file called StartShell.exe, that will...
2
by: 13Rockes | last post by:
I am in the process of writing programs using VB6 in XP Pro. However, I am thinking about starting over using VB2005 as my company is migrating to Vista. Two questions... What kinds of...
11
by: idoublepress | last post by:
Hi all, I've been struggling with an issue that I hope you can comment on or provide suggestions to. Our .NET 2.0 (VS2005) based product is crashing (when the user selects a particular feature on...
1
by: =?Utf-8?B?TFQgS2hvbw==?= | last post by:
Hello everybody, I had a window service program that invokes command scripts from bat/cmd files using the C function "system", compiled using Visual Studio 2005. When the scripts are invoked in...
2
by: =?Utf-8?B?VVNBT3o=?= | last post by:
I am using Windows Vista Ultimate (x86). I accidently deleted my Desktop Recycle Bin. I restored it (Control Panel/Personalise/Change Desktop Icons). I clicked on the Recycle Bin (Full) icon...
0
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, well i had no need for it until today, so how can i bring up the "Backup and Restore" Dialog in Vista? In W2K and XP its still ntbackup.exe but with vista it changed to something like a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.