Re: [IronPython] [Code Review] Custom PAL fixes

2011-03-31 Thread Bruce Bromberek
As a non developer user I like all of the detailed discussions. It
helps me understand what is going on behind the scenes. And gives me
better C# search terms.

On 3/31/11, Jimmy Schementi ji...@schementi.com wrote:
 Just checked in some small fixes to make the Importer use a custom Platform
 Adaptation Layer. I also started to tweak clr.CompileModules a bit, but
 backed those changes out, so just ignore those.

 Take a look at the recent commits to https://github.com/jschementi/iron. If
 there are no objections, I'll push them to main.

 By the way, is it about time to split this list into a development and users
 list, or you all don't mind seeing these type of mails?

 ~Jimmy


-- 
Sent from my mobile device
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Reading from a open excel document

2011-03-16 Thread Bruce Bromberek
You might want to try
Parameter1 = worksheet.Range[A1].Value

or

Parameter1 = worksheet.Range[A1].Text


On Wed, Mar 16, 2011 at 9:49 AM, Nåjde Henrik henrik.na...@volvo.comwrote:

  Hello!

 I am trying to transfer prameters from an excel sheet to ANSYS Workbench (a
 FEA software), the code is run as a macro in ANSYS workbench.

 I have adapted a code that is opening an already existing document and
 successfully transfers parameters from it, so I know that what i want to
 do can be done.
 The problem is that I cant access a already open document and read from it,
 using instructions from
 http://www.ironpython.info/index.php/Interacting_with_Excel
 For error-seraching I have created a new code looking like this:

 - - - - - - - - - - - - - - - - - -
 #Part 1
 import clr
 clr.AddReference(Microsoft.Office.Interop.Excel)

 from System.Runtime.InteropServices import Marshal
 Excel = Marshal.GetActiveObject(Excel.Application)

 #Part 2
 workbook = Excel.ActiveWorkbook #gives no error
 worksheet = workbook.ActiveSheet #errror

 worksheet = Excel.ActiveSheet  #no error
 Parameter1 = worksheet.Range[A1]# error

 - - - - - - - - - - - - - - - - - -

 The problem is that when trying to access a excel workbook with the
 command worksheet=workbook.ActiveSheet as descriped in the above link I
 get an error message.

 If i instead chose to use worksheet = Excel.ActiveSheet I get no error
 message, but when I continue to access a cell on the active sheet, the
 script still fails.
 I am trying to read the cell using Parameter1 = worksheet.Range[A3]

 It seems to me that the script fails at the point where I try to select the
 workbook or the worksheet, but I have really no clue.

 Does anyone know the correct way to access an open workbook and read from
 the active sheet?


 /Henrik

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] 回复: Will IronPython work with ArcGis?

2011-03-11 Thread Bruce Bromberek
These blogs, seem to talk about using Ironpython and/or C# with ArcGIS, but
depending on the product you may have some problems as there is a preferred
language.

http://www.spatiallyadjusted.com/2009/06/17/ironpython-and-esri-arcgis/

http://www.spatiallyadjusted.com/2009/06/17/ironpython-and-esri-arcgis/
http://www.perrygeo.net/wordpress/?p=136

http://www.perrygeo.net/wordpress/?p=136
http://mygisblog.wordpress.com/2010/02/10/help-with-visual-c-for-arcgis/

2011/3/10 Cronin, Ted tcro...@asrclkrec.com

 ArcGIS arcpy needs cpython.  You can play with Ironclad with IronPython,
 but that doesn’t completely work with arcpy.  You can use IronPython with
 Silverlight and WPF API with IronPython, and don’t see why it wouldn’t work
 with ArcObjects.  You can also use cpython with comtypes and arcpy to get at
 the ArcObjects.



 Ted Cronin

 ACR *Value**GIS*

 (951) 955 - 0487



 *From:* users-boun...@lists.ironpython.com [mailto:
 users-boun...@lists.ironpython.com] *On Behalf Of *
 *Sent:* Thursday, March 10, 2011 12:01 AM
 *To:* Discussion of IronPython
 *Subject:* [IronPython] 回复: Will IronPython work with ArcGis?



 if .net can use arcgis object , i think ironpython have the same function

 --- *11年3月10日,周四, Anton Hughes kurren...@gmail.com* 写道:


 发件人: Anton Hughes kurren...@gmail.com
 主题: [IronPython] Will IronPython work with ArcGis?
 收件人: users users@lists.ironpython.com
 日期: 2011年3月10日,周四,上午4:42

 Hi



 Im wondering if anyone has tried using IronPython to get from and
 manipulate ArcGis objects?



 Is it possible?



 Is it recommended, or should I look at using CPython?



 Thanks,

 Anton


 -下面为附件内容-

 ___
 Users mailing list
 Users@lists.ironpython.comhttp://cn.mc150.mail.yahoo.com/mc/compose?to=Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Issue Triage

2011-01-30 Thread Bruce Bromberek
I though I'd help by going through any issues tagged with High importance,
unassigned, starting with ones from previous releases and seeing is they are
still relevant.

Issue 26426,  which involves sympy (algebraic manipulation) under
ironpython.  With the most recent git version of sympy and IronPython 2.7B1,
I get a better error message.

C:\GITHUB\sympyc:\Program Files\IronPython 2.7\ipy.exe
IronPython 2.7 Beta 1 (2.7.0.10) on .NET 4.0.30319.1
Type help, copyright, credits or license for more information.
 import sympy
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\GITHUB\sympy\sympy\__init__.py, line 30, in module
  File C:\GITHUB\sympy\sympy\core\__init__.py, line 8, in module
  File C:\GITHUB\sympy\sympy\core\expr.py, line 1008, in module
  File C:\GITHUB\sympy\sympy\core\mul.py, line 962, in module
  File C:\GITHUB\sympy\sympy\core\power.py, line 806, in module
  File C:\GITHUB\sympy\sympy\core\add.py, line 516, in module
  File C:\GITHUB\sympy\sympy\core\symbol.py, line 6, in module
  File C:\GITHUB\sympy\sympy\logic\__init__.py, line 1, in module
  File C:\GITHUB\sympy\sympy\logic\boolalg.py, line 4, in module
  File C:\GITHUB\sympy\sympy\core\function.py, line 1091, in module
ImportError: Cannot import name Integer


Line 1091 is :
from numbers import Rational, Integer

I though the issue was 'Integer' as a reserved word in Ironpython.  However,
I can create a function or a class named Integer in the interpreter without
a problem.  Now I'm stuck.  Any thoughts on how to proceed
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] opening an exe with iron python

