From issworld2000 at yahoo.com Mon Nov 7 16:25:20 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Mon, 7 Nov 2016 21:25:20 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> Message-ID: <1592490551.13807.1478553920333@mail.yahoo.com> Hello, I have an issue. I am using ironpython 2.7 editor called through?Rhino 5 application, and I load a single .dll file from an application called?MapWinGIS. Like so: dll_filePath = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath)import MapWinGIS The problem is that I can only call a particular method once. If try to do that the second time, the same method returns "False". When method works correctly (the first time) it return: "True". The problem goes away if I restart the Rhino 5 application (and ironpython 2.7 editor along with it). Why is this happening? I contacted the developers of upper mentioned MapWinGIS application, and they said that they can not replicate this behavior and that I should ask this question on ironpython mailing list. They suggested that I need to somehow "free the memory before you do the second run of the method". So to make my problem more clear, this is what happens: If run a script containing the this particular method twice, the first call of the method returns "True", the second one "False": variable1a = "something1a"variable1b = "something1b"returnedValue1 =MapWinGIS.someClass.someMethod1(variable1a, variable1b)? # returns "True"?variable2a = "something2a"variable2b = "something2b"returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a,variable2b)? #returns "False" If run the same script again, both upper calls of MapWinGIS.someClass.someMethod1 method return "False". If I restart my Rhino 5 application, then again the same thing happens: "True" is returned on first MapWinGIS.someClass.someMethod1 call, while "False" is returned on the second call. If run the script again, then they both return "False". For every other run of the script, I get "False" on both calls. And this continues until I restart Rhino 5. I perfectly understand that it is impossible for anyone from Ironpython mailing list to know the exact cause of this problem. But can you at least help me with "free the memory before you do the second run of the method" part? I tried deleting all the variables after the first call, calling the garbage collector and also removing the .dll file from the list of loaded assemblies. Like this: import clrimport gc?dll_filePath = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath)import MapWinGIS?variable1a = "something1a"variable1b = "something1b"returnedValue1 =MapWinGIS.someClass.someMethod1(variable1a, variable1b)? # returns "True"?# delete all variablesdel dll_filePath; del variable1a; del variable1b; del returnedValue1; del MapWinGIS?# remove the .dll from the listof assembliesfor i,assembly in enumerate(clr.References):??? if assembly.GetName().Name == "Interop.MapWinGIS":??????? clr.References.RemoveAt(i)??????? break?# collect garbagegc.collect()???dll_filePath2 = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath2)import MapWinGIS?variable2a = "something2a"variable2b = "something2b"returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a,variable2b)? #returns "False" But it is not working (I still get the "True" on first method call, and "False" on second). I also tried to exchange the variable1a and variable1b with variable2a and variable2b. Or even use the same variables in both MapWinGIS.someClass.someMethod1 calls. Still, no improvement. The MapWinGIS.someClass.someMethod1 that I am calling is actually:?MapWinGIS.UtilsClass.OGR2OGR. I named it MapWinGIS.someClass.someMethod1 to make it easier for others to follow the code. Not sure if this was good idea. If it wasn't I apologize. This issue is driving me crazy. I would be very grateful for any kind of advice. Thank you in advance! Kind regards, Djordje Spasic -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at mcneel.com Tue Nov 8 19:50:53 2016 From: steve at mcneel.com (Steve Baer) Date: Tue, 8 Nov 2016 16:50:53 -0800 Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <1592490551.13807.1478553920333@mail.yahoo.com> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> Message-ID: Do they have a sample in C# for how you should use their SDK? That may help us figure out if something should be done differently in IronPython. -Steve Steve Baer Robert McNeel & Associates www.rhino3d.com On Mon, Nov 7, 2016 at 1:25 PM, Djordje Spasic via Ironpython-users < ironpython-users at python.org> wrote: > Hello, > > I have an issue. I am using ironpython 2.7 editor called through Rhino 5 > application, and I load a single .dll file > from an application called MapWinGIS > . Like so: > > dll_filePath = "C:\Program Files\MapWinGIS\Interop.MapWinGIS.dll" > clr.*AddReferenceToFileAndPath*(dll_filePath) > *import *MapWinGIS > > The problem is that I can only call a particular method *once*. > If try to do that the second time, the same method returns "False". When > method works correctly (the first time) it return: "True". > > The problem goes away if I restart the Rhino 5 application (and ironpython > 2.7 editor along with it). > > > Why is this happening? I contacted the developers of upper mentioned > MapWinGIS application, and they said that they can not replicate this > behavior and that I should ask this question on ironpython mailing list. > They suggested that I need to somehow *"free the memory before you do the > second run of the method"*. > > So to make my problem more clear, this is what happens: > > If run a script containing the this particular method twice, the first > call of the method returns "True", the second one "False": > > variable1a = "something1a" > variable1b = "something1b" > returnedValue1 = MapWinGIS.someClass.*someMethod1*(variable1a, variable1b) > # returns "True" > > variable2a = "something2a" > variable2b = "something2b" > returnedValue2 = MapWinGIS.someClass.*someMethod1*(variable2a, variable2b) > # returns "False" > > If run the same script again, both upper calls of MapWinGIS.someClass.someMethod1 > method return "False". > If I restart my Rhino 5 application, then again the same thing happens: > "True" is returned on first MapWinGIS.someClass.someMethod1 call, while > "False" is returned on the second call. If run the script again, then they > both return "False". For every other run of the script, I get "False" on > both calls. And this continues until I restart Rhino 5. > > I perfectly understand that it is impossible for anyone from Ironpython > mailing list to know the exact cause of this problem. > > But can you at least help me with *"free the memory before you do the > second run of the method"* part? > > I tried deleting all the variables after the first call, calling the > garbage collector and also removing the .dll file from the list of loaded > assemblies. Like this: > > *import *clr > *import *gc > > dll_filePath = "C:\Program Files\MapWinGIS\Interop.MapWinGIS.dll" > clr.*AddReferenceToFileAndPath*(dll_filePath) > *import *MapWinGIS > > variable1a = "something1a" > variable1b = "something1b" > returnedValue1 = MapWinGIS.someClass.*someMethod1*(variable1a, variable1b) > # returns "True" > > # delete all variables > *del *dll_filePath; *del *variable1a; *del *variable1b; *del *returnedValue1; > *del *MapWinGIS > > # remove the .dll from the list of assemblies > *for *i,assembly *in **enumerate*(clr.References): > *if *assembly.*GetName*().Name == "Interop.MapWinGIS": > clr.References.*RemoveAt*(i) > break > > # collect garbage > gc.*collect*() > > > > dll_filePath2 = "C:\Program Files\MapWinGIS\Interop.MapWinGIS.dll" > clr.*AddReferenceToFileAndPath*(dll_filePath2) > *import *MapWinGIS > > variable2a = "something2a" > variable2b = "something2b" > returnedValue2 = MapWinGIS.someClass.*someMethod1*(variable2a, variable2b) > # returns "False" > > > But it is not working (I still get the "True" on first method call, and > "False" on second). > I also tried to exchange the *variable1a* and *variable1b* with > *variable2a* and *variable2b*. Or even use the same variables in both > MapWinGIS.someClass.someMethod1 calls. Still, no improvement. > > The MapWinGIS.someClass.someMethod1 that I am calling is actually: > MapWinGIS.UtilsClass.OGR2OGR > > . > I named it MapWinGIS.someClass.someMethod1 to make it easier for others > to follow the code. Not sure if this was good idea. If it wasn't I > apologize. > > > This issue is driving me crazy. I would be very grateful for any kind of > advice. > Thank you in advance! > > > Kind regards, > Djordje Spasic > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From issworld2000 at yahoo.com Wed Nov 9 20:16:44 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Thu, 10 Nov 2016 01:16:44 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> Message-ID: <181079335.931594.1478740604880@mail.yahoo.com> Hi Steve, Thank you for the reply. This is the C# code sent to me by one of the developers. He calls the OGR2OGR method only once per script, but when he tries to call the script again, it works with no problem. Which is not the case on my PC: GlobalSettings settings = new GlobalSettings();settings.ResetGdalError();UtilsClass utils = new MapWinGIS.UtilsClass();string options = "--configCONFIG_FILE \"C:\\Program Files\\MapWindow GIS Lite\\MapWinGIS\\gdal-data\\osmconf.ini\"--config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f \"ESRIShapefile\"";bool result = utils.OGR2OGR(@"C:\rome.osm", @"C:\rome_sph_files", options);if (!result){??? // Both line should be the same:??? Debug.WriteLine(utils.ErrorMsgFromObject(utils));???Debug.WriteLine(utils.ErrorMsg[utils.LastErrorCode]);??? Debug.WriteLine(settings.GdalLastErrorMsg);}?if (!result) return; He also assigns the path to the osmconf.ini file, but that does not make my problem go away, when I try to do the same. Below is the ironpython code that I use. I call the OGR2OGR method twice in that script, instead of once: import clr?iteropMapWinGIS_dll_filePath = "C:\\ProgramFiles\\MapWindow GIS Lite\\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(iteropMapWinGIS_dll_filePath)import MapWinGIS??utils = MapWinGIS.UtilsClass()osm_filePath = "C:\\rome.osm"shps_filePath = "C:\\rome_sph_files"bstrOptions = '--configOSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"'convertToShapefiles_Result =MapWinGIS.UtilsClass.OGR2OGR(utils, osm_filePath, shps_filePath, bstrOptions, None)if convertToShapefiles_Result== False:??? print "MapWinGIS.UtilsClass.OGR2OGRfailed the first time"???print utils.ErrorMsg??? print utils.LastErrorCode??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorNo??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorMsg??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorTypeelse:??? print "MapWinGIS.UtilsClass.OGR2OGRsuccessfully ran the first time"???print "------------"iteropMapWinGIS_dll_filePath2 = "C:\\ProgramFiles\\MapWindow GIS Lite\\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(iteropMapWinGIS_dll_filePath2)import MapWinGIS?utils2 = MapWinGIS.UtilsClass()osm_filePath2 = "C:\\athens.osm"shps_filePath2 = "C:\\athens_sph_files"bstrOptions2 = '--configOSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"'convertToShapefiles_Result2 =MapWinGIS.UtilsClass.OGR2OGR(utils2, osm_filePath2, shps_filePath2,bstrOptions2, None)if convertToShapefiles_Result2== False:??? print "MapWinGIS.UtilsClass.OGR2OGRfailed the second time"???print utils2.ErrorMsg??? print utils2.LastErrorCode??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorNo??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorMsg??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorTypeelse:??? print"MapWinGIS.UtilsClass.OGR2OGR successfully ran the secondtime" The mentioned Map Window GIS application can be downloaded from here (version MapWindow Lite Win32 1.0.5.0): https://mapwindow4.codeplex.com/releases/view/542097 I attached the upper mentioned "rome.osm" and "athens.osm" files along with .py file in here:https://www.dropbox.com/s/2jq1a248jupdfzq/osm_files_plus_ironpythonOGR2OGR.zip?dl=0 The OGR2OGR method essentially converts the .osm files to .shp file format. Thank you in advance for taking a look. I would welcome any kind of advice !! Kind regards, Djordje Spasic -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Wed Nov 9 20:54:24 2016 From: slide.o.mix at gmail.com (Slide) Date: Thu, 10 Nov 2016 01:54:24 +0000 Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <181079335.931594.1478740604880@mail.yahoo.com> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <181079335.931594.1478740604880@mail.yahoo.com> Message-ID: Your python code is different from what the C# code does: utils = MapWinGIS.*UtilsClass*() osm_filePath = "C:\\rome.osm" shps_filePath = "C:\\rome_sph_files" bstrOptions = '--config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"' convertToShapefiles_Result = MapWinGIS.UtilsClass.*OGR2OGR*(utils, osm_filePath, shps_filePath, bstrOptions, *None*) <------ that line should probably be: convertToShapefiles_Result = *utils*.*OGR2OGR*(utils, osm_filePath, shps_filePath, bstrOptions, *None*) On Wed, Nov 9, 2016 at 6:23 PM Djordje Spasic via Ironpython-users < ironpython-users at python.org> wrote: > Hi Steve, > > Thank you for the reply. > > This is the C# code sent to me by one of the developers. He calls the > OGR2OGR method only once per script, but when he tries to call the script > again, it works with no problem. Which is not the case on my PC: > > GlobalSettings settings = new *GlobalSettings*(); > settings.*ResetGdalError*(); > UtilsClass utils = new MapWinGIS.*UtilsClass*(); > string options = "--config CONFIG_FILE \"C:\\Program Files\\MapWindow GIS > Lite\\MapWinGIS\\gdal-data\\osmconf.ini\" --config OSM_USE_CUSTOM_INDEXING > NO -skipfailures -f \"ESRI Shapefile\""; > bool result = utils.*OGR2OGR*(@"C:\rome.osm", @"C:\rome_sph_files", > options); > *if *(!result) > { > // Both line should be the same: > Debug.*WriteLine*(utils.*ErrorMsgFromObject*(utils)); > Debug.*WriteLine*(utils.ErrorMsg[utils.LastErrorCode]); > Debug.*WriteLine*(settings.GdalLastErrorMsg); > } > > *if *(!result) return; > > > He also assigns the path to the osmconf.ini file, but that does not make > my problem go away, when I try to do the same. > > Below is the ironpython code that I use. I call the OGR2OGR method twice > in that script, instead of once: > > *import *clr > > iteropMapWinGIS_dll_filePath = "C:\\Program Files\\MapWindow GIS > Lite\\Interop.MapWinGIS.dll" > clr.*AddReferenceToFileAndPath*(iteropMapWinGIS_dll_filePath) > *import *MapWinGIS > > > utils = MapWinGIS.*UtilsClass*() > osm_filePath = "C:\\rome.osm" > shps_filePath = "C:\\rome_sph_files" > bstrOptions = '--config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI > Shapefile"' > convertToShapefiles_Result = MapWinGIS.UtilsClass.*OGR2OGR*(utils, > osm_filePath, shps_filePath, bstrOptions, *None*) > *if *convertToShapefiles_Result == *False*: > *print *"MapWinGIS.UtilsClass.OGR2OGR failed the first time" > *print *utils.ErrorMsg > *print *utils.LastErrorCode > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorNo > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorMsg > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorType > *else*: > *print *"MapWinGIS.UtilsClass.OGR2OGR successfully ran the first time" > > > > *print *"------------" > iteropMapWinGIS_dll_filePath2 = "C:\\Program Files\\MapWindow GIS > Lite\\Interop.MapWinGIS.dll" > clr.*AddReferenceToFileAndPath*(iteropMapWinGIS_dll_filePath2) > *import *MapWinGIS > > utils2 = MapWinGIS.*UtilsClass*() > osm_filePath2 = "C:\\athens.osm" > shps_filePath2 = "C:\\athens_sph_files" > bstrOptions2 = '--config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f > "ESRI Shapefile"' > convertToShapefiles_Result2 = MapWinGIS.UtilsClass.*OGR2OGR*(utils2, > osm_filePath2, shps_filePath2, bstrOptions2, *None*) > *if *convertToShapefiles_Result2 == *False*: > *print *"MapWinGIS.UtilsClass.OGR2OGR failed the second time" > *print *utils2.ErrorMsg > *print *utils2.LastErrorCode > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorNo > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorMsg > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorType > *else*: > *print *"MapWinGIS.UtilsClass.OGR2OGR successfully ran the second > time" > > > The mentioned Map Window GIS application can be downloaded from here > (version MapWindow Lite Win32 1.0.5.0): > https://mapwindow4.codeplex.com/releases/view/542097 > > I attached the upper mentioned "rome.osm" and "athens.osm" files along > with .py file in here: > > https://www.dropbox.com/s/2jq1a248jupdfzq/osm_files_plus_ironpythonOGR2OGR.zip?dl=0 > > The OGR2OGR method essentially converts the .osm files to .shp file format. > > Thank you in advance for taking a look. > > I would welcome any kind of advice !! > > Kind regards, > Djordje Spasic > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From issworld2000 at yahoo.com Thu Nov 10 05:33:59 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Thu, 10 Nov 2016 10:33:59 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <181079335.931594.1478740604880@mail.yahoo.com> Message-ID: <69932048.1181043.1478774039545@mail.yahoo.com> Hi Alex, Thank you for the reply. If try to instantiate the MapWinGIS.Utils class, I get the following error message: Cannot create instances of Utils because it is abstract I get the same error message for any MapWinGIS class. If I add "Class" to its name, then everything works fine (like: MapWinGIS.UtilsClass) Here is how the MapWinGIS.Utils class looks like when I decompile the "Interop.MapWinGIS.dll": https://www.dropbox.com/s/vvk14cr2alglutd/utilsClass_preview.jpg?dl=0 It's virtually empty while "UtilsClass" has all the methods that "Utils" should have when one takes a look at their?online API documentation. Up until now, I've called more than 10 classes from "Interop.MapWinGIS.dll" and their methods. And I always added the "Class" to the class name. It worked without problem. So I do not think this is the problem. Something else seems to be causing it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Thu Nov 10 07:34:55 2016 From: slide.o.mix at gmail.com (Slide) Date: Thu, 10 Nov 2016 12:34:55 +0000 Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <69932048.1181043.1478774039545@mail.yahoo.com> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <181079335.931594.1478740604880@mail.yahoo.com> <69932048.1181043.1478774039545@mail.yahoo.com> Message-ID: That's not what I was talking about. You are calling the method like a static method by using the class name. Yiuve already created an instance above called "utils". On Thu, Nov 10, 2016, 03:37 Djordje Spasic wrote: > Hi Alex, > > > Thank you for the reply. > > If try to instantiate the MapWinGIS.Utils class, I get the following error > message: > > Cannot create instances of Utils because it is abstract > > I get the same error message for any MapWinGIS class. > If I add "Class" to its name, then everything works fine (like: > MapWinGIS.UtilsClass) > > Here is how the MapWinGIS.Utils class looks like when I decompile the > "Interop.MapWinGIS.dll": > https://www.dropbox.com/s/vvk14cr2alglutd/utilsClass_preview.jpg?dl=0 > > It's virtually empty while "UtilsClass" has all the methods that "Utils" > should have when one takes a look at their online API documentation > . > > Up until now, I've called more than 10 classes from > "Interop.MapWinGIS.dll" and their methods. And I always added the "Class" > to the class name. It worked without problem. > > So I do not think this is the problem. > Something else seems to be causing it. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From issworld2000 at yahoo.com Thu Nov 10 07:59:22 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Thu, 10 Nov 2016 12:59:22 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <181079335.931594.1478740604880@mail.yahoo.com> <69932048.1181043.1478774039545@mail.yahoo.com> Message-ID: <936160805.1236314.1478782762412@mail.yahoo.com> Thank you for the reply Alex, I apologize for misunderstanding you. If I try to call the OGR2OGR method like that: convertToShapefiles_Result = utils.OGR2OGR(utils, osm_filePath, shps_filePath, bstrOptions,?None)? Then I get an error message: Could not convert argument 0 for call to OGR2OGR I posted a question about this on this very mailing list earlier this year. St?phane Lozier suggested that I should instead use: convertToShapefiles_Result = MapWinGIS.UtilsClass.OGR2OGR(utils, osm_filePath, shps_filePath, bstrOptions,?None)? And it worked perfectly. Since then, I am calling all MapWinGIS methods which require opening of some sort of a file like this. And they work with no problem. Otherwise I always get an error message: Could not convert argument 0 for call to "name of the method" -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Thu Nov 10 08:24:01 2016 From: slide.o.mix at gmail.com (Slide) Date: Thu, 10 Nov 2016 13:24:01 +0000 Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <936160805.1236314.1478782762412@mail.yahoo.com> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <181079335.931594.1478740604880@mail.yahoo.com> <69932048.1181043.1478774039545@mail.yahoo.com> <936160805.1236314.1478782762412@mail.yahoo.com> Message-ID: Oh, I missed the utils being passed in, that's roughly the same thing. If you use just "utils" you would want to remove it from the parameter list of the call. On Thu, Nov 10, 2016 at 6:02 AM Djordje Spasic wrote: > Thank you for the reply Alex, > > I apologize for misunderstanding you. > > If I try to call the OGR2OGR method like that: > > convertToShapefiles_Result = *utils*.*OGR2OGR*(utils, osm_filePath, > shps_filePath, bstrOptions, *None*) > > Then I get an error message: > > Could not convert argument 0 for call to OGR2OGR > > I posted a question about this on this very mailing list earlier this > year. St?phane Lozier suggested that I should instead use: > > convertToShapefiles_Result = MapWinGIS.UtilsClass.*OGR2OGR*(*utils*, > osm_filePath, shps_filePath, bstrOptions, *None*) > > And it worked perfectly. Since then, I am calling all MapWinGIS methods > which require opening of some sort of a file like this. And they work with > no problem. > Otherwise I always get an error message: > > Could not convert argument 0 for call to "name of the method" > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From issworld2000 at yahoo.com Thu Nov 10 08:27:51 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Thu, 10 Nov 2016 13:27:51 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <181079335.931594.1478740604880@mail.yahoo.com> <69932048.1181043.1478774039545@mail.yahoo.com> <936160805.1236314.1478782762412@mail.yahoo.com> Message-ID: <1628564664.1231641.1478784471134@mail.yahoo.com> Yes, that's what I did. But I forgot to remove the "utils" from the list of arguments, when I wrote it. I just copied your code. Sorry about that. So this call: convertToShapefiles_Result = utils.OGR2OGR(osm_filePath, shps_filePath, bstrOptions,?None)? raises this error: Could not convert argument 0 for call to OGR2OGR -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at agraham.demon.co.uk Mon Nov 14 05:51:12 2016 From: andy at agraham.demon.co.uk (Andrew Graham) Date: Mon, 14 Nov 2016 10:51:12 +0000 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: References: Message-ID: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> Is it just me? The link to Gitter-Chat on the IronLanguages/main page at https://github.com/IronLanguages/main Shows a link at the bottom to Gitter-Chat https://gitter.im/IronLanguages That leads to a blank page with no rooms. Regards to all and grateful thanks to the few for resuscitating IronPython Andy graham -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephane.lozier at gmail.com Mon Nov 14 20:27:52 2016 From: stephane.lozier at gmail.com (=?UTF-8?Q?St=C3=A9phane_Lozier?=) Date: Mon, 14 Nov 2016 20:27:52 -0500 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> References: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> Message-ID: The gitter chat moved from https://gitter.im/IronLanguages/main to https://gitter.im/IronLanguages because we wanted it to be a room that covers all the projects (ipy2, ipy3 and dlr). However, I wonder if the new room is restricted to organization members only? It may explain why you're not able to log in... On Mon, Nov 14, 2016 at 5:51 AM, Andrew Graham wrote: > Is it just me? The link to Gitter-Chat on the IronLanguages/main page at > > https://github.com/IronLanguages/main > > > Shows a link at the bottom to Gitter-Chat > > https://gitter.im/IronLanguages > > > That leads to a blank page with no rooms. > > > Regards to all and grateful thanks to the few for resuscitating IronPython > > Andy graham > > > > > > > > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aiguyaiguy at outlook.com Mon Nov 14 22:19:06 2016 From: aiguyaiguy at outlook.com (Gary Miller) Date: Tue, 15 Nov 2016 03:19:06 +0000 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> References: , <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> Message-ID: I see exactly the same thing! Do our names need to be re-registered someplace? ________________________________ From: Ironpython-users on behalf of Andrew Graham Sent: Monday, November 14, 2016 5:51 AM To: ironpython-users at python.org Subject: [Ironpython-users] Gitter-chat? Is it just me? The link to Gitter-Chat on the IronLanguages/main page at https://github.com/IronLanguages/main [https://avatars2.githubusercontent.com/u/18199?v=3&s=400] IronLanguages - GitHub github.com IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. IronPython can use the .NET ... Shows a link at the bottom to Gitter-Chat https://gitter.im/IronLanguages That leads to a blank page with no rooms. Regards to all and grateful thanks to the few for resuscitating IronPython Andy graham -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Tue Nov 15 08:24:34 2016 From: slide.o.mix at gmail.com (Slide) Date: Tue, 15 Nov 2016 13:24:34 +0000 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: References: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> Message-ID: I tried changing some of the settings for Gitter, please see if you can enter the room now. If not, we will create a new room for everyone. Sorry for the inconvenience! On Tue, Nov 15, 2016 at 6:07 AM Gary Miller wrote: > I see exactly the same thing! > > > Do our names need to be re-registered someplace? > > > ------------------------------ > *From:* Ironpython-users roadrunner.com at python.org> on behalf of Andrew Graham < > andy at agraham.demon.co.uk> > *Sent:* Monday, November 14, 2016 5:51 AM > *To:* ironpython-users at python.org > *Subject:* [Ironpython-users] Gitter-chat? > > Is it just me? The link to Gitter-Chat on the IronLanguages/main page at > > https://github.com/IronLanguages/main > > IronLanguages - GitHub > github.com > IronPython is an open-source implementation of the Python programming > language which is tightly integrated with the .NET Framework. IronPython > can use the .NET ... > > > Shows a link at the bottom to Gitter-Chat > > https://gitter.im/IronLanguages > > > That leads to a blank page with no rooms. > > > Regards to all and grateful thanks to the few for resuscitating IronPython > > Andy graham > > > > > > > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at agraham.demon.co.uk Tue Nov 15 08:28:18 2016 From: andy at agraham.demon.co.uk (Andrew Graham) Date: Tue, 15 Nov 2016 13:28:18 +0000 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: References: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> Message-ID: <01D65D19D814431085D69805649A982A@AndyDesktop> Sorry, nope! Same blank page I posted earlier with zero rooms and zero people available. Andy Graham From: Slide Sent: Tuesday, November 15, 2016 1:24 PM To: Gary Miller ; Andrew Graham ; ironpython-users at python.org Subject: Re: [Ironpython-users] Gitter-chat? I tried changing some of the settings for Gitter, please see if you can enter the room now. If not, we will create a new room for everyone. Sorry for the inconvenience! On Tue, Nov 15, 2016 at 6:07 AM Gary Miller wrote: I see exactly the same thing! Do our names need to be re-registered someplace? ------------------------------------------------------------------------------ From: Ironpython-users on behalf of Andrew Graham Sent: Monday, November 14, 2016 5:51 AM To: ironpython-users at python.org Subject: [Ironpython-users] Gitter-chat? Is it just me? The link to Gitter-Chat on the IronLanguages/main page at https://github.com/IronLanguages/main IronLanguages - GitHub github.com IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. IronPython can use the .NET ... Shows a link at the bottom to Gitter-Chat https://gitter.im/IronLanguages That leads to a blank page with no rooms. Regards to all and grateful thanks to the few for resuscitating IronPython Andy graham _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org https://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Tue Nov 15 08:31:27 2016 From: slide.o.mix at gmail.com (Slide) Date: Tue, 15 Nov 2016 13:31:27 +0000 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: <01D65D19D814431085D69805649A982A@AndyDesktop> References: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> <01D65D19D814431085D69805649A982A@AndyDesktop> Message-ID: Can you see https://gitter.im/IronLanguages/ironpython? On Tue, Nov 15, 2016 at 6:28 AM Andrew Graham wrote: > Sorry, nope! Same blank page I posted earlier with zero rooms and zero > people available. > > Andy Graham > > *From:* Slide > *Sent:* Tuesday, November 15, 2016 1:24 PM > *To:* Gary Miller ; Andrew Graham > ; ironpython-users at python.org > *Subject:* Re: [Ironpython-users] Gitter-chat? > > I tried changing some of the settings for Gitter, please see if you can > enter the room now. If not, we will create a new room for everyone. Sorry > for the inconvenience! > > On Tue, Nov 15, 2016 at 6:07 AM Gary Miller > wrote: > > I see exactly the same thing! > > > > Do our names need to be re-registered someplace? > > > ------------------------------ > *From:* Ironpython-users roadrunner.com at python.org> on behalf of Andrew Graham < > andy at agraham.demon.co.uk> > *Sent:* Monday, November 14, 2016 5:51 AM > *To:* ironpython-users at python.org > *Subject:* [Ironpython-users] Gitter-chat? > > Is it just me? The link to Gitter-Chat on the IronLanguages/main page at > > https://github.com/IronLanguages/main > > IronLanguages - GitHub > github.com > IronPython is an open-source implementation of the Python programming > language which is tightly integrated with the .NET Framework. IronPython > can use the .NET ... > > > Shows a link at the bottom to Gitter-Chat > > https://gitter.im/IronLanguages > > > That leads to a blank page with no rooms. > > > Regards to all and grateful thanks to the few for resuscitating IronPython > > Andy graham > > > > > > > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at agraham.demon.co.uk Tue Nov 15 08:39:36 2016 From: andy at agraham.demon.co.uk (Andrew Graham) Date: Tue, 15 Nov 2016 13:39:36 +0000 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: References: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> <01D65D19D814431085D69805649A982A@AndyDesktop> Message-ID: Yup! I just joined! From: Slide Sent: Tuesday, November 15, 2016 1:31 PM To: Andrew Graham ; Gary Miller ; ironpython-users at python.org Subject: Re: [Ironpython-users] Gitter-chat? Can you see https://gitter.im/IronLanguages/ironpython? On Tue, Nov 15, 2016 at 6:28 AM Andrew Graham wrote: Sorry, nope! Same blank page I posted earlier with zero rooms and zero people available. Andy Graham From: Slide Sent: Tuesday, November 15, 2016 1:24 PM To: Gary Miller ; Andrew Graham ; ironpython-users at python.org Subject: Re: [Ironpython-users] Gitter-chat? I tried changing some of the settings for Gitter, please see if you can enter the room now. If not, we will create a new room for everyone. Sorry for the inconvenience! On Tue, Nov 15, 2016 at 6:07 AM Gary Miller wrote: I see exactly the same thing! Do our names need to be re-registered someplace? ---------------------------------------------------------------------------- From: Ironpython-users on behalf of Andrew Graham Sent: Monday, November 14, 2016 5:51 AM To: ironpython-users at python.org Subject: [Ironpython-users] Gitter-chat? Is it just me? The link to Gitter-Chat on the IronLanguages/main page at https://github.com/IronLanguages/main IronLanguages - GitHub github.com IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. IronPython can use the .NET ... Shows a link at the bottom to Gitter-Chat https://gitter.im/IronLanguages That leads to a blank page with no rooms. Regards to all and grateful thanks to the few for resuscitating IronPython Andy graham _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org https://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: wlEmoticon-smile[1].png Type: application/octet-stream Size: 1046 bytes Desc: not available URL: From slide.o.mix at gmail.com Tue Nov 15 08:44:55 2016 From: slide.o.mix at gmail.com (Slide) Date: Tue, 15 Nov 2016 13:44:55 +0000 Subject: [Ironpython-users] Gitter-chat? In-Reply-To: References: <6A48DE22DA0D4547A627B5B6B3BBB6E5@AndyDesktop> <01D65D19D814431085D69805649A982A@AndyDesktop> Message-ID: Great! Due to the privacy settings for the org level room, I created a new ironpython room that everyone should be able to join. https://gitter.im/IronLanguages/ironpython On Tue, Nov 15, 2016 at 6:39 AM Andrew Graham wrote: > Yup! [image: Smile] I just joined! > > > *From:* Slide > *Sent:* Tuesday, November 15, 2016 1:31 PM > *To:* Andrew Graham ; Gary Miller > ; ironpython-users at python.org > *Subject:* Re: [Ironpython-users] Gitter-chat? > > Can you see https://gitter.im/IronLanguages/ironpython? > > On Tue, Nov 15, 2016 at 6:28 AM Andrew Graham > wrote: > > Sorry, nope! Same blank page I posted earlier with zero rooms and zero > people available. > > Andy Graham > > *From:* Slide > *Sent:* Tuesday, November 15, 2016 1:24 PM > *To:* Gary Miller ; Andrew Graham > ; ironpython-users at python.org > *Subject:* Re: [Ironpython-users] Gitter-chat? > > I tried changing some of the settings for Gitter, please see if you can > enter the room now. If not, we will create a new room for everyone. Sorry > for the inconvenience! > > On Tue, Nov 15, 2016 at 6:07 AM Gary Miller > wrote: > > I see exactly the same thing! > > > > Do our names need to be re-registered someplace? > > > ------------------------------ > *From:* Ironpython-users roadrunner.com at python.org> on behalf of Andrew Graham < > andy at agraham.demon.co.uk> > *Sent:* Monday, November 14, 2016 5:51 AM > *To:* ironpython-users at python.org > *Subject:* [Ironpython-users] Gitter-chat? > > Is it just me? The link to Gitter-Chat on the IronLanguages/main page at > > https://github.com/IronLanguages/main > > IronLanguages - GitHub > github.com > IronPython is an open-source implementation of the Python programming > language which is tightly integrated with the .NET Framework. IronPython > can use the .NET ... > > > Shows a link at the bottom to Gitter-Chat > > https://gitter.im/IronLanguages > > > That leads to a blank page with no rooms. > > > Regards to all and grateful thanks to the few for resuscitating IronPython > > Andy graham > > > > > > > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: wlEmoticon-smile[1].png Type: image/png Size: 1046 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: wlEmoticon-smile[1].png Type: image/png Size: 1046 bytes Desc: not available URL: From slide.o.mix at gmail.com Wed Nov 23 08:05:27 2016 From: slide.o.mix at gmail.com (Slide) Date: Wed, 23 Nov 2016 13:05:27 +0000 Subject: [Ironpython-users] Gitter Message-ID: Just to make sure everyone is aware, we moved to https://gitter.im/IronLanguages/ironpython on Gitter so that we could have a room which covered ipy2 and ipy3. Please come hang out and chat! Thanks, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From kuno.meyer at gmx.ch Fri Nov 25 02:09:56 2016 From: kuno.meyer at gmx.ch (Kuno Meyer) Date: Fri, 25 Nov 2016 08:09:56 +0100 Subject: [Ironpython-users] DebuggableLambdaBuilder vs. GeneratorRewriter Message-ID: An HTML attachment was scrubbed... URL: From issworld2000 at yahoo.com Fri Nov 25 13:47:47 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Fri, 25 Nov 2016 18:47:47 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <1592490551.13807.1478553920333@mail.yahoo.com> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> Message-ID: <249014883.428317.1480099667730@mail.yahoo.com> Hi Steve, I imagine that you do not have any spare time left. Still, do you have any suggestion on how I can solve this issue? Thank you for the reply. Kind regards, Djordje Spasic On Monday, November 7, 2016 11:55 PM, Djordje Spasic via Ironpython-users wrote: Hello, I have an issue. I am using ironpython 2.7 editor called through?Rhino 5 application, and I load a single .dll file from an application called?MapWinGIS. Like so: dll_filePath = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath)import MapWinGIS The problem is that I can only call a particular method once. If try to do that the second time, the same method returns "False". When method works correctly (the first time) it return: "True". The problem goes away if I restart the Rhino 5 application (and ironpython 2.7 editor along with it). Why is this happening? I contacted the developers of upper mentioned MapWinGIS application, and they said that they can not replicate this behavior and that I should ask this question on ironpython mailing list. They suggested that I need to somehow "free the memory before you do the second run of the method". So to make my problem more clear, this is what happens: If run a script containing the this particular method twice, the first call of the method returns "True", the second one "False": variable1a = "something1a"variable1b = "something1b"returnedValue1 =MapWinGIS.someClass.someMethod1(variable1a, variable1b)? # returns "True"?variable2a = "something2a"variable2b = "something2b"returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a,variable2b)? #returns "False" If run the same script again, both upper calls of MapWinGIS.someClass.someMethod1 method return "False". If I restart my Rhino 5 application, then again the same thing happens: "True" is returned on first MapWinGIS.someClass.someMethod1 call, while "False" is returned on the second call. If run the script again, then they both return "False". For every other run of the script, I get "False" on both calls. And this continues until I restart Rhino 5. I perfectly understand that it is impossible for anyone from Ironpython mailing list to know the exact cause of this problem. But can you at least help me with "free the memory before you do the second run of the method" part? I tried deleting all the variables after the first call, calling the garbage collector and also removing the .dll file from the list of loaded assemblies. Like this: import clrimport gc?dll_filePath = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath)import MapWinGIS?variable1a = "something1a"variable1b = "something1b"returnedValue1 =MapWinGIS.someClass.someMethod1(variable1a, variable1b)? # returns "True"?# delete all variablesdel dll_filePath; del variable1a; del variable1b; del returnedValue1; del MapWinGIS?# remove the .dll from the listof assembliesfor i,assembly in enumerate(clr.References):??? if assembly.GetName().Name == "Interop.MapWinGIS":??????? clr.References.RemoveAt(i)??????? break?# collect garbagegc.collect()???dll_filePath2 = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath2)import MapWinGIS?variable2a = "something2a"variable2b = "something2b"returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a,variable2b)? #returns "False" But it is not working (I still get the "True" on first method call, and "False" on second). I also tried to exchange the variable1a and variable1b with variable2a and variable2b. Or even use the same variables in both MapWinGIS.someClass.someMethod1 calls. Still, no improvement. The MapWinGIS.someClass.someMethod1 that I am calling is actually:?MapWinGIS.UtilsClass.OGR2OGR. I named it MapWinGIS.someClass.someMethod1 to make it easier for others to follow the code. Not sure if this was good idea. If it wasn't I apologize. This issue is driving me crazy. I would be very grateful for any kind of advice. Thank you in advance! Kind regards, Djordje Spasic _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org https://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From issworld2000 at yahoo.com Sat Nov 26 08:07:28 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Sat, 26 Nov 2016 13:07:28 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <1FF73E78-1C9E-4824-A787-080DC2BDFA04@clear.net.nz> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <249014883.428317.1480099667730@mail.yahoo.com> <1FF73E78-1C9E-4824-A787-080DC2BDFA04@clear.net.nz> Message-ID: <1907013155.720677.1480165648550@mail.yahoo.com> Thank you for the suggestion Tim! I tried something similar. I cannot call methods if I create an instance of the UtilsClass class, as I always get an error message: Could not convert argument 0 for call to UtilsClassMethod but I can if I call them as static methods. So I tried this: utils1 = MapWinGIS.Utils() utils2 = MapWinGIS.Utils() returnedValue1 = MapWinGIS.UtilsClass.UtilsClassMethod(utils1, variable1a, variable1b)returnedValue2 = MapWinGIS.UtilsClass.UtilsClassMethod(utils2, variable2a, variable2b) But this did not fix the problem. returnedValue1 still returns True, while returnedValue2 returns False. -------------------------------- On Saturday, November 26, 2016 7:10 AM, Tim Baigent wrote: I'm out of my depth here, forgive me for not keeping quiet! But perhaps you are be best to create separate instances of the MapWinGIS.Utils class, one for each call, so that there is no chance for inadverently sharing values between instance members. So something like this (and here I'm *really* out of my depth): utils1 = MapWinGIS.Utils()utils2 = MapWinGIS.Utils()...returnedValue1 = utils1(variable1a, variable1b)returnedValue2 = utils2(variable2a, variable2b) Is that possible? On 26/11/2016, at 7:47 AM, Djordje Spasic via Ironpython-users wrote: Hi Steve, I imagine that you do not have any spare time left. Still, do you have any suggestion on how I can solve this issue? Thank you for the reply. Kind regards, Djordje Spasic On Monday, November 7, 2016 11:55 PM, Djordje Spasic via Ironpython-users wrote: Hello, I have an issue. I am using ironpython 2.7 editor called through?Rhino 5 application, and I load a single .dll file from an application called?MapWinGIS. Like so: dll_filePath = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath)import MapWinGIS The problem is that I can only call a particular method once. If try to do that the second time, the same method returns "False". When method works correctly (the first time) it return: "True". The problem goes away if I restart the Rhino 5 application (and ironpython 2.7 editor along with it). Why is this happening? I contacted the developers of upper mentioned MapWinGIS application, and they said that they can not replicate this behavior and that I should ask this question on ironpython mailing list. They suggested that I need to somehow "free the memory before you do the second run of the method". So to make my problem more clear, this is what happens: If run a script containing the this particular method twice, the first call of the method returns "True", the second one "False": variable1a = "something1a"variable1b = "something1b"returnedValue1 =MapWinGIS.someClass.someMethod1(variable1a, variable1b)? # returns "True"?variable2a = "something2a"variable2b = "something2b"returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a,variable2b)? #returns "False" If run the same script again, both upper calls of MapWinGIS.someClass.someMethod1 method return "False". If I restart my Rhino 5 application, then again the same thing happens: "True" is returned on first MapWinGIS.someClass.someMethod1 call, while "False" is returned on the second call. If run the script again, then they both return "False". For every other run of the script, I get "False" on both calls. And this continues until I restart Rhino 5. I perfectly understand that it is impossible for anyone from Ironpython mailing list to know the exact cause of this problem. But can you at least help me with "free the memory before you do the second run of the method" part? I tried deleting all the variables after the first call, calling the garbage collector and also removing the .dll file from the list of loaded assemblies. Like this: import clrimport gc?dll_filePath = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath)import MapWinGIS?variable1a = "something1a"variable1b = "something1b"returnedValue1 =MapWinGIS.someClass.someMethod1(variable1a, variable1b)? # returns "True"?# delete all variablesdel dll_filePath; del variable1a; del variable1b; del returnedValue1; del MapWinGIS?# remove the .dll from the listof assembliesfor i,assembly in enumerate(clr.References):??? if assembly.GetName().Name == "Interop.MapWinGIS":??????? clr.References.RemoveAt(i)??????? break?# collect garbagegc.collect()???dll_filePath2 = "C:\ProgramFiles\MapWinGIS\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(dll_filePath2)import MapWinGIS?variable2a = "something2a"variable2b = "something2b"returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a,variable2b)? #returns "False" But it is not working (I still get the "True" on first method call, and "False" on second). I also tried to exchange the variable1a and variable1b with variable2a and variable2b. Or even use the same variables in both MapWinGIS.someClass.someMethod1 calls. Still, no improvement. The MapWinGIS.someClass.someMethod1 that I am calling is actually:?MapWinGIS.UtilsClass.OGR2OGR. I named it MapWinGIS.someClass.someMethod1 to make it easier for others to follow the code. Not sure if this was good idea. If it wasn't I apologize. This issue is driving me crazy. I would be very grateful for any kind of advice. Thank you in advance! Kind regards, Djordje Spasic _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org https://mail.python.org/mailman/listinfo/ironpython-users _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org https://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjhb at clear.net.nz Sat Nov 26 01:10:10 2016 From: tjhb at clear.net.nz (Tim Baigent) Date: Sat, 26 Nov 2016 19:10:10 +1300 Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <249014883.428317.1480099667730@mail.yahoo.com> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <249014883.428317.1480099667730@mail.yahoo.com> Message-ID: <1FF73E78-1C9E-4824-A787-080DC2BDFA04@clear.net.nz> I'm out of my depth here, forgive me for not keeping quiet! But perhaps you are be best to create separate instances of the MapWinGIS.Utils class, one for each call, so that there is no chance for inadverently sharing values between instance members. So something like this (and here I'm *really* out of my depth): utils1 = MapWinGIS.Utils() utils2 = MapWinGIS.Utils() ... returnedValue1 = utils1(variable1a, variable1b) returnedValue2 = utils2(variable2a, variable2b) Is that possible? > On 26/11/2016, at 7:47 AM, Djordje Spasic via Ironpython-users wrote: > > Hi Steve, > > I imagine that you do not have any spare time left. > Still, do you have any suggestion on how I can solve this issue? > > Thank you for the reply. > > Kind regards, > Djordje Spasic > > > On Monday, November 7, 2016 11:55 PM, Djordje Spasic via Ironpython-users wrote: > > > Hello, > > I have an issue. I am using ironpython 2.7 editor called through Rhino 5 application, and I load a single .dll file from an application called MapWinGIS. Like so: > dll_filePath = "C:\Program Files\MapWinGIS\Interop.MapWinGIS.dll" > clr.AddReferenceToFileAndPath(dll_filePath) > import MapWinGIS > The problem is that I can only call a particular method once. > If try to do that the second time, the same method returns "False". When method works correctly (the first time) it return: "True". > > The problem goes away if I restart the Rhino 5 application (and ironpython 2.7 editor along with it). > > > Why is this happening? I contacted the developers of upper mentioned MapWinGIS application, and they said that they can not replicate this behavior and that I should ask this question on ironpython mailing list. They suggested that I need to somehow "free the memory before you do the second run of the method". > > So to make my problem more clear, this is what happens: > > If run a script containing the this particular method twice, the first call of the method returns "True", the second one "False": > variable1a = "something1a" > variable1b = "something1b" > returnedValue1 = MapWinGIS.someClass.someMethod1(variable1a, variable1b) # returns "True" > > variable2a = "something2a" > variable2b = "something2b" > returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a, variable2b) # returns "False" > If run the same script again, both upper calls of MapWinGIS.someClass.someMethod1 method return "False". > If I restart my Rhino 5 application, then again the same thing happens: "True" is returned on first MapWinGIS.someClass.someMethod1 call, while "False" is returned on the second call. If run the script again, then they both return "False". For every other run of the script, I get "False" on both calls. And this continues until I restart Rhino 5. > > I perfectly understand that it is impossible for anyone from Ironpython mailing list to know the exact cause of this problem. > > But can you at least help me with "free the memory before you do the second run of the method" part? > > I tried deleting all the variables after the first call, calling the garbage collector and also removing the .dll file from the list of loaded assemblies. Like this: > import clr > import gc > > dll_filePath = "C:\Program Files\MapWinGIS\Interop.MapWinGIS.dll" > clr.AddReferenceToFileAndPath(dll_filePath) > import MapWinGIS > > variable1a = "something1a" > variable1b = "something1b" > returnedValue1 = MapWinGIS.someClass.someMethod1(variable1a, variable1b) # returns "True" > > # delete all variables > del dll_filePath; del variable1a; del variable1b; del returnedValue1; del MapWinGIS > > # remove the .dll from the list of assemblies > for i,assembly in enumerate(clr.References): > if assembly.GetName().Name == "Interop.MapWinGIS": > clr.References.RemoveAt(i) > break > > # collect garbage > gc.collect() > > > > dll_filePath2 = "C:\Program Files\MapWinGIS\Interop.MapWinGIS.dll" > clr.AddReferenceToFileAndPath(dll_filePath2) > import MapWinGIS > > variable2a = "something2a" > variable2b = "something2b" > returnedValue2 = MapWinGIS.someClass.someMethod1(variable2a, variable2b) # returns "False" > > But it is not working (I still get the "True" on first method call, and "False" on second). > I also tried to exchange the variable1a and variable1b with variable2a and variable2b. Or even use the same variables in both MapWinGIS.someClass.someMethod1 calls. Still, no improvement. > > The MapWinGIS.someClass.someMethod1 that I am calling is actually: MapWinGIS.UtilsClass.OGR2OGR. > I named it MapWinGIS.someClass.someMethod1 to make it easier for others to follow the code. Not sure if this was good idea. If it wasn't I apologize. > > > This issue is driving me crazy. I would be very grateful for any kind of advice. > Thank you in advance! > > > Kind regards, > Djordje Spasic > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > https://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From issworld2000 at yahoo.com Sun Nov 27 11:32:33 2016 From: issworld2000 at yahoo.com (Djordje Spasic) Date: Sun, 27 Nov 2016 16:32:33 +0000 (UTC) Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <249014883.428317.1480099667730@mail.yahoo.com> Message-ID: <1904826036.1129452.1480264353198@mail.yahoo.com> Hi Pawel, Thank you for the suggestion. I am not familiar with subprocess.popen. How would command line utility look like for this code: import clr?iteropMapWinGIS_dll_filePath = "C:\\ProgramFiles\\MapWindow GIS Lite\\Interop.MapWinGIS.dll"clr.AddReferenceToFileAndPath(iteropMapWinGIS_dll_filePath)import MapWinGIS??utils = MapWinGIS.UtilsClass()osm_filePath = "C:\\rome.osm"shps_filePath = "C:\\rome_sph_files"bstrOptions = '--configOSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"'convertToShapefiles_Result =MapWinGIS.UtilsClass.OGR2OGR(utils, osm_filePath, shps_filePath, bstrOptions, None)if convertToShapefiles_Result== False:??? print "MapWinGIS.UtilsClass.OGR2OGRfailed the first time"???print utils.ErrorMsg??? print utils.LastErrorCode??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorNo??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorMsg??? print MapWinGIS.GlobalSettingsClass().GdalLastErrorTypeelse:??? print "MapWinGIS.UtilsClass.OGR2OGRsuccessfully ran the first time" I would welcome any kind of further reply. Kind regards, Djordje ----------------- On Sunday, November 27, 2016 5:11 PM, Pawel Jasinski wrote: From the API documentation, this is just an alternative entry point to command line utility. If the API does not behave, why not call the command line utility using subprocess.popen ? --pawel -------------- next part -------------- An HTML attachment was scrubbed... URL: From pawel.jasinski at gmail.com Sun Nov 27 12:12:14 2016 From: pawel.jasinski at gmail.com (Pawel Jasinski) Date: Sun, 27 Nov 2016 18:12:14 +0100 Subject: [Ironpython-users] How to free memory in ironpython In-Reply-To: <1904826036.1129452.1480264353198@mail.yahoo.com> References: <1592490551.13807.1478553920333.ref@mail.yahoo.com> <1592490551.13807.1478553920333@mail.yahoo.com> <249014883.428317.1480099667730@mail.yahoo.com> <1904826036.1129452.1480264353198@mail.yahoo.com> Message-ID: sorry, the other answer went without the list. For popen, here is not tested snipped to give you a jump start. The docs for subprocess.popen are your friend. import subprocess args = ["replace with full path to ogr2ogr.exe", osm_filePath, shps_filePath, "--config", "OSM_USE_CUSTOM_INDEXING", "NO", "-skipfailures", "-f", "ESRI Shapefile"] p = subprocess.Popen(args) p.wait() if p.returncode: print "failed with errorlevel %s" % p.returncode the parameters for ogr2ogr may need to be adjusted. Documents from esri are not consistent. --pawel On Sun, Nov 27, 2016 at 5:32 PM, Djordje Spasic wrote: > Hi Pawel, > > Thank you for the suggestion. > I am not familiar with subprocess.popen. > How would command line utility look like for this code: > > *import *clr > > iteropMapWinGIS_dll_filePath = "C:\\Program Files\\MapWindow GIS > Lite\\Interop.MapWinGIS.dll" > clr.*AddReferenceToFileAndPath*(iteropMapWinGIS_dll_filePath) > *import *MapWinGIS > > > utils = MapWinGIS.*UtilsClass*() > osm_filePath = "C:\\rome.osm" > shps_filePath = "C:\\rome_sph_files" > bstrOptions = '--config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI > Shapefile"' > convertToShapefiles_Result = MapWinGIS.UtilsClass.*OGR2OGR*(utils, > osm_filePath, shps_filePath, bstrOptions, *None*) > *if *convertToShapefiles_Result == *False*: > *print *"MapWinGIS.UtilsClass.OGR2OGR failed the first time" > *print *utils.ErrorMsg > *print *utils.LastErrorCode > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorNo > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorMsg > *print *MapWinGIS.*GlobalSettingsClass*().GdalLastErrorType > *else*: > *print *"MapWinGIS.UtilsClass.OGR2OGR successfully ran the first time" > > > I would welcome any kind of further reply. > > Kind regards, > Djordje > > ----------------- > On Sunday, November 27, 2016 5:11 PM, Pawel Jasinski < > pawel.jasinski at gmail.com> wrote: > > From the API documentation, this is just an alternative entry point to > command line utility. > If the API does not behave, why not call the command line utility using > subprocess.popen ? > --pawel > -------------- next part -------------- An HTML attachment was scrubbed... URL: