complie python แล้ว module ไม่มา

  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.
  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.

ผม complie python แล้ว module ไม่มานะครับ
ผมทดลองทั้ง py2exe และ pyIntall
คือผม import module mechanize มาใช้งานนะครับ
แต่พอ complie เป็น exe แล้วไปรันเครื่องอื่น
ตอนรันมันบอกว่า ImportError:No module name mechanize
นะครับ แล้วยังนี้ผมต้องแก้ไขอย่างไรหรือครับ

sugree's picture

ลองบังคับใส่ใน py2exe

khao_lek's picture

บังคับยังงัยหรือครับ มีตัวอย่างไหมครับ

sugree's picture
setup(
    options = {"py2exe": { "compressed": 1,
                           "optimize": 2,
                           "ascii": 1,
                           "bundle_files": 1,
                           "includes": [ "encodings.utf_8", "_xmlplus.sax.drivers2.*" ] }},
    zipfile = None,
    windows = [MyAppWithSOAP]
    )

ตรง includes น่ะ

khao_lek's picture

ขอบคุณครับ includes นี้ ใส่ไว้ในไฟล์ setup.py ของ py2exe หรือ ว่า ไว้ตรงหัวไฟล์โปรแกรมของเรา ตอนที่ import module เข้ามาหรือเปล่าครับ ผมไม่รู้จริงๆ นะครับ

sugree's picture

มันคือใน setup.py ที่ต้องเรียก setup() ไงครับ

ย้าย Codenone

ประกาศย้าย Codenone ไปใช้ Forum ของ Blognone แทนครับ ตามไปตั้งกระทู้ต่อได้ที่ Codenone Forum (รายละเอียดอ่านจากกระทู้ ย้าย Codenone ไปรวมกับ Blognone)

กระทู้เก่าๆ จะย้ายตามไปในภายหลัง ตอนนี้ปิดการโพสต์กระทู้ไว้ เหลือไว้เฉพาะอ้างอิงเท่านั้น