[Ironpython-users] IronPython, Daily Digest 2/6/2012

no_reply at codeplex.com no_reply at codeplex.com
Tue Feb 7 16:10:27 CET 2012


Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] IronPython should skip leading NLToken's in interactive code
2. [New issue] Unable to pass None to a function that accepts another type

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

ISSUES

1. [New issue] IronPython should skip leading NLToken's in interactive code
http://ironpython.codeplex.com/workitem/32188
User dinov has proposed the issue:

">>> import tokenize, cStringIO
>>> tokenize.tokenize(cStringIO.StringIO('#foo\n1+2').readline)
1,0-1,4:        COMMENT '#foo'
1,4-1,5:        NL      '\n'
2,0-2,1:        NUMBER  '1'
2,1-2,2:        OP      '+'
2,2-2,3:        NUMBER  '2'
3,0-3,0:        ENDMARKER       ''

This shows that a line of input which first contains a comment line and then contains an expression statement gets tokenized to include a NL token followed by the rest of the expression.  IronPython's tokenizer will actually return newline token's here, which is wrong.  Instead it should also start off in a "last new line" state so that the initial newlines get reported as NL tokens.  Then the parser needs to be updated to ignore them at the beginning:  Whenever IronPython's starts parsing it should eat any leading new lines.  

See also http://pytools.codeplex.com/workitem/649"-----------------

2. [New issue] Unable to pass None to a function that accepts another type
http://ironpython.codeplex.com/workitem/32192
User HarryTuttle has proposed the issue:

"Having a problem passing 'None' to a COM Interop method that can
accept 'Nothing' (in VBA)

My code (with considerable snippage):

t = System.Type.GetTypeFromProgID("MicroStationDGN.Application")
self.ms = System.Activator.CreateInstance(t)

elem = self.ms.CreateLineElement2(None, point3d1, point3d2)

Now, I know that the point3d objects are working fine, and self.ms is
working fine as it is part of a library I am putting together and they
are working fine with other methods. The problem is with the 'None' argument. How ever, I run it and get this
error:

E:\py>ipy titleblocknew.py
Traceback (most recent call last):
  File "titleblocknew.py", line 26, in <module>
  File "E:\py\ustation.py", line 162, in create_line
ValueError: Could not convert argument 2 for call to CreateLineElement2.


ILSpy says this about the method:

// Bentley.Interop.MicroStationDGN.Application
[MethodImpl(4096)]
[return: MarshalAs(28)]
LineElement CreateLineElement2([MarshalAs(28)] [In] Element Template,
[In] [Out] ref Point3d StartPoint, [In] [Out] ref Point3d EndPoint);

---

MicroStation documentation says this:

Set LineElement = object.CreateLineElement2 (Template, StartPoint, EndPoint)

The CreateLineElement2 method syntax has these parts:

Part - Description
object - A valid object. (Application object)
Template - An Element expression. An existing element whose settings are
used to initialize the new element. If Nothing, the new element's
settings are initialized from MicroStation's active settings.
StartPoint A Point3d expression.
EndPoint A Point3d expression.

---

My basic understanding is that it is trying to convert None into an
'Element' object, but is unable to do so. Is there a way around this?"
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20120207/7db2ac67/attachment.html>


More information about the Ironpython-users mailing list