0rr Posted January 15, 2010 Share Posted January 15, 2010 Hi, I hope someone can help me on this. As far as I know all floats in python are 64-bit. How can I convert a 64Bit float to a 32Bit float in python? Quote Link to comment Share on other sites More sharing options...
symek Posted January 15, 2010 Share Posted January 15, 2010 Hi, I hope someone can help me on this. As far as I know all floats in python are 64-bit. How can I convert a 64Bit float to a 32Bit float in python? afaik you can create and pass through C types in python using ctypes module, ctypes.c_float for examples, but as I understand using *.value will convert it back to native python type (?) Quote Link to comment Share on other sites More sharing options...
0rr Posted January 16, 2010 Author Share Posted January 16, 2010 Thanks for your help. But I can't import the ctypes module. I get an error: line 10, in <module> from _ctypes import Union, Structure, Array ImportError: No module named _ctypes Importing any module works. Maybe I should try numpy instead? Quote Link to comment Share on other sites More sharing options...
symek Posted January 16, 2010 Share Posted January 16, 2010 What system? Python interpreter version? Ctypes is a standard module from python 2.5. Are you calling it from within Houdini? It's possible that it's not included in Houdini's python distribution on Windows, Can't check it now. On Linux it works though. If there is no such module for you, you can install it manually, Quote Link to comment Share on other sites More sharing options...
0rr Posted January 16, 2010 Author Share Posted January 16, 2010 Thanks again, I am working with windows7 64bit. I am using the standart python interpreter that came with Houdini that is version 2.5.2. The ctypes moudle is in the houdini python/lib folder and already came with houdini. Using the standart python shell I don't get such an error and everythings working. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.