0

Im trying to open a powerpoint file from python script.

I use tkFileDialog.askopenfilename to choose the powerpoint file, and then subprocess to open the chosen file.

The powerpoint itself is opened, but then it shows an error that it couldn't read the file, and shows ? instead of the hebrew characters.

I tried the same command I try in subprocess.call manually in cmd and it worked.

# coding=utf-8
from Tkinter import Tk
from tkFileDialog import askopenfilename
import re
from subprocess import call

file_name = ""
Tk().withdraw() 
while not re.match('.*?\.pptx', file_name):
    file_name = askopenfilename()  

call([here is the path to POWERPNT.EXE, file_name.encode('ascii', 'replace')])

Maybe there are other ways to open a powerpoint file?

Or maybe there is a way to deal with the Hebrew problem?

(Without .encode('ascii', 'replace') it throws UnicodeEncodeError.)

AHeyne
  • 3,377
  • 2
  • 11
  • 16
Daniela
  • 1
  • 1

0 Answers0