質問

私は前にPythonでプログラムさないので、私のコードを言い訳ことがありません。私は、端末内で実行されます。このスクリプトを持っているが、私はそれがクライアント側を実行するために取得することはできません。私は、Appceleratorのチタンのアプリケーションでこれを実行しています。とにかく、私はそれをトラブルシューティングされており、それがすべてのスレッドを実行していないようです。これは制限ですか?誰もが知っているのですか?

<script type="text/python">
import os
import sys
import Queue
import threading
class FindThread ( threading.Thread ):
   def run ( self ):
      running = True
      while running:
         if jobPool.empty(): 
            #print '<< CLOSING THREAD'
            running = False
            continue

         job = jobPool.get()
         window.document.getElementById('output').innerHTML +=  os.path.join(top, name)
         if job != None:
            dirSearch(job)             

jobPool = Queue.Queue ( 0 )

def findPython():
    #output = window.document.getElementById('output')
    window.document.getElementById('output').innerHTML += "Starting"
    dirSearch("/")
    # Start 10 threads:
    for x in xrange ( 10 ):
        #print '>> OPENING THREAD'
        FindThread().start()

def dirSearch(top = "."):
    import os, stat, types
    names = os.listdir(top)
    for name in names:
        try:
            st = os.lstat(os.path.join(top, name))
        except os.error:
            continue
        if stat.S_ISDIR(st.st_mode):
            jobPool.put( os.path.join(top, name) )
        else:
            window.document.getElementById('output').innerHTML +=  os.path.join(top, name)

window.findPython = findPython

</script>
役に立ちましたか?

解決

答えは、現在(金曜日、6月19、2009)は、スレッドを実行することができ、そうであるが、JavaScriptのオブジェクトにアクセスすることができ、メインスレッドが、何も、これはDOMを含みません。あなたがスレッドのアプリでUIを更新することを計画しているのであれば、これはまだ...ことはできません。 Appceleratorのチームまで、結合システムを介して可能なメインスレッドにキューのいくつかの並べ替えを作成します。

Appceleratorのフォーラムでの議論を参照してください。 のます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top