From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101885 invoked by alias); 4 Mar 2016 23:16:32 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 101866 invoked by uid 89); 4 Mar 2016 23:16:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=UD:cz, Technical, auxiliary, Hx-languages-length:3140 X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 04 Mar 2016 23:16:30 +0000 Received: by mail-wm0-f45.google.com with SMTP id n186so10901093wmn.1 for ; Fri, 04 Mar 2016 15:16:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=OvGUWKTDLUapLJ0SUpJt0wyNnM3BucoMbuCh14OV/rw=; b=NzpIHlNfiSa4eB9NfPHu3CsmeN2k6X+VKIYSuNJSvCoAkddPoR5I4RwCL2biBe9UFN TnzNF3OYYS6Be+ML8j5FmD6NVXfnk0CBqQrRduiLfJidIhE+V9kGS//fdvwKLk6D9NOO LuSbvinWRNYxLZhSiweGjJhHvoy9rNAOC77u4KoQd8S63gHvDZja2MUnfPO77qNoXcnR ysDLzAwX1n+JL5UveSVBSyaC+YYcYbek0JUtPIuIw8klQcV/hfacgxjdPuzasrOzZ7Be xeFbI+mt6JLga2ZWUlhypVugdj+FtpVVlV9PrQHjJ+5PXyeIRJfLnunJsMO0xh5zBvrK 8KRQ== X-Gm-Message-State: AD7BkJL6UAic8WrN/52stkXQv7po5jeTQebLLz9poejYdEVC7t0P3JeGKMPYsnluyT/0/g== X-Received: by 10.194.83.42 with SMTP id n10mr11555758wjy.20.1457133387188; Fri, 04 Mar 2016 15:16:27 -0800 (PST) Received: from [147.230.11.237] (vpn237.tul.cz. [147.230.11.237]) by smtp.gmail.com with ESMTPSA id ys9sm5459320wjc.35.2016.03.04.15.16.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Mar 2016 15:16:25 -0800 (PST) To: cygwin@cygwin.com From: Jan Brezina Subject: python: problem loading module in DLL X-Enigmail-Draft-Status: N1110 Cc: =?UTF-8?B?SmFuIEh5YsWh?= Message-ID: <56DA1747.3090803@gmail.com> Date: Fri, 04 Mar 2016 23:16:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-03/txt/msg00041.txt.bz2 Hi, we are developing a multiplatform application using C++ with the embedded Python. The problem is that the import of the module 'binascii' (located in python2.7/lib-dynload/binascii.dll) fails when the C++ application (which eventually call the embedded python script) is called from the Windows cmd. Resulting error message is: 'ImportError: No such file or directory\n' However, the import works when the C++ application is called from the cygwin shell. Import of other module, in particular 'time' (located in python2.7/lib-dynload/time.dll), works in both cases. In fact it seems that the python found the binascii.dll, but was unable to load it somehow. If we create an auxiliary python2.7/lib-dynload/binascii.py we get the same error, so we guess that the importer found binascii.dll first but fail to load it and doesn't continue to find also binascii.py. The behavior is similar to the issue https://www.cygwin.com/ml/cygwin/2013-04/msg00408.html. We tried to reinstall zlib and related packages without success. >From our point of view it is a bug, but possibly such usage of the embedded Python is unsupported and we were just lucky until now using the modules that works only by chance. Anyway if it is not a bug, can anybody provide some hint what is the mechanism of loading DLL python modules and how to investigate the real problem (hidden by the generic error message). The code to reproduce the problem is on github: https://github.com/x3mSpeedy/cygwin-python-issue and also pasted at the end. thank you for any help. Jan Brezina and Jan Hybs Cygwin version: $ uname -a CYGWIN_NT-6.1 Flow123d 2.4.1(0.293/5/3) 2016-01-24 11:26 x86_64 Cygwin Windows version is: Windows 7 Bug occures in both python2.7 and python3.4 version: $ python2.7 --version Python 2.7.10 $ python3.4 --version Python 3.4.3 C++ code to reproduce the error: ----------------------------------------------------------------------- #include #include #include using namespace std; int main(int argc, char *argv[]) { Py_Initialize(); cout << "Python path: " << (Py_GetPath()) << endl; cout << "Python prefix: " << (Py_GetPrefix()) << endl; cout << "Python exec prefix: " << (Py_GetExecPrefix()) << endl; cout << "------------------" << endl; cout << "Python version" << endl; PyRun_SimpleString("\nimport sys; print (sys.version_info)"); cout << "------------------" << endl; cout << "Test: time module" << endl; PyRun_SimpleString("\nimport time as mod; print (mod, mod.__file__)" "\nfor x in dir(mod):\n" "\n print ('{:20s}{}'.format(x, str(getattr(mod, x, ''))[0:35]))" ); cout << "------------------" << endl; cout << "Test: binascii module" << endl; PyRun_SimpleString("\nimport binascii as mod; print (mod, mod.__file__)" "\nfor x in dir(mod):\n" "\n print ('{:20s}{}'.format(x, str(getattr(mod, x, ''))[0:35]))" ); Py_Finalize(); return 0; } ------------------------------------------------------------ -- ------------------------ Mgr. Jan Brezina, Ph. D. Technical University in Liberec, New technologies institute http://www.nti.tul.cz/cz/WikiUser:Jan.Brezina -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple