Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
17641 มุมมอง

I have a module with the following code

from openerp.osv import orm, fields

from openerp.tools.translate import _

import os, sys

import win32print


When I install the module I get an error "ImportError: No module named win32print"

อวตาร
ละทิ้ง

install win32print on your system, it is missing.

ผู้เขียน

I installed python-2.7.10.msi I also installed pywin32-219.win32-py2.7.exe Is there any other configuration I must make for odoo to pick win32print

คำตอบที่ดีที่สุด

Just two years late, I have an answer for this.

The point is not only to install python module, but also to let Odoo know about it.

I have downloaded pypiwin32 (i.e. the pip version of pywin32), and I have copied \win32 under the \server folder of Odoo.

Now I can see \server\win32\win32print.pyd (among many other files)

Odoo searches modules in \server, not in \server\win32, so it cannot find that.

I don't know what is the correct way to add a sys.path in Odoo, anyway, the following works:


import sys
FOLDER = 'C:\\Program Files (x86)\\Odoo 10.0\\server\\win32' # or wherever you installed it
if not FOLDER in sys.path: 
    sys.path.append(FOLDER) import win32print
อวตาร
ละทิ้ง
ผู้เขียน

Thanx, I wish I had enough karma to vote

Related Posts ตอบกลับ มุมมอง กิจกรรม
8
พ.ค. 25
42946
1
มิ.ย. 23
2678
3
ม.ค. 24
15646
1
ม.ค. 22
5183
4
ก.พ. 24
12586