[Ironpython-users] IronPython, Daily Digest 12/3/2013

CodePlex no_reply at codeplex.com
Wed Dec 4 09:26:53 CET 2013


Hi ironpython,

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

In today's digest:ISSUES

1. [New comment] struct doesn't support format string of type bytes
2. [New comment] Quoted IRONPYTHONPATH causes error with "import"
3. [New comment] Quoted IRONPYTHONPATH causes error with "import"
4. [New comment] System.Decimal string.format issue
5. [New issue] io.StringIO always closed

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

ISSUES

1. [New comment] struct doesn't support format string of type bytes
http://ironpython.codeplex.com/workitem/34682
User jbester1 has commented on the issue:

"<p>Can do - updated IAW comments</p><p>https://github.com/jbester/main/compare/IronLanguages:master...master</p><p></p>"-----------------

2. [New comment] Quoted IRONPYTHONPATH causes error with "import"
http://ironpython.codeplex.com/workitem/34687
User peterSchwalm has commented on the issue:

"<p>Hello,<br>I am not sure if this is really a bug. IMHO quotes are only syntactic matter of the windows command line interpreter. They are used in .cmd- / .bat-files ore interactively and they serve as protection against splitting filenames containing spaces on a command line into multiple arguments. Normally command lines are splitted into arguments at space characters.</p><p>A program or script called by the command line</p><p>    c:>progName my text.txt</p><p>would find ['progName', 'my', 'text.txt'] in sys.argv (or in how ever that would be named in a non-python language).</p><p>Surrounding the filename (my text.txt) with quotes as in</p><p>    c:>progName "my text.txt"</p><p>simply prevents splitting between 'my' and 'text.txt'. So sys.argv would contain ['progName', 'my text.txt']. So during parsing the command line the quotes disappear and sys.argv will NOT contain ['progName', '"my text.txt"']</p><p>That means the filename itself and the internal presentation in the program does not contain the quotes.</p><p>The problem with the SET-command in cmd.exe is: the command line is not parsed as usually. Instead the<br>environment variable contains the rest of the line (except file redirection options). So after</p><p>    c:>set x=a b c</p><p>the environment variable x contains 'a b c' and the protection against splitting is not necessary.</p><p>So I think the better solution would be: do not use quotes when assigning filenames to environment variables by the SET-command.</p><p>To strip already existing quotes from filenames in batch-files one can use the construct '%~0', '%~1' ... for batchparameters or '%%~f' in for loops. Unfortunately this does not work for environment variables. But one can misuse one-time-for-loops for this purpose.</p><p>For example after in a .bat-file</p><p>    set x="a b c"</p><p>x contains '"a b c"'</p><p>To strip off the quotes one can write:</p><p>    for %%f in (%x%) set x=%%~f</p><p></p><p> </p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p><br></p>"-----------------

3. [New comment] Quoted IRONPYTHONPATH causes error with "import"
http://ironpython.codeplex.com/workitem/34687
User peterSchwalm has commented on the issue:

"<p>In my last comment I accidently "saved" to early.</p><p>The batch-file snippet is:</p><p>    set x="a b c"<br>    set x<br>    rem x is '"a b c"'<br>    rem remove quotes<br>    for %%f in (%x%) do set x=%%~f<br>    set x<br>    rem x is 'a b c' now.</p><p>Sometimes cumbersome to handle. But I would prefer that to handling these batch-file oddities in ironPython. </p><p>Peter<br></p>"-----------------

4. [New comment] System.Decimal string.format issue
http://ironpython.codeplex.com/workitem/34710
User vernondcole has commented on the issue:

"<p>Given that 'string'.format() is a function from the Python standard library, I would say that the chance of getting the worldwide Python community to embrace the extension you suggest for a foreign (dotNet) data type is practically nil -- especially since the option, converting to decimal.Decimal is both easy, and specially supported by the IronPython runtime for exactly this kind of situation.   Conversion to Double could loose precision, direct conversion will not.</p><p>>>> from System import Decimal as SystemDecimal<br>>>> import decimal<br>>>> sd = SystemDecimal(1234567)<br>>>> thousand = SystemDecimal(1000)<br>>>> fract = sd / thousand<br>>>> dd = decimal.Decimal(fract)<br>>>> print('{:,.2f}'.format(dd))<br>1,234.57<br>>>></p><p>Works just exactly like you want.<br></p>"-----------------

5. [New issue] io.StringIO always closed
http://ironpython.codeplex.com/workitem/34713
User paweljasinski has proposed the issue:

"c:\cygwin64\home\rejap>ipy
IronPython 2.7.4 (2.7.0.40) on .NET 4.0.30319.18052 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> from io import StringIO
>>> s=StringIO()
>>> s.write('1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: write to closed file
>>> s=StringIO('1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: write to closed file
>>>
"
----------------------------------------------



----------------------------------------------
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/20131204/c555a1d9/attachment.html>


More information about the Ironpython-users mailing list