2017-10-17 13 views
0

私はGIMP 2とWebSocketを(javaとjsで)広範囲に使用しましたが、私はPythonが初めてです。GIMP Pythonとウェブソケット

は、私は私のGIMPプラグインでのWebSocketクライアントを使用したいので、私は自分自身(PIPが付属しています)Pythonの2.7.14を得た、と私はこれのWebSocketの実装で見つかった指示インストールを実行しました:https://github.com/websocket-client/websocket-client

Iをそれが 'six'と 'backports.ssl_match_hostname'に依存することを知ったので、私はpipを使って両方をインストールし、6つはすでにインストールされていて、バックポートは更新されました。次のように

私のプラグインは次のとおりです。

#!/usr/bin/env python 

from gimpfu import * 
import websocket 

def python_pytest(img, layer) : 
    # Actual plug-in code will go here 
    ws = websocket.WebSocket() 
    ws.connect("ws://example.com/websocket", http_proxy_host="proxy_host_name", http_proxy_port=3128) 
    return 

register(
    "python_fu_pytest", #Name so other scripts can find us 
    "Collaborative Editing", #Short Desc 
    "WebSocket based collaborative editing", #Long description 
    "Jonathan Crowder", #Author 
    "Open Source", #Copyright Holder 
    "2017", #Copyright Date 
    "NetCanvas", #Plugin name in menus 
    "*", #Image types we can handle 
    [], #Params shown to user 
    [], #Return values 
    python_pytest, #Main function 
    menu="<Image>/NetCanvas") #Where to show in menus 
main() 

私はWebSocketの関連のコードを取り除く場合は、うまく動作しているように見えますが、私は上記のコードでこのエラーを取得:

(gimp-2.8.exe:5508): LibGimpBase-WARNING **: gimp-2.8.exe: gimp_wire_read(): error 
Querying plug-in: 'C:\Users\Jonathan\.gimp-2.8\plug-ins\netcanvas.py' 

(gimp-2.8.exe:5508): LibGimpBase-WARNING **: gimp-2.8.exe: gimp_wire_read(): error 

私はデバッグの巡礼者ではありませんが、何がうまくいかないかを知るには十分な情報がありません。

gimp-2.8 --verbose --console-messages 

私は間違って何をしていますか?私のインストールしたライブラリをgimpのpythonプラグインで読み取ることはできませんか? gimpからさらに情報を得る方法はありますか?私は考えていました。

編集 - だけでは明確にするために、あなたは私がジューシーなデバッグ情報を含めないと思う包みここで、私の全体のログです..:WindowsのGimpの上

INIT: gimp_load_config 
Parsing 'C:\Users\Jonathan\.gimp-2.8\unitrc' 
Parsing 'C:\Program Files\GIMP 2\etc\gimp\2.0\gimprc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\gimprc' 
gimp_composite: verbose=no 
Processor instruction sets: +mmx +sse +sse2 -3dnow -altivec -vis 
Adding theme 'Default' (C:\Program Files\GIMP 2\share\gimp\2.0\themes\Default) 
Adding theme 'Small' (C:\Program Files\GIMP 2\share\gimp\2.0\themes\Small) 
Writing 'C:\Users\Jonathan\.gimp-2.8\themerc' 
Trying splash 'C:\Users\Jonathan\.gimp-2.8\gimp-splash.png' ... failed 
Trying splash 'C:\Program Files\GIMP 2\share\gimp\2.0\images\gimp-splash.png' .. 
. OK 
INIT: gimp_initialize 
INIT: gimp_real_initialize 
INIT: gui_initialize_after_callback 
INIT: gimp_restore 
Parsing 'C:\Users\Jonathan\.gimp-2.8\parasiterc' 
Loading 'brush factory' data 
Loading 'dynamics factory' data 
Loading 'pattern factory' data 
Loading 'palette factory' data 
Loading 'gradient factory' data 
Loading fonts 
Loading 'tool preset factory' data 
Parsing 'C:\Users\Jonathan\.gimp-2.8\templaterc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\modulerc' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-c 
myk.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector 
-cmyk.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-w 
ater.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector 
-water.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-w 
heel.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector 
-wheel.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcontroller-dx-di 
nput.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcontroller-dx- 
dinput.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-c 
olor-blind.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter 
-color-blind.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-g 
amma.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter 
-gamma.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-h 
igh-contrast.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter 
-high-contrast.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-l 
cms.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter 
-lcms.dll' 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-p 
roof.dll' 
Unloading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter 
-proof.dll' 
INIT: gui_restore_callback 
clipboard: writable pixbuf format: image/png 
clipboard: writable pixbuf format: image/bmp 
clipboard: writable pixbuf format: image/x-bmp 
clipboard: writable pixbuf format: image/x-MS-bmp 
clipboard: writable pixbuf format: image/x-icon 
clipboard: writable pixbuf format: image/x-ico 
clipboard: writable pixbuf format: image/x-win-bitmap 
clipboard: writable pixbuf format: image/tiff 
clipboard: writable pixbuf format: image/jpeg 
Parsing 'C:\Users\Jonathan\.gimp-2.8\sessionrc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\dockrc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\toolrc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\contextrc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-rect-select-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-ellipse-select-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-free-select-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-fuzzy-select-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-by-color-select-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-iscissors-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-foreground-select-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-vector-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-color-picker-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-zoom-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-measure-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-move-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-align-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-crop-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-rotate-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-scale-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-shear-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-perspective-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-flip-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-cage-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-text-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-bucket-fill-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-blend-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-pencil-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-paintbrush-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-eraser-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-airbrush-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-ink-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-clone-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-heal-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-perspective-clone-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-convolve-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-smudge-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-dodge-burn-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-desaturate-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-color-balance-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-hue-saturation-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-colorize-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-brightness-contrast-tool' 

Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-threshold-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-levels-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-curves-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-posterize-tool' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\tool-options\gimp-gegl-tool' 
INIT: gimp_real_restore 
Parsing 'C:\Users\Jonathan\.gimp-2.8\pluginrc' 
Querying plug-in: 'C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\pyconsole.py' 

