Robot Framework complains SWIG generated python file contains no keywords - swig

I'm using SWIG to generate wrapper from C++ for Robot Framework as test library. RF issues a warning because it contains no keywords.
The system under test is a Win32 DLL, LibLogin2, created by VS wizard. It exports the function by default:
LIBLOGIN2_API int fnLibLogin2(void);
// This is an example of an exported function.
LIBLOGIN2_API int fnLibLogin2(void)
{
return 42;
}
I add interface file to the project:
/* LibLogin2.i */
%module LibLogin2
%{
extern int fnLibLogin2(void);
%}
extern int fnLibLogin2(void);
LibLogin2.py, LibLogin2_warp.cxx, _LibLogin2.pyd are built successfully with Release|x64.
I have a RF test case as follows:
*** Settings ***
Library LibLogin2.py
*** Test Case ***
Trivial
${value} = fnLibLogin2
Should Be Equal ${value} ${42}
I launch Robot Framework and get THE error:
pybot LoginTests.tsv
[ WARN ] Imported library 'LibLogin2.py' contains no keywords
I can work around this by commenting out the last line of LibLogin.py:
def fnLibLogin2():
return _LibLogin2.fnLibLogin2()
#fnLibLogin2 = _LibLogin2.fnLibLogin2
It's annoying when you have to comment out every key word every time.
Please advice!
Here is my configuration:
Windows 8 64-bit
Visual Studio 2012
Python 2.6.6
Robot Framework 2.7.5
swigwin-2.0.8

Related

ScriptControl doesn't work on VBA json parser in 64bit excel? [duplicate]

Is there any msscript control in 64 bit?
I google a bit and all say no 64-bit yet
The reason that I need 64bit msscript.ocx is that I want to compile delphi projects in 64-bit using XE3.
It compiles OK in XE3 and I have obtained a 64-bit exe but when it executes to the following line,
script := TScriptControl.Create(nil);
It gives me a 'Class Not Registered' error. I only found msscript.ocx under C:\windows\SysWOW64 but there is no such file under System32 folder.
I really want this to work so any quick replacement for this?
This is an old post. but I just found a very good alternative to 64-bit MSScript Control (Microsoft does not have 64-bit msscript.ocx)
http://www.eonet.ne.jp/~gakana/tablacus/scriptcontrol_en.html
and I have changed only a few lines of code in my application and it works in 64-bit based on this ScriptControl64.
The msscript component was not ported to 64 bit. It's a legacy component and MS chose not to put the effort into migrating it to 64 bit. You'll simply need to find another way to do whatever it is you do with that component.
I faced the same issue porting an c++ application from 32 to 64 Bit.
I know that this question was raised on Delphi but I hope someone can make use of this information or transfer it to other languages.
We where initiating the "ScriptControl" (MSScriptControl.ScriptControl.1) via CreateDispatch.
The control info is located in Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ScriptControl
and we executed VBS or JScript with this MS control in 32 Bit:
COleDispatchDriver* m_dispScriptControl = new COleDispatchDriver();
if (m_dispScriptControl)
{
if (m_dispScriptControl->CreateDispatch(_T("ScriptControl")))
{
...
.... setting language to be used and other proteries .. then execute script code:
_variant_t varResult;
VariantClear(&varResult);
EXCEPINFO excepinfo;
VARIANT parameters;
parameters.vt = VT_BSTR;
parameters.bstrVal = strScriptCodeWCHAR;
DISPPARAMS dispparams;
dispparams.rgdispidNamedArgs = NULL;
dispparams.cNamedArgs = 0;
dispparams.cArgs = 1;
dispparams.rgvarg = &parameters;
unsigned int uArgErr = 0;
if (S_OK != m_dispScriptControl->m_lpDispatch->Invoke(0x7d2, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dispparams, &varResult, &excepinfo, &uArgErr))
...
}
After some research it seems not to be possible to create the
ScriptControl in 64 bit application as of a MSDN query:
Question was: I have window forms application currently working fine
on 32 Bit Application and i am investigation so we can install it on a
64 bit computer but getting on lauching the application as below.
Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG))
The error is located on AxInterop.MSScriptControl.dll
Awnser is: If it ONLY lives in C:\Windows\SysWOW64, then your .Net
application cannot run in 64-bit mode. Make sure you compile it for
x86 instead of Any CPU. Then you'll be able to use it in 64-bit
Windows, but it will be a 32-bit process.
https://social.msdn.microsoft.com/Forums/windows/en-US/1e9ddfe4-3408-4a34-ba43-a1a0931daebd/64-bit-windows-7?forum=clr
With which we where not happy as we want to run as 64-bit process
Our solution was to use the Microsoft IActiveScript Interface. And implemented the same on our main window:
BEGIN_INTERFACE_PART(ActiveScriptSite, IActiveScriptSite)
STDMETHOD(GetLCID)(LCID*);
STDMETHOD(GetItemInfo)(LPCOLESTR, DWORD, LPUNKNOWN*, LPTYPEINFO*);
STDMETHOD(GetDocVersionString)(BSTR*);
STDMETHOD(OnScriptTerminate)(const VARIANT*, const EXCEPINFO*);
STDMETHOD(OnStateChange)(SCRIPTSTATE);
STDMETHOD(OnScriptError)(IActiveScriptError*);
STDMETHOD(OnEnterScript)();
STDMETHOD(OnLeaveScript)();
END_INTERFACE_PART(ActiveScriptSite)
Now when we have to execute script code we do the following, which works fine in 64 and 32 BIT versions of our built:
CString strLanguage;
if (nLanguage == 1)
{
strLanguage = _T("VBScript");
}
else
{
strLanguage = _T("JScript");
}
CComPtr<IActiveScript> m_pAxsScript;
HRESULT hr = m_pAxsScript.CoCreateInstance(CT2W(strLanguage), NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER);
m_pAxsScript->SetScriptSite(&m_xActiveScriptSite); //m_xActiveScriptSite is a member of the interface
CComQIPtr<IActiveScriptParse> m_pAxsScriptParse = m_pAxsScript;
m_pAxsScriptParse->InitNew();
EXCEPINFO pException = { 0 };
hr = m_pAxsScriptParse->ParseScriptText(_bstr_t(strCode), 0, NULL, NULL, dw, 0, 0, NULL, &pException);
//execute script
m_pAxsScript->SetScriptState(SCRIPTSTATE_CONNECTED);
m_pAxsScriptParse.Release();
m_pAxsScriptParse = nullptr;
hr = m_pAxsScript->SetScriptState(SCRIPTSTATE_DISCONNECTED);
ASSERT(hr == S_OK);
m_pAxsScript->Close();
m_pAxsScript.Release();

