Home Help Center

ValueError: invalid value for argument

dmitry.medvedevdmitry.medvedev Member Dmitry N. MedvedevOrganization: PersonalProject: Casual Game Analytics Dashboard ✭✭
Hi!

Recently I have decided to start writing tests in Python instead of C++, though my services are written in C++.

To cut it short: I do always get the "ValueError: invalid value for argument 1 in operation `AddUser'" exception when trying to run my test.

The faulting ( slice definition ) function is:
int AddUser(User objUser, out long lUserId) ;

The faulting python code is:
nError, lPlayerUserId = secrt.AddUser(objUser)

I am suspecting myself in not clearly understanding how out parameters should be handled by python code.

Please, could you look into the files attached and provide a hint on what I do wrong.

----
With best regards,
Dmitry

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Dmitry,

    This line is the problem:
    objUser = Secrt.User
    

    This does not allocate an instance of Secrt.User, but actually assigns a reference to the Secrt.User class. Here is how you should be allocating the instance:
    objUser = Secrt.User()
    

    Regards,
    Mark
  • dmitry.medvedevdmitry.medvedev Member Dmitry N. MedvedevOrganization: PersonalProject: Casual Game Analytics Dashboard ✭✭
    mes wrote: »
    Hi Dmitry,

    This line is the problem:
    objUser = Secrt.User
    

    This does not allocate an instance of Secrt.User, but actually assigns a reference to the Secrt.User class. Here is how you should be allocating the instance:
    objUser = Secrt.User()
    

    Regards,
    Mark

    Yes, sir! That was the problem. Dumb me :(
Sign In or Register to comment.