(gimp-2.8.exe:5508): LibGimpBase-WARNING **: gimp-2.8.exe: gimp_wire_read(): err 
or 
Querying plug-in: 'C:\Users\Jonathan\.gimp-2.8\plug-ins\netcanvas.py' 

(gimp-2.8.exe:5508): LibGimpBase-WARNING **: gimp-2.8.exe: gimp_wire_read(): err 
or 
Writing 'C:\Users\Jonathan\.gimp-2.8\pluginrc' 
Starting extension: 'extension-script-fu' 
INIT: gui_restore_after_callback 
Parsing 'C:\Users\Jonathan\.gimp-2.8\menurc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\devicerc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\controllerrc' 
Parsing 'C:\Users\Jonathan\.gimp-2.8\colorrc' 
loading menu 'C:\Program Files\GIMP 2\share\gimp\2.0\menus\image-menu.xml' for/
image-menubar 
Loading module 'C:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-l 
cms.dll' 
EXIT: gimp_exit 
EXIT: gui_exit_callback 
Writing 'C:\Users\Jonathan\.gimp-2.8\sessionrc' 
Writing 'C:\Users\Jonathan\.gimp-2.8\dockrc' 
Writing 'C:\Users\Jonathan\.gimp-2.8\colorrc' 
Writing 'C:\Users\Jonathan\.gimp-2.8\menurc' 
Writing 'C:\Users\Jonathan\.gimp-2.8\controllerrc' 
Writing 'C:\Users\Jonathan\.gimp-2.8\toolrc' 
EXIT: gimp_real_exit 
Writing 'C:\Users\Jonathan\.gimp-2.8\templaterc' 
Writing 'C:\Users\Jonathan\.gimp-2.8\parasiterc' 
Writing 'C:\Users\Jonathan\.gimp-2.8\unitrc' 
EXIT: gui_exit_after_callback 
EXIT: app_exit_after_callback 
(Type any character to close this window) 

答えて

0

ので、独自のPythonインタプリタが付属しています(トンを参照してください(...あなたはgimpfuモジュールを追加し、おそらく他のどのに)

  • はGimpのはあなたに別のインタプリタを使用して持っているインタプリタインスタンスのためにあなたのパッケージをインストールする(最も簡単な解決策の私見):あなたはどちらかしな​​ければなりません彼はGimpインストールディレクトリのlib/gimp/2.0/interpreters/pygimp.interp

いくつかのヒントは、Gimpのpythonスクリプトhereをデバッグします。

+0

すぐにお返事ありがとうございます。私は今夜コードに取り組み、修正するために何をしているのかを報告します。私は最初にシステムのpythonにGIMPを接続しようと思っていますが、私はちょうど何が起きているかを見るために両方をやるつもりです。 –

関連する問題