Not allowed in a constant expression for module access

I have two cython files:
intern.pxd
cdef int test = 8
extern.pyx
cimport intern
cpdef enum test_enum:
test = intern.test
If I try to compile this, It throws the following error:
Error compiling Cython file:
------------------------------------------------------------
...
cimport intern
cpdef enum test_enum:
test = intern.test ^
------------------------------------------------------------
side_tests\extern.pyx:4:17: Not allowed in a constant expression
I guess this is because the value of intern.test can not be known at compile time. I would like to get a solution for this. It is not an option to export the values of intern.pxd into extern.pyx because in the real project intern.pxd contains around 2000 external defined values/functions.
#DavidW pointed me to the working solution 'wrap in enum':
# In intern.pxd
cdef enum test_enum_intern:
test = 8
This works, but feels 'weird'. If somebody has another solution, he is welcome to post it.

Caffe error make test

I have already installed cudnn and cuda in the ubuntu, and I
make all -j4
under the caffe-master directory, it passed well. but when I
make test
it shows:
CXX src/caffe/test/test_im2col_layer.cpp
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
from ./include/caffe/common.hpp:19,
from ./include/caffe/blob.hpp:8,
from src/caffe/test/test_im2col_layer.cpp:5:
./include/caffe/util/cudnn.hpp: In function ‘void caffe::cudnn::createPoolingDesc(cudnnPoolingStruct**, caffe::PoolingParameter_PoolMethod, cudnnPoolingMode_t*, int, int, int, int, int, int)’:
./include/caffe/util/cudnn.hpp:127:41: error: too few arguments to function ‘cudnnStatus_t cudnnSetPooling2dDescriptor(cudnnPoolingDescriptor_t, cudnnPoolingMode_t, cudnnNanPropagation_t, int, int, int, int, int, int)’
pad_h, pad_w, stride_h, stride_w));
^
./include/caffe/util/cudnn.hpp:15:28: note: in definition of macro ‘CUDNN_CHECK’
cudnnStatus_t status = condition; \
^
In file included from ./include/caffe/util/cudnn.hpp:5:0,
from ./include/caffe/util/device_alternate.hpp:40,
from ./include/caffe/common.hpp:19,
from ./include/caffe/blob.hpp:8,
from src/caffe/test/test_im2col_layer.cpp:5:
/usr/local/cuda/include/cudnn.h:799:27: note: declared here
cudnnStatus_t CUDNNWINAPI cudnnSetPooling2dDescriptor(
^
Makefile:572: recipe for target '.build_release/src/caffe/test/test_im2col_layer.o' failed
make: *** [.build_release/src/caffe/test/test_im2col_layer.o] Error 1
I installed the newest version of cudnn(cudnn v5 library for linux) and cuda(cuda 7.5). Anyone could tell me how to solve the problem? Thanks a lot!
CuDNN v5 is incompatible with caffe. You can try making a fork and merging this: https://github.com/BVLC/caffe/pull/3919/files , but it is not officially supported.
Please note that the latest Caffe (November 8 2016) states that it supports CUDA 7+.
I still needed to fix this issue though as I was using an older branch of caffe linked to a faster-rcnn github repo. I was upgrading it to support CUDNN 5 and CUDA 8. Please note that I am not a Caffe expert, however all the tests ran successfully after I'd gotten it to compile successfully.
For the methods whose signatures appear to have changed, I found there are also _v3 and _v4 equivalents (for me I took a look in /usr/local/cuda/include/cudnn.h). I changed the method that was failing
FROM:
CUDNN_CHECK(cudnnSetPooling2dDescriptor(*pool_desc, *mode, h, w,
TO:
CUDNN_CHECK(cudnnSetPooling2dDescriptor_v3(*pool_desc, *mode, h, w,
4. src/caffe/layers/cudnn_conv_layer.cu
I needed to do similar things in the following files:
src/caffe/layers/cudnn_sigmoid_layer.cu
src/caffe/layers/cudnn_relu_layer.cu
src/caffe/layers/cudnn_conv_layer.cu
src/caffe/layers/cudnn_tanh_layer.cu
Hope that helps for you too!
try make clean --> make all --> make test --> make runtest. if you have a permission error use sudo.

Jasper string functions method undefined error

Using Jasper Reports 5.6.1. Added some text functions to a previously working text field jrxml (just want to truncate if longer than 75 chars). Works in iReport Studio, but not in Java.
<textFieldExpression><![CDATA[IF(LEN($F{AccountName})<75,$F{AccountName},LEFT($F{AccountName},75)+"...")]]></textFieldExpression>
Error message:
Error occured while trying to fetch the HTML Output from the Jasper Service (Errors were encountered when compiling report expressions class file:
1. The method LEN(String) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<->
2. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<-->
3. The method LEN(String) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getOldValue()))<75,((java.lang.String)field_AccountName.getOldValue()),LEFT(((java.lang.String)field_AccountName.getOldValue()),75)+"..."); //$JR_EXPR_ID=9$
<->
4. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getOldValue()))<75,((java.lang.String)field_AccountName.getOldValue()),LEFT(((java.lang.String)field_AccountName.getOldValue()),75)+"..."); //$JR_EXPR_ID=9$
<-->
5. The method LEN(String) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<->
6. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<-->
6 errors
)
I checked packages in jasperreports-5.6.1.jar file, includes functions package. Exhaustive web search turned up nothing. What could it be?
I have a similar error message. Where you able to resolve this? Works fine in Jaspersoft Studio 6.0.1, but throws this when compiling w/ Java:
The method IF(boolean, BigDecimal, BigDecimal) is undefined for the type Blank_A4_1_1423164610392_674232
Update: I was able to solve this by including the functions jar on my classpath. See that if that works for you. See jasperreports-functions-5.6.1.jar at http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%205.6.1/
When using GlassFish, verify that you have all jasper libraries on your production server. They should be under glassfish/domains/domain1/lib/ext. If the jars are not there (or some of them, such as the fonts or some other not non-requisite lib) you might experience the behavior you are describing.

#cython.wraparound(False) cast integer CORE GENERATED Error

In cython when my code is compiled with
#cython.wraparound(True)
and I use the following cast function to convert (cast) a float to an integer
cdef DTYPE_t_I float_int(np.float_t val):
return <DTYPE_t_I>val
it runs ok
BUT
when I turn off
#cython.wraparound(False)
the code compiles normally and when it runs it gives the following error
CORE GENERATED
It happens compiling in linux with gcc and windows with MGS
What is wrong? Should it be like this?
Because I am trying to gain speed, I would like to know to switch off these flag.