2011-01-20 Thread Bruce Bromberek
If you are committed to Ironpython, then you can use the the .NET calls

from System.Diagnostics import Process
path = rC:/Program Files/Chaos Group/V-Ray/Maya 2011 for x64/bin
execfile = vrimg2exr.exe
CMDARGS = %s %s % (infile,outfile)

command = %s\\%s% (path,execfile)
print starting command
proc = Process()
proc.StartInfo.FileName = command
proc.StartInfo.Arguments = CMDARGS
proc.Start()
proc.WaitForExit()
print Done


or I have used subprocess to send data in a stream and capture the output.
 It is possible to do the same thing with System.Diagnostics but I don't
have an example.

import subprocess as S

mycmd = XSLTools\\msxsl.exe - FixEncodedMessage.xslt -o %s % Response
output = S.Popen(mycmd,stdin=S.PIPE,shell=True).communicate(xml)[0]


If you problem is that the IronPython engine you are using in Deadline
 doesn't have the standard python modules, you could always build the
modules you need into a DLL on another machine, place the DLL out on the
render farm and use

import clr
clr.AddReference('StdLib')
import subprocess
...



to build the DLL you would can use the pyc.py script that comes with
Ironpython.  I typically create a subfolder in my project, copy the Standard
Lib modules I need (and their dependencies) and use this script from the
commandline to generate the DLL.

#Compile Folder into DLL
import clr
clr.AddReference('mscorlib')
from System import IO
from System.IO.Path import Combine

def walk(folder):
for file in IO.Directory.GetFiles(folder):
yield file
for folder in IO.Directory.GetDirectories(folder):
for file in walk(folder):
yield file

folder = IO.Path.GetDirectoryName(__file__)
print folder

myfiles = list(walk(IO.Path.Combine(folder, 'STDLIB')))


clr.CompileModules(Combine(folder,.\StdLib.dll), *myfiles)

 The existing script is works like this (I'm sure this is error loaded and
 obvious n00b script, so any input would be hugely appreciated):
 converter = subprocess.Popen([rC:/Program Files/Chaos Group/V-Ray/Maya
2011
 for x64/bin/vrimg2exr.exe, inFile, outFile],stdout=subprocess.PIPE)
 print converter.communicate()[0]
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Visual Studio Tools Startup Error

2010-10-01 Thread Bruce Bromberek
Thanks Dino!

This was the culprit.  Deleted the cruft, reinstall 2.7 and everything
works now.

 Such as IronStudio or IronPython Tools for Visual Studio?  If so can you 
 delete
 those directories and try re-installing?  It also might be good to check
 %LOCALAPPDATA%\Microsoft\VisualStudio\10.0\Extensions\Microsoft but
 there really shouldn't be anything there.

Bruce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Visual Studio Tools Startup Error

2010-09-29 Thread Bruce Bromberek
I had to repair my VS2010 Ultimate install, and now Ironpython does not work.

I get this error message on startup of VS2010:
The 'Microsoft.IronpythonTools.IronpythonToolsPackage,
IronpythonTools, Version 1.0.0.0 .' package did not load
correctly.

The Activity Log gives me the following lines with IronPython in them.

