Changeset 1178


Ignore:
Timestamp:
04/26/22 00:56:33 (3 years ago)
Author:
Maciej Komosinski
Message:

Windows and python 3.9.5+ compatibility: endless nuances/bugs in dll access

File:
1 edited

Legend:

Unmodified
Added
Removed
  • framspy/frams.py

    r1167 r1178  
    156156                return c_api.extPropCount(self.__ptr)
    157157
    158         def _propId(self,i):
    159                 return ExtValue._stringFromC(c_api.extPropId(self.__ptr,i))
    160 
    161         def _propName(self,i):
    162                 return ExtValue._stringFromC(c_api.extPropName(self.__ptr,i))
    163 
    164         def _propType(self,i):
    165                 return ExtValue._stringFromC(c_api.extPropType(self.__ptr,i))
    166 
    167         def _propHelp(self,i):
    168                 h=c_api.extPropHelp(self.__ptr,i) #unlike other string fields, help is sometimes NULL
    169                 return ExtValue._stringFromC(h) if h!=None else '';
    170 
    171         def _propFlags(self,i):
    172                 return c_api.extPropFlags(self.__ptr,i)
    173 
    174         def _propGroup(self,i):
    175                 return c_api.extPropGroup(self.__ptr,i)
     158
     159        def _propId(self, i):
     160                return ExtValue._stringFromC(c_api.extPropId(self.__ptr, i))
     161
     162
     163        def _propName(self, i):
     164                return ExtValue._stringFromC(c_api.extPropName(self.__ptr, i))
     165
     166
     167        def _propType(self, i):
     168                return ExtValue._stringFromC(c_api.extPropType(self.__ptr, i))
     169
     170
     171        def _propHelp(self, i):
     172                h = c_api.extPropHelp(self.__ptr, i)  # unlike other string fields, help is sometimes NULL
     173                return ExtValue._stringFromC(h) if h != None else '';
     174
     175
     176        def _propFlags(self, i):
     177                return c_api.extPropFlags(self.__ptr, i)
     178
     179
     180        def _propGroup(self, i):
     181                return c_api.extPropGroup(self.__ptr, i)
     182
    176183
    177184        def _groupCount(self):
    178185                return c_api.extGroupCount(self.__ptr)
    179186
    180         def _groupName(self,i):
    181                 return ExtValue._stringFromC(c_api.extGroupName(self.__ptr,i))
    182 
    183         def _groupMember(self,g,i):
    184                 return c_api.extGroupMember(self.__ptr,g,i)
    185 
    186         def _memberCount(self,g):
    187                 return c_api.extMemberCount(self.__ptr,g)
     187
     188        def _groupName(self, i):
     189                return ExtValue._stringFromC(c_api.extGroupName(self.__ptr, i))
     190
     191
     192        def _groupMember(self, g, i):
     193                return c_api.extGroupMember(self.__ptr, g, i)
     194
     195
     196        def _memberCount(self, g):
     197                return c_api.extMemberCount(self.__ptr, g)
     198
    188199
    189200        def __str__(self):
     
    329340        abs_data = os.path.join(os.path.abspath(lib_path), "data")  # use absolute path for -d and -D so python is free to cd anywhere without confusing Framsticks
    330341
    331 
    332342        # for the hypothetical case without lib_path the abs_data must be obtained from somewhere else
    333343        if frams_d is None:
     
    340350
    341351        global c_api  # access global variable
    342         if lib_path is not None and os.name == 'posix':
     352        if lib_path is not None:  # theoretically, this should only be needed for "and os.name == 'posix'", but in windows python 3.9.5, without using the full lib_name path, there is FileNotFoundError: Could not find module 'frams-objects.dll' (or one of its dependencies). Try using the full path with constructor syntax. Maybe related: https://bugs.python.org/issue42114 and https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python and https://bugs.python.org/issue39393
    343353                lib_name = os.path.join(lib_path, lib_name)  # lib_path is always set ('.' when not specified). For the (currently unused) case of lib_path==None, the resulting lib_name is a bare filename without any path, which loads the library from a system-configured location.
    344354        try:
Note: See TracChangeset for help on using the changeset viewer.