slice2py --no-package problem

mmarquarmmarquar Member Malte MarquardingOrganization: CSIROProject: Australian SKA Pathfinder software development
The following code worked under ice 3.3 but under 3.4 fails with an ImportError. According to the manual thsi should still work.
ImportError: No module named example
cat example.ice
module example
{
    enum Useful
    {
       A,
       B,
       C
    };
};
slice2py --no-package example.ice

cat test.py
import Ice
import example_ice
import example

python test.py

I have tested this under both linux and OS X. Is anyone else seeing the same problem?!

Comments

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

    We did make some changes in Ice 3.4 to address the issue reported here that would cause the behavior you are seeing.

    You can solve this by creating example.py that contains the following:
    # example.py
    import example_ice
    
    Another option is to call the undocumented function Ice.updateModules:
    # test.py
    import Ice
    import example_ice
    Ice.updateModules()
    import example
    
    Of course, there's the usual caveat that a subsequent Ice release can break applications that use undocumented APIs.

    Regards,
    Mark
  • mmarquarmmarquar Member Malte MarquardingOrganization: CSIROProject: Australian SKA Pathfinder software development
    Could you update the slice2py documentation accordingly please.
    The existing documentation hasn't been updated to reflect the changed behaviour.
    It should probably go into the changelog as well as it breaks 3.3 code.
  • mmarquarmmarquar Member Malte MarquardingOrganization: CSIROProject: Australian SKA Pathfinder software development
    I don't quite understand how the first example would work any different to the way it is broken now.
    I have nested modules and do the following at the moment as part of a python module which contains the generated _ice.py files.
    from . import MyInterfaces_ice
    import a.b.c
    from a.b.c import ExampleInterface
    ...
    
Sign In or Register to comment.