Line 459: descriptionBegin package load
[Microsoft.IronPythonTools.IronPythonToolsPackage, IronPythonTools,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]/description
Line 636: pathC:\Program Files\Microsoft Visual Studio
10.0\Common7\IDE\Extensions\Microsoft\IronPython Tools for Visual
Studio\0.4\/path
Line 1411: descriptionSetSite failed for package
[Microsoft.IronPythonTools.IronPythonToolsPackage, IronPythonTools,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]/description
Line 1414: errorinfoNo valid exports were found that match the
constraint '((exportDefinition.ContractName ==
Microsoft.IronPythonTools.IPythonRuntimeHost) AndAlso
(exportDefinition.Metadata.ContainsKey(ExportTypeIdentity) AndAlso
Microsoft.IronPythonTools.IPythonRuntimeHost.Equals(exportDefinition.Metadata.get_Item(ExportTypeIdentity',
invalid exports may have been rejected./errorinfo
Line 1421: descriptionEnd package load
[Microsoft.IronPythonTools.IronPythonToolsPackage, IronPythonTools,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]/description
Line 1424: errorinfoNo valid exports were found that match the
constraint '((exportDefinition.ContractName ==
Microsoft.IronPythonTools.IPythonRuntimeHost) AndAlso
(exportDefinition.Metadata.ContainsKey(ExportTypeIdentity) AndAlso
Microsoft.IronPythonTools.IPythonRuntimeHost.Equals(exportDefinition.Metadata.get_Item(ExportTypeIdentity',
invalid exports may have been rejected./errorinfo
Line 1439: descriptionBegin package load
[Microsoft.IronStudio.IronStudioPackage, IronStudio, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35]/description
Line 1447: descriptionEnd package load
[Microsoft.IronStudio.IronStudioPackage, IronStudio, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35]/description


I've tried uninstalling/reinstalling IronPython 2.7 with no change.  Any ideas?



Bruce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Conflicting information with Ironpython and MapWindowGIS interop

2010-07-02 Thread Bruce Bromberek
Thanks Dino.  But now I get


 shapefile1 = MapWinGIS.Shapefile()
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: Cannot create instances of Shapefile because it is abstract

So then I poked around a bit and found ShapeFileClass, but then I get
a different error.

 s=MapWinGIS.ShapefileClass()
 tst = s.Open(a,None)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: Could not convert argument 0 for call to Open.

I guess its time to add IronPython in Action back to my Safari account
and read the C# stuff I skipped over before.


On Thu, Jul 1, 2010 at 9:34 PM, Dino Viehland di...@microsoft.com wrote:
 My guess is you need to change:

 shapefile1 = MapWinGIS.Shapefile

 To:

 shapefile1 = MapWinGIS.Shapefile()

 You've just gotten a reference to the class whereas the C# code has
 created an instance of that class.

 -Original Message-
 From: users-boun...@lists.ironpython.com [mailto:users-
 boun...@lists.ironpython.com] On Behalf Of Bruce Bromberek
 Sent: Thursday, July 01, 2010 6:22 PM
 To: Discussion of IronPython
 Subject: [IronPython] Conflicting information with Ironpython and
 MapWindowGIS interop

 I'm trying to drive MapWindows GIS from an Ironpython script to
 automate some tasks.  MapWindow is in C#, and I have generated the
 Interop Assembly, and I can load the MapWinGIS namespace.
 Following this example in C#

 //create a new instance for MapWinGIS.Shapefile
 //MapWinGIS.Shapefile  is a data provider for ESRI Shapefile
 MapWinGIS.Shapefile shapefile1 = new MapWinGIS.Shapefile();
 //Define the data source for MapWinGIS.Shapefile instance
 shapefile1.Open(@D:\GISSampleData\base.shp, null );

 So I did the following:
  import clr
  clr.AddReference('MapWindow.Interfaces')
  clr.AddReference('MapWinGeoProc')
  clr.AddReference('MapWinUtility')
  clr.AddReference('MapWinInterfaces')
  clr.AddReference('Interop.MapWinGIS')
  import MapWinGIS
  shapefile1 = MapWinGIS.Shapefile
  help(shapefile1.Open)
 Help on method_descriptor:

 Open(...)
     Open(self, str ShapefileName, ICallback cBack) - bool

  shapefile1.Open(rG:\DLS\BAB\2010 USPS
 GIS\ADC_Layer\ADC_ALBANY_NY_120.shp,None)
 Traceback (most recent call last):
   File stdin, line 1, in module
 TypeError: expected IShapefile, got str

 Not being a C# master, I thought maybe I'm accessing the objects
 correctly.  Try again using IShapefile instead of Shapefile and I got
 this

  t = MapWinGIS.IShapefile
  dir(t)
 ['BeginPointInShapefile', 'CacheExtents', 'CanUseSpatialIndex',
 'CdlgFilter', 'CellValue', 'Close', 'CreateNew',
 'CreateNewWithShapeID', 'CreateSpatialIndex', 'Dissolve',
 'EditCellValue', 'EditClear', 'EditDeleteField', 'EditDeleteShape',
 'EditInsertField', 'EditInsertShape', 'EditingShapes', 'EditingTable',
 'EndPointInShapefile', 'ErrorMsg', 'Extents', 'Field', 'FieldByName',
 'FileHandle', 'Filename', 'GenerateLabels', 'GetIntersection',
 'GlobalCallback', 'HasSpatialIndex', 'InvertSelection',
 'IsSpatialIndexValid', 'Key', 'Labels', 'LastErrorCode', 'NumFields',
 'NumSelected', 'NumShapes', 'Open', 'PointInShape',
 'PointInShapefile', 'Projection', 'QuickExtents', 'QuickPoint',
 'QuickPoints', 'QuickQueryInEditMode', 'RefreshExtents',
 'RefreshShapeExtents', 'Resource', 'Save', 'SaveAs', 'SelectAll',
 'SelectByShapefile', 'SelectNone', 'SelectShapes',
 'SelectionDrawingOptions', 'Shape', 'ShapeSelected', 'ShapefileType',
 'SpatialIndexMaxAreaPercent', 'StartEditingShapes',
 'StartEditingTable', 'StopEditingShapes', 'StopEditingTable',
 'UseQTree', 'UseSpatialIndex', '__doc__', '__repr__', 'numPoints']
  t.Open.__doc__
 'Open(self, str ShapefileName, ICallback cBack) - bool'

  a = rC:\2010 USPS GIS\Shapefiles\ADC ATLANTA GA 303.shp
  t.Open(a,None)
 Traceback (most recent call last):
   File stdin, line 1, in module
 TypeError: expected IShapefile, got str

 Can anyone tell me what I'm missing?

 Thanks.

 Bruce
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Conflicting information with Ironpython and MapWindowGIS interop

2010-07-01 Thread Bruce Bromberek
I'm trying to drive MapWindows GIS from an Ironpython script to
automate some tasks.  MapWindow is in C#, and I have generated the
Interop Assembly, and I can load the MapWinGIS namespace.
Following this example in C#

//create a new instance for MapWinGIS.Shapefile
//MapWinGIS.Shapefile  is a data provider for ESRI Shapefile
MapWinGIS.Shapefile shapefile1 = new MapWinGIS.Shapefile();
//Define the data source for MapWinGIS.Shapefile instance
shapefile1.Open(@D:\GISSampleData\base.shp, null );

So I did the following:
 import clr
 clr.AddReference('MapWindow.Interfaces')
 clr.AddReference('MapWinGeoProc')
 clr.AddReference('MapWinUtility')
 clr.AddReference('MapWinInterfaces')
 clr.AddReference('Interop.MapWinGIS')
 import MapWinGIS
 shapefile1 = MapWinGIS.Shapefile
 help(shapefile1.Open)
Help on method_descriptor:

Open(...)
Open(self, str ShapefileName, ICallback cBack) - bool

 shapefile1.Open(rG:\DLS\BAB\2010 USPS 
 GIS\ADC_Layer\ADC_ALBANY_NY_120.shp,None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: expected IShapefile, got str

Not being a C# master, I thought maybe I'm accessing the objects
correctly.  Try again using IShapefile instead of Shapefile and I got
this

 t = MapWinGIS.IShapefile
 dir(t)
['BeginPointInShapefile', 'CacheExtents', 'CanUseSpatialIndex',
'CdlgFilter', 'CellValue', 'Close', 'CreateNew',
'CreateNewWithShapeID', 'CreateSpatialIndex', 'Dissolve',
'EditCellValue', 'EditClear', 'EditDeleteField', 'EditDeleteShape',
'EditInsertField', 'EditInsertShape', 'EditingShapes', 'EditingTable',
'EndPointInShapefile', 'ErrorMsg', 'Extents', 'Field', 'FieldByName',
'FileHandle', 'Filename', 'GenerateLabels', 'GetIntersection',
'GlobalCallback', 'HasSpatialIndex', 'InvertSelection',
'IsSpatialIndexValid', 'Key', 'Labels', 'LastErrorCode', 'NumFields',
'NumSelected', 'NumShapes', 'Open', 'PointInShape',
'PointInShapefile', 'Projection', 'QuickExtents', 'QuickPoint',
'QuickPoints', 'QuickQueryInEditMode', 'RefreshExtents',
'RefreshShapeExtents', 'Resource', 'Save', 'SaveAs', 'SelectAll',
'SelectByShapefile', 'SelectNone', 'SelectShapes',
'SelectionDrawingOptions', 'Shape', 'ShapeSelected', 'ShapefileType',
'SpatialIndexMaxAreaPercent', 'StartEditingShapes',
'StartEditingTable', 'StopEditingShapes', 'StopEditingTable',
'UseQTree', 'UseSpatialIndex', '__doc__', '__repr__', 'numPoints']
 t.Open.__doc__
'Open(self, str ShapefileName, ICallback cBack) - bool'

 a = rC:\2010 USPS GIS\Shapefiles\ADC ATLANTA GA 303.shp
 t.Open(a,None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: expected IShapefile, got str

Can anyone tell me what I'm missing?

Thanks.

Bruce
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Dirstributing scripts as Exe

2010-04-29 Thread Bruce Bromberek
You also have to watch that the IronPython automatically loads some
assemblies that pyc does not.  It may be overkill but I reference the
following in every script I make into an exe.

#Key IronPython References needed for final EXE when IronPython is not
installed
clr.AddReference('IronPython')
clr.AddReference('IronPython.Modules')
clr.AddReference('Microsoft.Dynamic')
clr.AddReference('Microsoft.Scripting')
clr.AddReference('Microsoft.Scripting.Core')
clr.AddReference('Microsoft.Scripting.Debugging')
clr.AddReference('Microsoft.Scripting.ExtensionAttribute')
clr.AddReference('mscorlib')
clr.AddReference('System')
clr.AddReference('System.Data')



On Thu, Apr 29, 2010 at 5:13 PM, David DiCato ddic...@microsoft.com wrote:

 This is probably an assembly load failure. Try copying c:\Program
 Files\IronPython 2.6\*.dll into your program directory. You will also need
 to make sure that sys.path is properly set if you're using the CPython
 standard lib for anything.

 We realize this is kind of an undesirable workaround, which is why we're
 planning to put all of IronPython's required DLLs in the GAC at some point
 in the future.

 - David

 -Original Message-
 From: users-boun...@lists.ironpython.com [mailto:
 users-boun...@lists.ironpython.com] On Behalf Of Mico Siahaan
 Sent: Thursday, April 29, 2010 3:04 PM
 To: Users@lists.ironpython.com
 Subject: [IronPython] Dirstributing scripts as Exe

 Dear all,

 In CPython there is py2exe to distribute scripts as exe. I notice
 there is pyc.py scripts in IronPython\Tools. I tried to use pyc to
 compile one simple script. It produced an exe file. But when I tried
 to run the exe file, Windows complained: 'Windows stop working...'.
 Did I do something wrong?

 --
 Mico | mico.siah...@gmail.com | @bangmico
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Code Access Security?

2010-04-14 Thread Bruce Bromberek
Does a.py have any module imports?  I always find I have to mess around with
standard python modules being available in order for my DLL's to work when I
distribute exe's.  But then I'm usually using ODBC connections to *.mdb
files

On Wed, Apr 14, 2010 at 4:05 AM, Neidhoo Xaphier xaphi...@googlemail.comwrote:

 I invoke it this way:

 import clr
 clr.AddReference(a.dll)
 import a

 con = a.connect()

 It is the last line which creates the SystemError. I don't have this issue
 if I use/import a.py directly and not the compiled a.dll. But I need to
 provide it as a.dll.

 Regards,
 Xaphier

 2010/4/14 Jimmy Schementi jimmy.scheme...@microsoft.com

 ipy,exe isn't running with any special permissions. How are you invoking
 the code in a.dll?

 ~Jimmy

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] How to reference enumeration in System.Windows.Input

2010-03-08 Thread Bruce Bromberek
I can't seem to figure out how to add a reference to System.Windows.Input
now that it is part of the PresentationCore assembly.  Specifically I'm
trying to check for the enterkey, but I'm forced to do this:

if str(e.Key) == Return:

instead of

if e.Key == Key.Enter:


I'm using Ironpython 2.6.1 RC1 with .Net 3.5.


Thanks
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] How to reference enumeration in System.Windows.Input

2010-03-08 Thread Bruce Bromberek
I kept searching for XAML and enterkey which kept taking me to
PresentationCore.  But you are right, Key is in WindowsBase.  Adding a
reference fixed it for me.

On Mon, Mar 8, 2010 at 10:28 PM, Dino Viehland di...@microsoft.com wrote:

  Has Key moved from WindowsBase to PresentationCore?   I’m not familiar
 with WPF but the docs says it’s in WB:
 http://msdn.microsoft.com/en-us/library/system.windows.input.key.aspx



 If it has genuinely moved, is now type forwarded, and we’re not picking it
 up my suggestion would be to add a reference to both assemblies.  If it
 hasn’t moved we probably need a test which shows that type forwarded types
 are available – I’m hoping reflection will do that.



 *From:* users-boun...@lists.ironpython.com [mailto:
 users-boun...@lists.ironpython.com] *On Behalf Of *Bruce Bromberek
 *Sent:* Monday, March 08, 2010 8:20 PM
 *To:* Discussion of IronPython
 *Subject:* [IronPython] How to reference enumeration in
 System.Windows.Input



 I can't seem to figure out how to add a reference to System.Windows.Input
 now that it is part of the PresentationCore assembly.  Specifically I'm
 trying to check for the enterkey, but I'm forced to do this:

 if str(e.Key) == Return:

 instead of

 if e.Key == Key.Enter:


 I'm using Ironpython 2.6.1 RC1 with .Net 3.5.


 Thanks

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Can't start executable created with pyc.py

2010-02-24 Thread Bruce Bromberek
There are differences between modules that the console (ipy.exe) loads
versus what is loaded when you compile.  When I build an exe I just go for
the kill and reference everything.  msscorlib, System, and System.Data are
key.

import sys
import clr

#Key IronPython References needed for final EXE when IronPython is not
installed
clr.AddReference('IronPython')
clr.AddReference('IronPython.Modules')
clr.AddReference('Microsoft.Dynamic')
clr.AddReference('Microsoft.Scripting')
clr.AddReference('Microsoft.Scripting.Core')
clr.AddReference('Microsoft.Scripting.Debugging')
clr.AddReference('Microsoft.Scripting.ExtensionAttribute')
clr.AddReference('mscorlib')
clr.AddReference('System')
clr.AddReference('System.Data')

#References to .NET Assemblies used by this program
clr.AddReference(System.Xml.Linq)
clr.AddReference(System.Xml)
clr.AddReference(System.Windows.Forms)
clr.AddReference(PresentationFramework, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35)
clr.AddReference(PresentationCore, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35)

#References to created DLL of python modules
clr.AddReference(StdLib)
clr.AddReference(ReportLab)





On Tue, Feb 23, 2010 at 6:17 AM, Neidhoo Xaphier xaphi...@googlemail.comwrote:


 Hello,

 I have a very simple python script I want to compile into an exe-File (with
 IronPython 2.6). The script is named GuiTest.py:

 ### BEGIN GuiTest.py ###
 import clr
 clr.AddReference(PresentationFramework)
 clr.AddReference(PresentationCore)

 import System.Windows
 import System.Windows.Controls

 window= System.Windows.Window()
 window.Title  = GuiTest
 window.Height = 200
 window.Width  = 450

 stack  = System.Windows.Controls.StackPanel()
 stack.Margin   = System.Windows.Thickness(15)
 window.Content = stack

 button = System.Windows.Controls.Button() button.Content = Push Me!

 def onClick(sender, event):
 print Button pushed!

 button.Click += onClick

 stack.Children.Add(button)

 app = System.Windows.Application()
 app.Run(window)
 ### END GuiTest.py ###

 By using pyc.py I created GuiTest.exe with the following command line:

 ipy C:\Programme\IronPython 2.6\Tools\Scripts\pyc.py /main:GuiTest.py
 /target:exe

 Next I copied the following files into the same folder where GuiTest.exe is
 stored:

 IronPython.dll
 IronPython.Modules.dll
 Microsoft.Scripting.ExtensionAttribute.dll
 Microsoft.Dynamic.dll
 Microsoft.Scripting.Core.dll
 Microsoft.Scripting.Debugging.dll
 Microsoft.Scripting.dll

 Unfortunatelly GuiTest.exe still doesn't work. If I try to execute it from
 the command line I get the following error message:

 Unbehandelte Ausnahme: System.InvalidOperationException: Beim aufrufenden
 Thread muss es sich um einen STA-Thread handeln, da dies für viele
 Komponenten der Benutzeroberfläche erforderlich ist.
bei
 Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args,
 Boolean shouldOptimize)
bei
 IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`6.Call5(Ca
 llSite site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2,
 T3arg3, T4 arg4)
bei
 System.Dynamic.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite
 site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
bei IronPython.Runtime.Importer.Import(CodeContext context, String
 fullName, PythonTuple from, Int32 level)
bei IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly
 precompiled, String main, String[] references)
bei PythonMain.Main()

 Do you have any ideas how I can resolve this issue?

 Best regards,
 Xaphier N.

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] IronPython and Project White UI Automation

2010-01-13 Thread Bruce Bromberek
I'm trying to use white (http://www.codeplex.com/white) to build some
process automation scripts.  I've hit a wall where my C# knowledge is
insufficient/non-existent.

White supports all rich client applications, which are Win32, WinForm, WPF
and SWT (java).
It is .NET based and hence you wouldn't have use proprietary scripting
language. You can use your favourite .NET language, IDE and tools for
developing tests/automation programs.
White provides consistent object oriented API for all kinds of applications.
Also it hides all the complexity of Microsoft's UIAutomation library and
windows messages (on which it is based).
*(While WHITE is completely ready to be used, the documentation is still
work under progress. Please do point out the areas which needs
documentation.)*

My Problem is that a win32 based application (VB6!) has some custom
controls.  Specifically ListView20WndClass that was a common control from a
microsoft provided OCX.  The White team says that my solution is to
implement a CustomUI control  (see
http://white.codeplex.com/wikipage?title=Custom%20UI%20ItemreferringTitle=Homefor
an example).  Is it possible to do something like this at runtime in
IronPython2.6 or do I need to go down the C# road?

Any help/pointers would be appreciated.

BB
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Generating executables out of IronPython script

2009-08-28 Thread Bruce Bromberek
I used to think that would be great back when I used py2exe, but once I
built a script to build an MSI, the need went away.  For me having real
install/uninstall, shortcut and registry setting capabilities trumps a
single exe file.

Bruce

On Fri, Aug 28, 2009 at 12:58 PM, Dino Viehland di...@microsoft.com wrote:

  You might be able to use al.exe to link them together – but otherwise
 no.  Is the problem having both Main.dll + Main.exe (which we could
 presumably fix)?  Or is it just the large number of assemblies overall?



 *From:* users-boun...@lists.ironpython.com [mailto:
 users-boun...@lists.ironpython.com] *On Behalf Of *Prabhu Mohan
 *Sent:* Friday, August 28, 2009 6:39 AM
 *To:* users@lists.ironpython.com
 *Subject:* [IronPython] Generating executables out of IronPython script



 Hi,

 I have been using IronPython 2.0.2 to develop a Microsoft SharePoint
 application. I use IronPython studio (Integrated with Visual Studio 2008).
 When I build the project, I get an executable along with IronPython.dll and
 IronMath.dll which I need to redistribute with the executable. But when I
 try to create an executable using PYC I get an executable along with a dll
 (say Main.dll with Main.exe). In this case, I need to redistribute Main.dll,
 IronPython.dll, IronMath.dll, IronPython.Modules.dll,
 Microsoft.Scripting.Core.dll, Microsoft.Scripting.dll etc., So I need to
 know if it is possible to get the same way as IronPython studio provides
 without using the studio (using command line or any other tool)

 --
 Kind Regards,
 Prabhu

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Documentation/Example for Python expressions

2009-08-26 Thread Bruce Bromberek
How much python will you let your users execute?
Are they just typing in formulas or are they accessing data structure?

The Python Tutorial http://docs.python.org/tutorial/index.html   or
http://www.diveintopython.org might be a good place to start, but if they
will not be allowed to forms loops, etc both might be too much.  Can you
post an example if what someone would be entering with your program?

On Wed, Aug 26, 2009 at 7:21 AM, Christian Schmidt 
christian2.schm...@gmx.de wrote:

 Hi,

 we're using IronPython 2.6 within our C#-application to evaluate user
 defined expressions.

 Where can I find end user examples and documentation I can link to for
 python expressions?

 I looked at http://docs.python.org/reference/expressions.html but this is
 too programmer oriented.
 http://www.devshed.com/c/a/Python/Python-Expressions-and-Operators/ looks
 better but is not official.

 Any other links or ideas?

 Thanks,
 Christian
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Documentation/Example for Python expressions

2009-08-26 Thread Bruce Bromberek
So you are looking for something more along the lines of this

https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Expressions
or this
https://www.cs.drexel.edu/~rweaver/COURSES/ISTC-2/TOPICS/expr.html

But for python.

This http://www.greenteapress.com/thinkpython/html/book003.html  comes
close, but again it is too programming oriented.

I'll keep an eye out, but If you need something right away I'd modify the
Javascript Pages.  The info is available under a Creative Commons License,
and it would not take too much time to make it 'pythonic'.  I think the
problem you are going to find is most python intro information is geared
towards learning via the interactive interpreter (out of your scope) or too
technical like the BNF grammer from the language reference.

-Bruce

On Wed, Aug 26, 2009 at 2:36 PM, Michael Foord fuzzy...@voidspace.org.ukwrote:

 Christian Schmidt wrote:

 Hi Bruce,

 thanks for your answer.

  How much python will you let your users execute?


 Potentially everything that can be put into

 ScriptEngine.CreateScriptSourceFromString(
 Expression, _SourceCodeKind.Expression_).Execute(ScriptScope)

  Are they just typing in formulas or are they accessing data structure?


 Normally they type in simple formulas. But they are also allowed to type
 in formulas that access functions, properties of classes/objects/data
 structures and generators.

  The Python Tutorial http://docs.python.org/tutorial/index.html   or
 http://www.diveintopython.org might be a good place to start, but if
 they will not be allowed to forms loops, etc both might be too much.


 These are all nicely written introductions to python programming. But
 that's too much: As Expression one can only enter one-liners - no
 structured programs, no function or class definitions, no control flow, no
 import statements ... simply no statements at all.

  Can you post an example if what someone would be entering with your
 program?


 Distance * AvgSpeed

 Distance**0.9 if Distance  0 else 5

 sum([pos.time for pos in positions where pos.type = 7])

 complicated_function1(a,b) + complicated_function2({ param1: c, param2:
 42 })

 where Distance, AvgSpeed, positions, a, b, c, ... are variables from the
 ScriptScope.


 Unfortunately I don't think such a documentation exists (not that I'm aware
 of but the internets is a big place). I wish it did - and if you write one
 then please make it public.

 The Python grammar is a good place to get the definitive syntax allowed in
 expressions, at least if you can read BNF.

 Michael



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 --
 http://www.ironpythoninaction.com/
 http://www.voidspace.org.uk/blog



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Platform comparison

2009-08-04 Thread Bruce Bromberek
Wow.  I completely missed it.  And someday I'll learn to read closely.  My
snarky comments deserved some snide.

On Mon, Aug 3, 2009 at 9:29 AM, Matthew Wilson diakop...@gmail.com wrote:

 Honestly, I'll contribute to this thread something other than a
 snide-sounding clarification someday... :)
 http://www.parrot.org/languages does in fact link to Pynie...

 On Mon, Aug 3, 2009 at 9:25 AM, Bruce
 Bromberekbruce.brombe...@gmail.com wrote:
  Parrot.org only links to pirate
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Platform comparison

2009-08-03 Thread Bruce Bromberek
On Sun, Aug 2, 2009 at 11:36 PM, Matthew Wilson diakop...@gmail.com wrote:

 Unripened fruit from the peanut gallery:  Pynie would be a 3-years
 more appropriate example of a Python implementation on Parrot: see
 http://code.google.com/p/pynie/source/list

 -Matthew Wilson
 http://diakopter.blogspot.com/
 http://jsmeta.org/

 On Sun, Aug 2, 2009 at 11:28 PM, Jimmy
 Schementijimmy.scheme...@microsoft.com wrote:
  ParrotVM has a Python implementation … though it’s not a full
 implementation
  today (http://pirate.tangentcode.com/). Parrot seems to have a ton of
  language implementations build using it, but very few are complete
  implementations (with the exception of Perl); they are just tests of
 Parrot
  as a compiler infrastructure.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Platform comparison

2009-08-03 Thread Bruce Bromberek
Lets try this a second time :)

Thanks for the link.  I did not know about pynie.  And if you don't know
about it already, its effectively invisible for a google search of
python+parrot+vm.

Parrot.org only links to pirate (which the nightly build shows 14 failed
tests and 47 errors out of 62 written tests and the last activity in the CVS
being ~ 3 years ago)

The strength of Ironpython is IMHO, the ability to tap into the .NET
framework.  As a reformed perl hacker, that is more important to me than
having python code that can use CPAN modules.

-Bruce

On Sun, Aug 2, 2009 at 11:36 PM, Matthew Wilson diakop...@gmail.com wrote:

 Unripened fruit from the peanut gallery:  Pynie would be a 3-years
 more appropriate example of a Python implementation on Parrot: see
 http://code.google.com/p/pynie/source/list

 -Matthew Wilson
 http://diakopter.blogspot.com/
 http://jsmeta.org/

 On Sun, Aug 2, 2009 at 11:28 PM, Jimmy
 Schementijimmy.scheme...@microsoft.com wrote:
  ParrotVM has a Python implementation … though it’s not a full
 implementation
  today (http://pirate.tangentcode.com/). Parrot seems to have a ton of
  language implementations build using it, but very few are complete
  implementations (with the exception of Perl); they are just tests of
 Parrot
  as a compiler infrastructure.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Platform comparison

2009-08-02 Thread Bruce Bromberek
To my knowledge there is not a working python implementation under parrot
nor is there an IronPerl implementation for the DLR.  The comparison you ask
for is not even apples and oranges,  More like mushrooms and turnips :)
;

On Sun, Aug 2, 2009 at 10:59 AM, Dody Gunawinata empirebuil...@gmail.comwrote:

 Is there any comparison between DLR and ParrotVM somewhere on the
 interwebs?

 --
 nomadlife.org


 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] SQLite

2009-07-29 Thread Bruce Bromberek
In Cpython I use SQLite, in Iron Python I've taken to using SQL Server
Compact Edition.  But then again I am only writing for the windows platform.

On Wed, Jul 29, 2009 at 1:19 PM, Harry Pierson
harry.pier...@microsoft.comwrote:

 We don't support the CPython sqlite3 module, but I would expect the
 System.Data.SQLite DLL to work with IronPython. I imagine it would be
 possible to build a sqlite3 compatible wrapper around System.Data.SQLite,
 but I don't know if anyone has done that.

 Harry

 -Original Message-
 From: users-boun...@lists.ironpython.com [mailto:
 users-boun...@lists.ironpython.com] On Behalf Of Kelie
 Sent: Wednesday, July 29, 2009 10:52 AM
 To: users@lists.ironpython.com
 Subject: [IronPython] SQLite

 Hello,

 Is SQLite currently supported in IronPython? If not, is SQLite .NET
 from http://sqlite.phxsoftware.com/ the best alternative?

 Thanks.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Problem with Creating Executable using SharpDevelop

2009-07-17 Thread Bruce Bromberek
Kelie-

I just went through this process recently myself.

My rules of thumb are as follows:

*When building the App:*

Look at your references to the 5 ironpython DLLs.  Decide right now:  Are
you going to use the ones that ship with SharpDevelop or the ones using that
come with IronPython.  Choose one and be consistent.

I'm still working though how to Build a WIX installer project , so I
currently ZIP up the release folder generated by SharpDevelop and make sure
everything is there.  Here's an example for a simple program I have
distributed to coworkers.

AIIMTool.dll
AIIMTool.exe
ICSharpCode.SharpZipLib.dll
IronMath.dll
IronPython.dll
IronPython.Modules.dll
IronPythonTest.dll
Microsoft.Scripting.Core.dll
Microsoft.Scripting.dll
Microsoft.Scripting.ExtensionAttribute.dll
*
Make sure the Target machine has been upgraded to .Net 3.5 SP1.  Don't take
any flack - make them upgrade.*

*Make sure they are not running on a network share.  Weird things with trust
can happen with shares.  See my recent cry for help on this list for more
info.*

-Bruce

On Fri, Jul 10, 2009 at 1:34 AM, Kelie kf9...@gmail.com wrote:

 Hello,

 I created a simple program with a few buttons, checkboxes, textboxes,
 etc. and it worked fine. The form was created in the latest
 SharpDevelop beta version (Version : 3.1.0.4077). Then I compiled the
 solution. In the release folder there were these files:

 IronPython.dll
 ManningsSolver.dll
 ManningsSolver.exe
 Microsoft.Scripting.Core.dll
 Microsoft.Scripting.dll
 Microsoft.Scripting.ExtensionAttribute.dll

 When tried on two computers with IronPython installed and with the
 source code files, the program worked. But it failed on another
 computer that does not have these. And error message was very
 generic .NET error. I don't exactly remember what it was. Is this
 normal?

 Btw, since I have SharpDevelop installed, do I have to install
 IronPython in order to write programs in IronPython? Or does it matter
 which version of IronPython I install. The answer seems to be No
 because I see those .dll files for IronPython in this folder C:
 \Program Files\SharpDevelop\3.0\AddIns\AddIns\BackendBindings
 \PythonBinding which are dated Feb 2009. Guess they're not the
 latest.

 Thanks,

 Kelie

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Problem Running Compiled Ironpython APP .NET Issue

2009-07-08 Thread Bruce Bromberek
I'm stuck.

I have an Ironpython (2.0.0.0  .NET 2.0.50727.3082 according to ipy console
screen )app that I have created and successfully run multiple machines under
my control.

I've given the compiled app to other users.  Half of the time it runs great,
the other half it dies right away with a System.MissingMethodException
:Method not found
void.system.reflection.emit.dynamicmethod..ctor()  error message.  When
I googled that string I read a post that reminded me that Ironpython
requires .Net2.0 SP1.

I had the affected users upgrade their installs to .NET framework 3.5  and
the .NET 2.0 version is 2.0.50727.1433  (SP1 according to a table in
Wikipedia)

The die at launch is still occuring.

Can anyone point in the right direction to solve this problem and/or tell me
what is causing it.  In case it helps, I have listed the imports I'm using
in the script in addition to standard 5 ironpython assemblies/dll

import clr
clr.AddReference('mscorlib')
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

import sys
import System
import System.Data
from System.IO import Directory, Path, File
from System import DateTime
from System.Windows.Forms import DialogResult, OpenFileDialog
from System.Drawing import Size
from System.Windows.Forms import Button, DockStyle, Panel, Form,
FormBorderStyle, Padding, TextBox
import time



Bruce Bromberek
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Problem Running Compiled Ironpython APP .NET Issue

2009-07-08 Thread Bruce Bromberek
I do not have IronPython installed.  I'm just distributing the compiled app
and dlls in the folder.  Script compiled using SharpDevelop 3.1

On Wed, Jul 8, 2009 at 10:55 AM, Curt Hagenlocher c...@hagenlocher.orgwrote:

 When you run ipy.exe on these machines it starts up successfully, but when
 you start your app you get the MissingMethodException for that DynamicMethod
 constructor?
 On Wed, Jul 8, 2009 at 8:45 AM, Bruce Bromberek bruce.brombe...@gmail.com
  wrote:

 I'm stuck.

 I have an Ironpython (2.0.0.0  .NET 2.0.50727.3082 according to ipy
 console screen )app that I have created and successfully run multiple
 machines under my control.

 I've given the compiled app to other users.  Half of the time it runs
 great, the other half it dies right away with a
 System.MissingMethodException :Method not found
 void.system.reflection.emit.dynamicmethod..ctor()  error message.
 When I googled that string I read a post that reminded me that Ironpython
 requires .Net2.0 SP1.

 I had the affected users upgrade their installs to .NET framework 3.5  and
 the .NET 2.0 version is 2.0.50727.1433  (SP1 according to a table in
 Wikipedia)

 The die at launch is still occuring.

 Can anyone point in the right direction to solve this problem and/or tell
 me what is causing it.  In case it helps, I have listed the imports I'm
 using in the script in addition to standard 5 ironpython assemblies/dll

 import clr
 clr.AddReference('mscorlib')
 clr.AddReference('System')
 clr.AddReference('System.Data')
 clr.AddReference('System.Windows.Forms')
 clr.AddReference('System.Drawing')

 import sys
 import System
 import System.Data
 from System.IO import Directory, Path, File
 from System import DateTime
 from System.Windows.Forms import DialogResult, OpenFileDialog
 from System.Drawing import Size
 from System.Windows.Forms import Button, DockStyle, Panel, Form,
 FormBorderStyle, Padding, TextBox
 import time



 Bruce Bromberek

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Problem Running Compiled Ironpython APP .NET Issue

2009-07-08 Thread Bruce Bromberek
I sent them ipy.exe and it generated the same error.

I wonder, does ipy really require SP2 for .NET20.  That is the only
difference I see between my install (.NET 3.5 SP1, .NET 2.0 SP2) and their
install (.NET 3.5, .NET 2.0 SP1)?

Bruce

On Wed, Jul 8, 2009 at 11:10 AM, Curt Hagenlocher c...@hagenlocher.orgwrote:

 How have you confirmed that they successfully installed SP1? One easy way
 is to give them ipy.exe to put into the same folder and have them try to run
 it.


 On Wed, Jul 8, 2009 at 8:57 AM, Bruce Bromberek bruce.brombe...@gmail.com
  wrote:

 I do not have IronPython installed.  I'm just distributing the compiled
 app and dlls in the folder.  Script compiled using SharpDevelop 3.1


 On Wed, Jul 8, 2009 at 10:55 AM, Curt Hagenlocher 
 c...@hagenlocher.orgwrote:

 When you run ipy.exe on these machines it starts up successfully, but
 when you start your app you get the MissingMethodException for that
 DynamicMethod constructor?
 On Wed, Jul 8, 2009 at 8:45 AM, Bruce Bromberek 
 bruce.brombe...@gmail.com wrote:

 I'm stuck.

 I have an Ironpython (2.0.0.0  .NET 2.0.50727.3082 according to ipy
 console screen )app that I have created and successfully run multiple
 machines under my control.

 I've given the compiled app to other users.  Half of the time it runs
 great, the other half it dies right away with a
 System.MissingMethodException :Method not found
 void.system.reflection.emit.dynamicmethod..ctor()  error message.
 When I googled that string I read a post that reminded me that Ironpython
 requires .Net2.0 SP1.

 I had the affected users upgrade their installs to .NET framework 3.5
 and the .NET 2.0 version is 2.0.50727.1433  (SP1 according to a table in
 Wikipedia)

 The die at launch is still occuring.

 Can anyone point in the right direction to solve this problem and/or
 tell me what is causing it.  In case it helps, I have listed the imports 
 I'm
 using in the script in addition to standard 5 ironpython assemblies/dll

 import clr
 clr.AddReference('mscorlib')
 clr.AddReference('System')
 clr.AddReference('System.Data')
 clr.AddReference('System.Windows.Forms')
 clr.AddReference('System.Drawing')

 import sys
 import System
 import System.Data
 from System.IO import Directory, Path, File
 from System import DateTime
 from System.Windows.Forms import DialogResult, OpenFileDialog
 from System.Drawing import Size
 from System.Windows.Forms import Button, DockStyle, Panel, Form,
 FormBorderStyle, Padding, TextBox
 import time



 Bruce Bromberek

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Problem Running Compiled Ironpython APP .NET Issue

2009-07-08 Thread Bruce Bromberek
Problem resolved?

It appears that my users had copied the files to a network drive and were
running from there instead of from their PC.  Everything is working now with
.NET2.0 SP1 and the files located on their C drive.  Weird that file
location would have an effect.

Thanks for your help Curt.

Bruce

On Wed, Jul 8, 2009 at 2:07 PM, Bruce Bromberek
bruce.brombe...@gmail.comwrote:

 I sent them ipy.exe and it generated the same error.

 I wonder, does ipy really require SP2 for .NET20.  That is the only
 difference I see between my install (.NET 3.5 SP1, .NET 2.0 SP2) and their
 install (.NET 3.5, .NET 2.0 SP1)?

 Bruce


 On Wed, Jul 8, 2009 at 11:10 AM, Curt Hagenlocher c...@hagenlocher.orgwrote:

 How have you confirmed that they successfully installed SP1? One easy way
 is to give them ipy.exe to put into the same folder and have them try to run
 it.


 On Wed, Jul 8, 2009 at 8:57 AM, Bruce Bromberek 
 bruce.brombe...@gmail.com wrote:

 I do not have IronPython installed.  I'm just distributing the compiled
 app and dlls in the folder.  Script compiled using SharpDevelop 3.1


 On Wed, Jul 8, 2009 at 10:55 AM, Curt Hagenlocher 
 c...@hagenlocher.orgwrote:

 When you run ipy.exe on these machines it starts up successfully, but
 when you start your app you get the MissingMethodException for that
 DynamicMethod constructor?
 On Wed, Jul 8, 2009 at 8:45 AM, Bruce Bromberek 
 bruce.brombe...@gmail.com wrote:

 I'm stuck.

 I have an Ironpython (2.0.0.0  .NET 2.0.50727.3082 according to ipy
 console screen )app that I have created and successfully run multiple
 machines under my control.

 I've given the compiled app to other users.  Half of the time it runs
 great, the other half it dies right away with a
 System.MissingMethodException :Method not found
 void.system.reflection.emit.dynamicmethod..ctor()  error message.
 When I googled that string I read a post that reminded me that Ironpython
 requires .Net2.0 SP1.

 I had the affected users upgrade their installs to .NET framework 3.5
 and the .NET 2.0 version is 2.0.50727.1433  (SP1 according to a table in
 Wikipedia)

 The die at launch is still occuring.

 Can anyone point in the right direction to solve this problem and/or
 tell me what is causing it.  In case it helps, I have listed the imports 
 I'm
 using in the script in addition to standard 5 ironpython assemblies/dll

 import clr
 clr.AddReference('mscorlib')
 clr.AddReference('System')
 clr.AddReference('System.Data')
 clr.AddReference('System.Windows.Forms')
 clr.AddReference('System.Drawing')

 import sys
 import System
 import System.Data
 from System.IO import Directory, Path, File
 from System import DateTime
 from System.Windows.Forms import DialogResult, OpenFileDialog
 from System.Drawing import Size
 from System.Windows.Forms import Button, DockStyle, Panel, Form,
 FormBorderStyle, Padding, TextBox
 import time



 Bruce Bromberek

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Modifying The PYC Stub EXE

2009-04-06 Thread Bruce Bromberek
Davy-

I had a similar problem in that the EXE stub built by pyc does not work as
expected.  My problem was the sys.argv being set to None.  As someone who
comes to ironpython from Cpython, I want the ironpython equivalent of py2exe
where everything just works :)

The best advice I've found here is to build your own C#  stub exe (thanks
Michael!)

For my own purposes, I'm going with a two step process.  PYC to create the
DLL of my script and imported modules.  And C# stub that hosts ironpython,
loads all the assemblies, and calls my Main().

Now looking at your sample code, I wonder if part of the problem is that you
do not have references to the assemblies that the Ironpython console loads
by default.  Of course I could be wrong on everything.


Bruce




On Sun, Apr 5, 2009 at 5:54 AM, Davy Mitchell daftspan...@gmail.com wrote:

 Hi Folks,

 I am looking to modify the EXE stub generated by PYC so that it will set
 the current working directory to the location of the EXE
 before loading its assemblies.

 The problem I am having is I build my EXE to a sub-folder called BUILD. If
 I call it in the form .\build\die.exe then it can't find the DLLs.
 This can be worked around with shortcuts setting the working dir etc but
 having this option in code in PYC would be useful.

 Forgive me if I am very very muddled up about something :-)

 Thanks,
 Davy Mitchell



 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Two Problems with sys.argv and compiled scripts

2009-03-23 Thread Bruce Bromberek
Problem #1
I know this is a know issue, but my google-fu has been able to uncover the
solution.  When I compile my script into an exe , sys.argv get sets to ' '.

Using SharpDevelop and Ironpython 2.0.1

#Program.py
#
import clr
clr.AddReference('mscorlib')
clr.AddReference('System')
import sys
import System

if __name__ == 'Program':
try:
print sys.argv = ,sys.argv
except System.Exception, e:
print e

yeilds output of
C:\Program Files\IronPython 2.0.1\Samples\pycProgram.exe fred
sys.argv =  ['']

instead of the expected
sys.argv['fred']

Problem #2:

If I drag and drop a file onto the exe, I get a exception message that I
can't see.  In IronPython 1.0, the dropped file would populate sys.argv

Hopefully someone can answer or direct me to better source.

-WombatPM
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com