From fernandez_dan2 at hotmail.com Thu Jun 4 13:17:22 2015 From: fernandez_dan2 at hotmail.com (Daniel Fernandez) Date: Thu, 4 Jun 2015 05:17:22 -0600 Subject: [Ironpython-users] issue with chardtect.detect with unicode type Message-ID: Hi All, I'm playing with request but running into an issue with chardet.detect call. def detect(aBuf): if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or (version_info >= (3, 0) and not isinstance(aBuf, bytes))): raise ValueError('Expected a bytes object, not a unicode object') from . import universaldetector u = universaldetector.UniversalDetector() u.reset() u.feed(aBuf) u.close() return u.result It always throws ValueError exception 'Expected a bytes object, not a unicode object'. The problem is the isinstance(aBuff,unicode) which returns True for IronPython and not CPython. I guess in IronPython strings are both a str and unicode types >>> v = 'value' >>> isinstance(v,unicode) True >>> isinstance(v,str) True I was wondering if this is expected behavior for IronPython? At the moment I just removed this check in my local copy so I get pass this issue with requests. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at agraham.demon.co.uk Thu Jun 4 14:29:30 2015 From: andy at agraham.demon.co.uk (Andrew Graham) Date: Thu, 4 Jun 2015 13:29:30 +0100 Subject: [Ironpython-users] issue with chardtect.detect with unicode type In-Reply-To: References: Message-ID: <04757003F3204A3998206C483D76DF11@AndyDesktop> Yes, the unicode type in IronPython is is the same as string by design, ?unicode == str? will return True From: Daniel Fernandez Sent: Thursday, June 04, 2015 12:17 PM To: ironpython-users at python.org Subject: [Ironpython-users] issue with chardtect.detect with unicode type Hi All, I'm playing with request but running into an issue with chardet.detect call. def detect(aBuf): if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or (version_info >= (3, 0) and not isinstance(aBuf, bytes))): raise ValueError('Expected a bytes object, not a unicode object') from . import universaldetector u = universaldetector.UniversalDetector() u.reset() u.feed(aBuf) u.close() return u.result It always throws ValueError exception 'Expected a bytes object, not a unicode object'. The problem is the isinstance(aBuff,unicode) which returns True for IronPython and not CPython. I guess in IronPython strings are both a str and unicode types >>> v = 'value' >>> isinstance(v,unicode) True >>> isinstance(v,str) True I was wondering if this is expected behavior for IronPython? At the moment I just removed this check in my local copy so I get pass this issue with requests. Thanks. -------------------------------------------------------------------------------- _______________________________________________ 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 Sven.Prevrhal at philips.com Wed Jun 10 15:36:39 2015 From: Sven.Prevrhal at philips.com (Prevrhal, Sven) Date: Wed, 10 Jun 2015 13:36:39 +0000 Subject: [Ironpython-users] numpy dot net ndarray interface Message-ID: <212D925E4ED2844F900023F8D64870964A226677@AMSPRD9002MB042.MGDPHG.emi.philips.com> Hi all, I have succeeded in compiling the old numpy and scipy refactor projects and actually calling from a C# VS project. I am stuck at how the numpy ndarray array converts to a C# type. I tried IList but I got the error that it got an ndarray. But there is no ndarray C# type so what do I use? Cheers, Sven ________________________________ The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message. -------------- next part -------------- An HTML attachment was scrubbed... URL: From avillavedra at ccc.com.uy Wed Jun 10 19:24:43 2015 From: avillavedra at ccc.com.uy (=?UTF-8?B?QWd1c3TDrW4gVmlsbGF2ZWRyYQ==?=) Date: Wed, 10 Jun 2015 14:24:43 -0300 Subject: [Ironpython-users] Error installing package with pip Message-ID: <557872DB.9030504@ccc.com.uy> Hello everyone, I posted this on github and got no answers, I found a similar posting here from January (https://mail.python.org/pipermail/ironpython-users/2015-January/017391.html) where no solution is mentioned so here I am. I get an error when I try to install a package via pip. I use ironpython 2.7.5 and tested on several PC, all windows. Copied from https://github.com/IronLanguages/main/issues/1203 I'm new to Python so this might be something I'm doing wrong, but I'm having the following problem: I installed iron Python 2.7.5, and then installed pip with|ipy.exe -X:Frames -m ensurepip| So far everything works fine, but when I tried to install packages it didn't work. Any help is appreciated, following is a detailed description. I installed Ironpython on WinXP for the first time, then ensurepip, and tried getting pyvisa without success. Then went to a basic pip package as shown in the release info but it's not working. Executing the line|ipy.exe -X:Frames -m pip install html5lib|gives me an error as follows: | File "C:\Archivos de programa\IronPython 2.7\lib\site-packages\pip\_vendor\requests\packages\urllib3\packages\ssl_match_hostname\_implementation.py", line 88, in match_hostname for key, value in sub: ValueError: too many values to unpack | After digging a bit the problem is that the following code |sub = ('txt1','txt2') for key,value in sub: print key,value | gives the error |File "", line 1, in ValueError: too many values to unpack | I don't understand why this happens, any ideas? After this was detected, if I modify _implementation.py to work around this error, I get a new error which I don't get. The log file follows: |------------------------------------------------------------ C:\Archivos de programa\IronPython 2.7\lib\site-packages\pip\__main__.py run on 05/20/15 18:02:52 Downloading/unpacking html5lib Getting page https://pypi.python.org/simple/html5lib/ Could not fetch URL https://pypi.python.org/simple/html5lib/: connection error: hostname 'pypi.python.org' doesn't match 'www.python.org' Will skip URL https://pypi.python.org/simple/html5lib/ when looking for download links for html5lib Getting page https://pypi.python.org/simple/ Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/ (Caused by : ) Will skip URL https://pypi.python.org/simple/ when looking for download links for html5lib Cannot fetch index base URL https://pypi.python.org/simple/ URLs to search for versions for html5lib: * https://pypi.python.org/simple/html5lib/ Getting page https://pypi.python.org/simple/html5lib/ Could not fetch URL https://pypi.python.org/simple/html5lib/: connection error: hostname 'pypi.python.org' doesn't match 'www.python.org' Will skip URL https://pypi.python.org/simple/html5lib/ when looking for download links for html5lib Could not find any downloads that satisfy the requirement html5lib Cleaning up... Removing temporary dir c:\documents and settings\agustin\configuraci?n local\temp\pip_build_agustin... No distributions at all found for html5lib Exception information: Traceback (most recent call last): File "C:\Archivos de programa\IronPython 2.7\lib\site-packages\pip\basecommand.py", line 122, in main status = self.run(options, args) File "C:\Archivos de programa\IronPython 2.7\lib\site-packages\pip\commands\install.py", line 278, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "C:\Archivos de programa\IronPython 2.7\lib\site-packages\pip\req.py", line 1183, in prepare_files url = finder.find_requirement(req_to_install, upgrade=self.upgrade) File "C:\Archivos de programa\IronPython 2.7\lib\site-packages\pip\index.py", line 277, in find_requirement raise DistributionNotFound('No distributions at all found for %s' % req) DistributionNotFound: No distributions at all found for html5lib | It seems the server is reporting the wrong hostname? Anyone knows what's happening here? -- Agust?n Villavedra R&D Department CCC del Uruguay SA Phone: 598 2 600 7629 General Paz 1371 Fax: 598 2 601 6286 Montevideo 11400 E-mail: avillavedra at ccc.com.uy Uruguay WWW: http://www.ccc.com.uy -------------- next part -------------- An HTML attachment was scrubbed... URL: