Produit du jour : Microsoft Office 2007 Famille et étudiant à partir de 114.00 € (Logiciel)
08/07/2008 16:48 par Pierre | 1 réponse(s) | Signaler un contenu abusif ou erroné
J'utilise le script python webkit2png version 0.4 qui fonctionne très
bien quand on l'utilise en ligne de commande depuis le terminal de
Leopard.

Mon problème est que j'ai besoin de l'utiliser à partir de php et que
ça ne fonctionne pas.

Je fais un exec("/usr/bin/python /le_path_vers_webkit2png/
webkit2png.py /le_path_vers_le_fichier_html/fichier.html");

En retour j'ai "Cannot find pyobjc library files. Are you sure it is
installed?", ce qui signifie que l'interpréteur Python fait bien son
boulot,
mais que le script n'arrive pas à importer la librairie PyObjc.

Dans ce script python on à ce code pour importer les librairies :

import sys

try:
import Foundation
import WebKit
import AppKit
import objc
except ImportError:
print "Cannot find pyobjc library files. Are you sure it is
installed?"
sys.exit()

Le problème doit venir du fait que php et Apache ne connaissent pas
Foundation, Webkit etcŠ, il faudrait le path complet,
or quand je spécifie le path complet du genre /System/Library/
Frameworks/Foundation.framework/Versions/C/Resources/BridgeSupport/
Foundation.dylib,
Python me dit :

File "webkit2png.py", line 27
import /System/Library/Frameworks/Foundation.framework/Versions/C/
Resources/BridgeSupport/Foundation.dylib
^
SyntaxError: invalid syntax

Comment dire au script python d'importer les librairies par un path
complet ?

Merci.
Voir la réponse - Poster une réponseCe sujet ne répond pas à vos besoins ? Posez votre question !
mots-clés : appel, script, python, chargement Catégories : OS Alternatif, Mac OS X
 
diskutil et no space left on device
[Q] Comment désinstaller QuickTime?
 

 

Téléchargements

Tous les téléchargements