Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Jussi Piitulainen
Erik writes:

> On 25/05/16 11:19, Steven D'Aprano wrote:
>> On Wednesday 25 May 2016 19:10, Christopher Reimer wrote:
>>
>>> Back in the early 1980's, I grew up on 8-bit processors and latin-1
>>> was all we had for ASCII.
>>
>> It really, truly wasn't. But you can be forgiven for not knowing
>> that, since until the rise of the public Internet most people weren't
>> exposed to more than one code page or encoding, and it was incredibly
>> common for people to call *any* encoding "ASCII".
>
> Indeed - at that time, I was working with COBOL on an IBM S/370. On
> that system, we used EBCDIC ASCII. That was the wierdest ASCII of all
>  ;)

UTF-8 ASCII is nice.

UTF-16 ASCII is weird. Wierd. Probably all right in an environment that
is otherwise set to use UTF-16.

Nothing is as weird as a mix of different encodings of a foreign script
in the same "plain text" file, said to be "Unicode". 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Rustom Mody
On Thursday, May 26, 2016 at 12:52:09 PM UTC+5:30, Jussi Piitulainen wrote:
> UTF-16 ASCII is weird. Wierd. Probably all right in an environment that
> is otherwise set to use UTF-16.

In http://blog.languager.org/2015/03/whimsical-unicode.html
are some examples of why UTF-16 is bug-inviting
[ section is "Wide is too narrow" ]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for / while else doesn't make sense

2016-05-26 Thread Rustom Mody
On Thursday, May 26, 2016 at 12:24:28 PM UTC+5:30, Jussi Piitulainen wrote:
> Rustom Mody writes:
> 
> > On Wednesday, May 25, 2016 at 4:18:02 PM UTC+5:30, Marko Rauhamaa wrote:
> ...
> >> instead of ASCII, national 7-bit character set variants were being
> >> used.  For example, you might see Pascal code like this:
> >> 
> >>ä return the net å
> >>ret := grossÄunitÅ * grossRate
> >> 
> >> http://www.aivosto.com/vbtips/charsets-7bit.html>
> ...
> > Thanks to this (sub)thread Ive added a new section: "Lemma: 7=8" here
> > http://blog.languager.org/2014/04/unicode-and-unix-assumption.html
> 
> There may be a small inaccuracy at the point where you refer to
> Latin[1-15]. There are 15 parts to ISO-8859, numbered from 1 to 16 (with
> part 12 abandoned), but their numbers are not in synch with the Latin-N
> nicknames. In particular, Latin-9 is 8859-15, while 8859-9 is Latin-5.
> Some of the 8859-N are not Latin-anything.
> 
> https://en.wikipedia.org/wiki/ISO/IEC_8859
> 
> This important detail should fit well in your narrative :)

Suggestions incorporated -- tnx
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Erik

On 26/05/16 02:28, Dennis Lee Bieber wrote:

On Wed, 25 May 2016 22:03:34 +0100, Erik 
declaimed the following:


Indeed - at that time, I was working with COBOL on an IBM S/370. On that
system, we used EBCDIC ASCII. That was the wierdest ASCII of all  ;)


It would have to be... Extended Binary Coded Decimal Interchange Code,
as I recall, predates American Standard Code for Information Interchange.

EBCDIC's 8-bit code is actually more closely linked to Hollerith card
encodings.


I really didn't think it would be necessary to point this out (I thought 
the "" and emoji would be enough), but for the record, my 
previous message was clearly a joke.


To break it down, Stephen was making the observation that people call 
all sorts of extended ASCII encodings (including proprietary things) 
"ASCII". So I took it to the extreme and called something that had 
nothing to do with ASCII a type of ASCII.


As they say, if one has to explain one's jokes then they are probably 
not funny ...


 :(

E.

--
https://mail.python.org/mailman/listinfo/python-list


Django Girls workshop at EuroPython 2016

2016-05-26 Thread M.-A. Lemburg
We’re pleased to announce a Django Girls workshop on Sunday, July 17,
the first day of the EuroPython 2016 conference.

If you want participate or know someone who’d like to join, please
fill in our application form on the Django Girls’ website:


 *** Django Girls EuroPython 2016 ***

   https://djangogirls.org/europython2016/


 Remember: you don’t need any prior programming knowledge to
participate !


About the workshop
--

After the workshop you will have learned about:

 * HTML / CSS
 * Python / Django

and in a single day, you’ll have created a blog.

If that sounds challenging, no worries: our friendly coaches will help
you.

Paola Katherine, DG organizer:

"If you participate, we’ll raffle one full ticket for EuroPython
2016, the largest and best Python event in Europe."


More infos
--

The Django Girls EuroPython 2016 networks:

 * More infos and details on the website: djangogirls.org/europython2016
 * Facebook: fb.me/djangogirlseuropython
 * Twitter: @DjangoGirlsEP16

If you have questions, please write to bil...@djangogirls.org


With gravitational regards,
--
EuroPython 2016 Team
http://ep2016.europython.eu/
http://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/735755247046426624
Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for / while else doesn't make sense

2016-05-26 Thread Marko Rauhamaa
Rustom Mody :

> On Wednesday, May 25, 2016 at 4:18:02 PM UTC+5:30, Marko Rauhamaa wrote:
>> Christopher Reimer:
>> 
>> > Back in the early 1980's, I grew up on 8-bit processors and latin-1 was
>> > all we had for ASCII.
>> 
>> You really were very advanced. According to > https://en.wikipedia.org/wiki/ISO/IEC_8859-1#History>, ISO 8859-1 was
>> standardized in 1985. "Eight-bit-cleanness" became a thing in the early
>> 1990's.
>
> [...]
>
> Thanks to this (sub)thread Ive added a new section: "Lemma: 7=8"
> here http://blog.languager.org/2014/04/unicode-and-unix-assumption.html

A related anecdote from maybe 1990: I worked in a project team. We had
designed a data encoding format that made use of 8-bit character strings
(SunOS 4, Sparc, C). One morning a coworker stated that the standard
library's strcmp() seems to be buggy. He quickly solved the problem by
writing his own strcmp().

I found it surprising that a function so elementary as strcmp() could go
wrong so I took a look at its disassembly. It turns out Sun engineers
had heavily optimized the function. In particular, if both strings were
32-bit-aligned, the loop was carried out using clever 32-bit integer
operations.

Only they had made a mistake. Their algorithm checked these bits of an
integer result:

   3124  16   8   0
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
^ ^   ^   ^

While they *should* have checked these positions:


   3124  16   8   0
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  ^   ^   ^   ^

As a result of their bug, every fourth position of the string had its
high-order bit ignored for strcmp. In particular, '\200' was treated as
an end-of-string marker.

The fix was obvious: check bit 32. However, 32-bit integers don't have a
bit 32, which explains the oversight. Luckily, the 33th bit was readily
available in the CPU's carry flag so the optimization could be salvaged
easily.

I sent a complimentary report to Sun Microsystems' customer service. I
got an email back stating we were out of support and they wouldn't be
talking to us. I thought, ok, their loss, and we went happily forward
with our naïve, two-line strcmp() replacement.

Some three months later, the same customer service rep sent another
email confirming the finding and thanking us for reporting it.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Marko Rauhamaa
Jussi Piitulainen :

> UTF-16 ASCII is weird. Wierd. Probably all right in an environment
> that is otherwise set to use UTF-16.
>
> Nothing is as weird as a mix of different encodings of a foreign
> script in the same "plain text" file, said to be "Unicode". 

Some children are just born under unlucky stars. Windows and Java are
among them. If they had been designed a few years earlier or a few years
later, they could have evaded the UTF-16 embarrassment, maybe the
multithreading embarrassment as well.

Python didn't come out unscathed, either. Multithreading is being
replaced with asyncio, and Python 3 broke backward-compatibility to get
Unicode right.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Chris Angelico
On Thu, May 26, 2016 at 7:11 PM, Marko Rauhamaa  wrote:
> Python didn't come out unscathed, either. Multithreading is being
> replaced with asyncio

Incorrect. Threading is still important - it's not being replaced.
Asynchronous code support is being added to an existing pool of
multiprocessing techniques, so you can now use preemptive processes or
threads, or cooperative asyncio, depending on what you need.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Marko Rauhamaa
Erik :

> To break it down, Stephen was making the observation that people call
> all sorts of extended ASCII encodings (including proprietary things)
> "ASCII". So I took it to the extreme and called something that had
> nothing to do with ASCII a type of ASCII.

ASCII has taken new meanings. For most coders, in relaxed style, it
refers to any byte-oriented character encoding scheme. In C terms,

ASCII == char *


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Django Girls workshop at EuroPython 2016

2016-05-26 Thread Karim



On 26/05/2016 10:58, M.-A. Lemburg wrote:

We’re pleased to announce a Django Girls workshop on Sunday, July 17,
the first day of the EuroPython 2016 conference.

If you want participate or know someone who’d like to join, please
fill in our application form on the Django Girls’ website:


 *** Django Girls EuroPython 2016 ***

   https://djangogirls.org/europython2016/


  Remember: you don’t need any prior programming knowledge to
participate !


About the workshop
--

After the workshop you will have learned about:

  * HTML / CSS
  * Python / Django

and in a single day, you’ll have created a blog.

If that sounds challenging, no worries: our friendly coaches will help
you.

Paola Katherine, DG organizer:

 "If you participate, we’ll raffle one full ticket for EuroPython
 2016, the largest and best Python event in Europe."


More infos
--

The Django Girls EuroPython 2016 networks:

  * More infos and details on the website: djangogirls.org/europython2016
  * Facebook: fb.me/djangogirlseuropython
  * Twitter: @DjangoGirlsEP16

If you have questions, please write to bil...@djangogirls.org


With gravitational regards,
--
EuroPython 2016 Team
http://ep2016.europython.eu/
http://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/735755247046426624
Thanks.


Hello,

This is only for girls?

Regards
KL

--
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Rustom Mody
On Thursday, May 26, 2016 at 1:41:41 PM UTC+5:30, Erik wrote:
> On 26/05/16 02:28, Dennis Lee Bieber wrote:
> > On Wed, 25 May 2016 22:03:34 +0100, Erik
> > declaimed the following:
> >
> >> Indeed - at that time, I was working with COBOL on an IBM S/370. On that
> >> system, we used EBCDIC ASCII. That was the wierdest ASCII of all  ;)
> >>
> > It would have to be... Extended Binary Coded Decimal Interchange Code,
> > as I recall, predates American Standard Code for Information Interchange.
> >
> > EBCDIC's 8-bit code is actually more closely linked to Hollerith card
> > encodings.
> 
> I really didn't think it would be necessary to point this out (I thought 
> the "" and emoji would be enough), but for the record, my 
> previous message was clearly a joke.
> 
> To break it down, Stephen was making the observation that people call 
> all sorts of extended ASCII encodings (including proprietary things) 
> "ASCII". So I took it to the extreme and called something that had 
> nothing to do with ASCII a type of ASCII.
> 
> As they say, if one has to explain one's jokes then they are probably 
> not funny ...

JFTR I found the comment hilarious and even thought of incorporating it into
http://blog.languager.org/2014/04/unicode-and-unix-assumption.html
but could not find a smooth place to do so.
[Mad run: Intensive course to run next week]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python-list Digest, Vol 152, Issue 40

2016-05-26 Thread Noah Fleiszig
thank you

On Thu, May 26, 2016 at 2:00 AM,  wrote:

> Send Python-list mailing list submissions to
> python-list@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.python.org/mailman/listinfo/python-list
> or, via email, send a message with subject or body 'help' to
> python-list-requ...@python.org
>
> You can reach the person managing the list at
> python-list-ow...@python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Python-list digest..."
>
> Today's Topics:
>
>1. html & python connection problem with hyperlinks
>   (litssa2...@gmail.com)
>2. Re: Exended ASCII and code pages [was Re: for / while else
>   doesn't make sense] (Chris Angelico)
>3. Re: for / while else doesn't make sense (Marko Rauhamaa)
>4. Re: Spurious issue in CPython 2.7.5 (thomas povtal.org)
>5. Re: Spurious issue in CPython 2.7.5 (Tim Golden)
>6. Re: for / while else doesn't make sense (Christopher Reimer)
>7. Re: Spurious issue in CPython 2.7.5 (thomas povtal.org)
>8. ValueError: I/O operation on closed file (San)
>9. Re: ValueError: I/O operation on closed file (Joel Goldstick)
>   10. Find the max number of elements in lists as value in a
>   dictionary (Daiyue Weng)
>   11. Re: ValueError: I/O operation on closed file (alister)
>   12. IndexError for using pandas dataframe values (Daiyue Weng)
>   13. Re: Find the max number of elements in lists as value in a
>   dictionary (Jussi Piitulainen)
>   14. Re: Find the max number of elements in lists as value in a
>   dictionary (Jon Ribbens)
>   15. Re: html & python connection problem with hyperlinks
>   (justin walters)
>
>
> -- Forwarded message --
> From: litssa2...@gmail.com
> To: python-list@python.org
> Cc:
> Date: Wed, 25 May 2016 03:24:30 -0700 (PDT)
> Subject: html & python connection problem with hyperlinks
> Why not created the field title, that located on the template
> BusinessList.html as a link to go to Business_Detail.html..? please check
>
> Code:
>
> models. py:
>
> from django.db import models
>
>
> REGIONS = (
> ('ΘΕΣ', 'ΘΕΣΣΑΛΟΝΙΚΗ'),
> ('ΣΕΡ', 'ΣΕΡΡΕΣ'),
> ( 'ΑΘΗ', 'ΑΘΗΝΑ'),
>
>
>
> TYPEOFBUSINESS = (
> ('ΕΣΤ', 'ΕΣΤΙΑΤΟΡΙΑ'),
> ('ΦΑΡ', 'ΦΑΡΜΑΚΕΙΑ'),
> ('ΒΙΒ', 'ΒΙΒΛΙΟΠΩΛΕΙΑ'),
> ( 'ΚΟΜ', 'ΚΟΜΜΩΤΗΡΙΑ'),
> ('ΣΙΝ', 'ΣΙΝΕΜΑ')
>
> )
>
> class Business(models.Model):
> created_Date = models.DateTimeField(auto_now_add=True)
> owner = models.ForeignKey('auth.User', related_name='snippets', null=True)
> title = models.CharField(max_length=100, blank=True, default='')
> Type_of_Business = models.CharField(max_length=3, choices=TYPEOFBUSINESS)
> region = models.CharField(max_length=3, choices=REGIONS)
> address = models.CharField(max_length=100, blank=True, default='')
> phone = models.CharField(max_length=15, blank=True, default='')
> image = models.ImageField(null=True)
>
>
> def __str__(self):
> return str(self.title)
>
> views.py
>
> from django.contrib.auth.models import User
> from django.http import HttpResponse
> from django.shortcuts import render, get_object_or_404
> from rest_framework import filters
> from rest_framework import generics
> from rest_framework import permissions
> from snippets.permissions import IsOwnerOrReadOnly
> from snippets.serializers import SnippetSerializer
> from snippets.serializers import UserSerializer
> from .models import Business
>
>
>
> class UserList(generics.ListAPIView):
> queryset = User.objects.all()
> serializer_class = UserSerializer
>
>
> class UserDetail(generics.RetrieveAPIView):
> queryset = User.objects.all()
> serializer_class = UserSerializer
>
> class BusinessList(generics.ListCreateAPIView):
>
> permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
> queryset = Business.objects.all()
> serializer_class = SnippetSerializer
> filter_backends = (filters.DjangoFilterBackend,filters.SearchFilter,
> filters.OrderingFilter,)
> filter_fields = ('Type_of_Business', 'region')
> search_fields = ('Type_of_Business', 'region')
> ordering_fields = ('Type_of_Business','title', 'region')
>
>
> def BusinessList(request):
> business = Business.objects.all();
> return render(request, 'snippets/BusinessList.html' {'business':business})
>
> def perform_create(self, serializer):
> serializer.save(owner=self.request.user)
>
>
>
> class Business_Detail(generics.RetrieveUpdateDestroyAPIView):
> permission_classes = (permissions.IsAuthenticatedOrReadOnly,
> IsOwnerOrReadOnly,)
> queryset = Business.objects.all()
> serializer_class = SnippetSerializer
>
>
> def Business_Detail(request, pk):
> business = get_object_or_404(Business, pk=pk)
> return render(request, 'snippets/Business_Detail.html', {'business':
> business})
>
> serializers.py
>
> from rest_framework import serializers
> from snippets.models import Business
> from django.contrib.auth.models import User
>
>
> class SnippetSerializer(serializers.HyperlinkedModelSerializer):
> o

Re: Django Girls workshop at EuroPython 2016

2016-05-26 Thread alex wright
From the link:

"If you are a woman, know English and have a laptop you can apply for a
pass!"

So it would appear so.

On Thu, May 26, 2016 at 5:39 AM, Karim  wrote:

>
>
> On 26/05/2016 10:58, M.-A. Lemburg wrote:
>
>> We’re pleased to announce a Django Girls workshop on Sunday, July 17,
>> the first day of the EuroPython 2016 conference.
>>
>> If you want participate or know someone who’d like to join, please
>> fill in our application form on the Django Girls’ website:
>>
>>
>>  *** Django Girls EuroPython 2016 ***
>>
>>https://djangogirls.org/europython2016/
>>
>>
>>   Remember: you don’t need any prior programming knowledge to
>> participate !
>>
>>
>> About the workshop
>> --
>>
>> After the workshop you will have learned about:
>>
>>   * HTML / CSS
>>   * Python / Django
>>
>> and in a single day, you’ll have created a blog.
>>
>> If that sounds challenging, no worries: our friendly coaches will help
>> you.
>>
>> Paola Katherine, DG organizer:
>>
>>  "If you participate, we’ll raffle one full ticket for EuroPython
>>  2016, the largest and best Python event in Europe."
>>
>>
>> More infos
>> --
>>
>> The Django Girls EuroPython 2016 networks:
>>
>>   * More infos and details on the website: djangogirls.org/europython2016
>>   * Facebook: fb.me/djangogirlseuropython
>>   * Twitter: @DjangoGirlsEP16
>>
>> If you have questions, please write to bil...@djangogirls.org
>>
>>
>> With gravitational regards,
>> --
>> EuroPython 2016 Team
>> http://ep2016.europython.eu/
>> http://www.europython-society.org/
>>
>>
>> PS: Please forward or retweet to help us reach all interested parties:
>> https://twitter.com/europython/status/735755247046426624
>> Thanks.
>>
>
> Hello,
>
> This is only for girls?
>
> Regards
> KL
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the
machine wrong figures, will the right answers come out?' I am not able
rightly
to apprehend the kind of confusion of ideas that could provoke such a
question."

-Charles Babbage, 19th century English mathematician, philosopher, inventor
and mechanical engineer who originated the concept of a programmable
computer.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Django Girls workshop at EuroPython 2016

2016-05-26 Thread Karim



On 26/05/2016 15:31, alex wright wrote:

 From the link:

"If you are a woman, know English and have a laptop you can apply for a
pass!"

So it would appear so.

On Thu, May 26, 2016 at 5:39 AM, Karim  wrote:



On 26/05/2016 10:58, M.-A. Lemburg wrote:


We’re pleased to announce a Django Girls workshop on Sunday, July 17,
the first day of the EuroPython 2016 conference.

If you want participate or know someone who’d like to join, please
fill in our application form on the Django Girls’ website:


  *** Django Girls EuroPython 2016 ***

https://djangogirls.org/europython2016/


   Remember: you don’t need any prior programming knowledge to
 participate !


About the workshop
--

After the workshop you will have learned about:

   * HTML / CSS
   * Python / Django

and in a single day, you’ll have created a blog.

If that sounds challenging, no worries: our friendly coaches will help
you.

Paola Katherine, DG organizer:

  "If you participate, we’ll raffle one full ticket for EuroPython
  2016, the largest and best Python event in Europe."


More infos
--

The Django Girls EuroPython 2016 networks:

   * More infos and details on the website: djangogirls.org/europython2016
   * Facebook: fb.me/djangogirlseuropython
   * Twitter: @DjangoGirlsEP16

If you have questions, please write to bil...@djangogirls.org


With gravitational regards,
--
EuroPython 2016 Team
http://ep2016.europython.eu/
http://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/735755247046426624
Thanks.


Hello,

This is only for girls?

Regards
KL

--
https://mail.python.org/mailman/listinfo/python-list






Thank you Alex I missed that.

Regards
KL
--
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Sean Son
Hello all

>From what I can tell from the error message that I received, line 257 of
the util.py script is causing the error.  Here is a link to this script:

https://github.com/mz/androwarn/blob/master/androwarn/util/util.py

I am not a python developer myself, unfortunately, so I have no idea how I
should fix this error.  All help is greatly appreciated!

Thanks

On Tue, May 24, 2016 at 3:46 PM, Sean Son 
wrote:

> Thanks for the reply.
>
> Looks like I am screwed on this one lol
>
> On Tue, May 24, 2016 at 3:31 PM, MRAB  wrote:
>
>> On 2016-05-24 20:04, Sean Son wrote:
>>
>>> hello all
>>>
>>> I am testing out a script called androwarn.py, which I downloaded from:
>>>
>>> https://github.com/mz/androwarn
>>>
>>> using the instructions found on:
>>>
>>> https://github.com/mz/androwarn/wiki/Installation
>>>
>>> When I ran the following commands to test the APK for AirBNB:
>>>
>>>
>>>  python androwarn.py -i SampleApplication/bin/"Airbnb 5.19.0.apk" -v 3 -r
>>> html -n
>>>
>>>
>>> I received the following errors:
>>>
>>> Traceback (most recent call last):
>>>   File "androwarn.py", line 116, in 
>>> main(options, arguments)
>>>   File "androwarn.py", line 99, in main
>>> data = perform_analysis(APK_FILE, a, d, x, no_connection)
>>>   File "/home/dost/androwarn/androwarn/analysis/analysis.py", line 115,
>>> in
>>> perform_analysis
>>> ( 'device_settings_harvesting',
>>> gather_device_settings_harvesting(x) ),
>>>   File
>>>
>>> "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
>>> line 96, in gather_device_settings_harvesting
>>> result.extend( detect_get_package_info(x) )
>>>   File
>>>
>>> "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
>>> line 79, in detect_get_package_info
>>> flags = recover_bitwise_flag_settings(flag,
>>> PackageManager_PackageInfo)
>>>   File "/home/dost/androwarn/androwarn/util/util.py", line 257, in
>>> recover_bitwise_flag_settings
>>> if (int(flag) & option_value) == option_value :
>>> ValueError: invalid literal for int() with base 10:
>>>
>>> 'Lcom/google/android/gms/common/GooglePlayServicesUtil;->zzad(Landroid/content/Context;)V'
>>>
>>>
>>> I am absolutely at a loss as to how I should fix these errors? Anyone
>>> have
>>> any ideas? Sorry for just throwing this at you guys without warning, but
>>> Ive been tasked with fixing this at work and I need assistance please!
>>>
>>> It looks like this issue:
>>
>> https://github.com/mz/androwarn/issues/10
>>
>> dating from 11 Dec 2014 and as yet unanswered.
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Sean Son
Here are the links to the other scripts mentioned in the error messages:

https://github.com/mz/androwarn/blob/master/androwarn/search/malicious_behaviours/device_settings.py

https://github.com/mz/androwarn/blob/master/androwarn/analysis/analysis.py

and the main androwarn.py script:

https://github.com/mz/androwarn/blob/master/androwarn.py

Hopefully those help in any troubleshooting steps that you all recommend to
me!

Thank you!

On Thu, May 26, 2016 at 1:25 PM, Sean Son 
wrote:

> Hello all
>
> From what I can tell from the error message that I received, line 257 of
> the util.py script is causing the error.  Here is a link to this script:
>
> https://github.com/mz/androwarn/blob/master/androwarn/util/util.py
>
> I am not a python developer myself, unfortunately, so I have no idea how I
> should fix this error.  All help is greatly appreciated!
>
> Thanks
>
> On Tue, May 24, 2016 at 3:46 PM, Sean Son <
> linuxmailinglistsem...@gmail.com> wrote:
>
>> Thanks for the reply.
>>
>> Looks like I am screwed on this one lol
>>
>> On Tue, May 24, 2016 at 3:31 PM, MRAB  wrote:
>>
>>> On 2016-05-24 20:04, Sean Son wrote:
>>>
 hello all

 I am testing out a script called androwarn.py, which I downloaded from:

 https://github.com/mz/androwarn

 using the instructions found on:

 https://github.com/mz/androwarn/wiki/Installation

 When I ran the following commands to test the APK for AirBNB:


  python androwarn.py -i SampleApplication/bin/"Airbnb 5.19.0.apk" -v 3
 -r
 html -n


 I received the following errors:

 Traceback (most recent call last):
   File "androwarn.py", line 116, in 
 main(options, arguments)
   File "androwarn.py", line 99, in main
 data = perform_analysis(APK_FILE, a, d, x, no_connection)
   File "/home/dost/androwarn/androwarn/analysis/analysis.py", line 115,
 in
 perform_analysis
 ( 'device_settings_harvesting',
 gather_device_settings_harvesting(x) ),
   File

 "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
 line 96, in gather_device_settings_harvesting
 result.extend( detect_get_package_info(x) )
   File

 "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
 line 79, in detect_get_package_info
 flags = recover_bitwise_flag_settings(flag,
 PackageManager_PackageInfo)
   File "/home/dost/androwarn/androwarn/util/util.py", line 257, in
 recover_bitwise_flag_settings
 if (int(flag) & option_value) == option_value :
 ValueError: invalid literal for int() with base 10:

 'Lcom/google/android/gms/common/GooglePlayServicesUtil;->zzad(Landroid/content/Context;)V'


 I am absolutely at a loss as to how I should fix these errors? Anyone
 have
 any ideas? Sorry for just throwing this at you guys without warning, but
 Ive been tasked with fixing this at work and I need assistance please!

 It looks like this issue:
>>>
>>> https://github.com/mz/androwarn/issues/10
>>>
>>> dating from 11 Dec 2014 and as yet unanswered.
>>>
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Erik

On 26/05/16 10:20, Marko Rauhamaa wrote:

ASCII has taken new meanings. For most coders, in relaxed style, it
refers to any byte-oriented character encoding scheme. In C terms,

 ASCII == char *


Is this really true? So by "taken new meanings" you are saying that it 
has actually lost all meaning.


The 'S' stands for "Standard". It's an encoding (each byte value refers 
to a particular character value according to that standard).


To say that any array of bytes, regardless of what each byte value 
should be interpreted as, is "ASCII" makes no sense.


How "relaxed" are these 'coders' you're referring to, exactly? ;)



Or, have I fallen for your trap, and you're joking with me too?

E.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Erik

On 26/05/16 08:21, Jussi Piitulainen wrote:

UTF-8 ASCII is nice

UTF-16 ASCII is weird.


I am dumbstruck.

E.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Marko Rauhamaa
Erik :

> On 26/05/16 10:20, Marko Rauhamaa wrote:
>> ASCII has taken new meanings. For most coders, in relaxed style, it
>> refers to any byte-oriented character encoding scheme. In C terms,
>>
>>  ASCII == char *
>
> Is this really true? So by "taken new meanings" you are saying that it
> has actually lost all meaning.

You are exaggerating.

> The 'S' stands for "Standard". It's an encoding (each byte value refers
> to a particular character value according to that standard).
>
> To say that any array of bytes, regardless of what each byte value
> should be interpreted as, is "ASCII" makes no sense.

Read what I wrote: "character encoding scheme". Even C's "char" type
strongly suggests textual characters.

However, I must correct myself slightly: ASCII refers to any
byte-oriented character encoding scheme *largely coinciding with ASCII
proper*. But since all of them *are* derivatives of ASCII proper,
mentioning is somewhat redundant.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Michael Torrie
On 05/26/2016 11:31 AM, Sean Son wrote:
> Hopefully those help in any troubleshooting steps that you all recommend to
> me!
> 
> Thank you!

You could try emailing the author who's email address is listed on the
project's main github page.  I suspect the project itself is abandoned.

Was this working before and is no longer working?  What brought about
the change? A new version of Android?  A new version of this program?
Seems like this github project is abandoned and, as you have found,
bitrotting as Android moves on and likely causes incompatibilities with
it as time goes on.

Unless the author can advise you, help may be hard to come by.  The
error itself is simple enough.  But what is feeding bad data to this
function (a string instead of a number) is unknown and would take some
effort to get to the bottom of it, especially by any of us who have
never seen this code before, and many of whom haven't ever worked with
Android before.

If this particular program is critical to your employer's business,
consider offering the original author (or folks on this list) some
payment for the fix.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Michael Torrie
On 05/26/2016 05:57 PM, Michael Torrie wrote:
> You could try emailing the author who's email address is listed on the
> project's main github page.  I suspect the project itself is abandoned.

Ahem. That should have been whose. Sigh.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Steven D'Aprano
On Fri, 27 May 2016 07:12 am, Marko Rauhamaa wrote:

> However, I must correct myself slightly: ASCII refers to any
> byte-oriented character encoding scheme *largely coinciding with ASCII
> proper*. But since all of them *are* derivatives of ASCII proper,
> mentioning is somewhat redundant.

"All" of them?


Here is a small selection of codecs provided by Python:

py> codecs = "cp037 cp273 cp500 cp875 cp1026 cp1140 utf_16be".split()
py> for cd in codecs:
... print("ab.12".encode(cd))  # ASCII gives b'ab.12'
...
b'\x81\x82K\xf1\xf2'
b'\x81\x82K\xf1\xf2'
b'\x81\x82K\xf1\xf2'
b'\x81\x82K\xf1\xf2'
b'\x81\x82K\xf1\xf2'
b'\x81\x82K\xf1\xf2'
b'\x00a\x00b\x00.\x001\x002'


There's also at least one other double-byte character set which, as far as I
can tell, isn't supported by Python: KS X 1001, used in Korea.

Then there are the variable-width encodings which are backwards compatible
with ASCII only in the sense that text containing *only* ASCII characters
uses the same sequence of bytes as ASCII would. But being variable-width,
they cannot be treated as a simple array of bytes with a fixed 1 byte = 1
character mapping. Examples include UTF-8, UTF-7, the various Shift-JIS
encodings, EUC-JP, EUC-KR, EUC-TW, GB18030, Big5, and others.

This concept of ASCII = "all character sets", or "nearly all", or "okay,
maybe not nearly all of them, but just the important ones" is terribly
Euro-centric. The very idea would be laughable in Japan and other East
Asian countries, where Shift-JIS and Big5 still dominate.

So please, open your mind to the reality of computing outside of Europe.
ASCII-based encodings no more encompasses all of the world's natural
languages (not even the "important" ones) than "everyone is using Internet
Explorer and Windows XP, right?" describes the state of the Internet.




-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Jussi Piitulainen
Erik writes:

> On 26/05/16 08:21, Jussi Piitulainen wrote:
>> UTF-8 ASCII is nice
>>
>> UTF-16 ASCII is weird.
>
> I am dumbstruck.

I'm joking, of course.

But those statements do make sense when one knows to distinguish a
character set from its encoding as bytes, and then the UTF-8 encoding of
ASCII really is nice.

Where I live, anyway :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Marko Rauhamaa
Steven D'Aprano :
> This concept of ASCII = "all character sets", or "nearly all", or
> "okay, maybe not nearly all of them, but just the important ones" is
> terribly Euro-centric. The very idea would be laughable in Japan and
> other East Asian countries, where Shift-JIS and Big5 still dominate.

Shift-JIS and Big5 are ASCII derivatives:

   >>> "hello".encode("shift-JIS")
   b'hello'
   >>> "hello".encode("big5")
   b'hello'

> So please, open your mind to the reality of computing outside of
> Europe.

ASCII derivatives are in wide use in the Americas and Antarctica as
well. They have been spotted in Australia, New Zealand, Oceania and
Africa. You shouldn't be surprized if you run into them in Asia, either.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-26 Thread Steven D'Aprano
On Fri, 27 May 2016 04:10 pm, Marko Rauhamaa wrote:

> Steven D'Aprano :
>> This concept of ASCII = "all character sets", or "nearly all", or
>> "okay, maybe not nearly all of them, but just the important ones" is
>> terribly Euro-centric. The very idea would be laughable in Japan and
>> other East Asian countries, where Shift-JIS and Big5 still dominate.
> 
> Shift-JIS and Big5 are ASCII derivatives:

Gosh. Really?

If you looked at what I wrote, I said:

"Then there are the variable-width encodings which are backwards compatible
with ASCII *only* in the sense that text containing only ASCII characters
uses the same sequence of bytes as ASCII would."

and gave both Shift-JIS and Big5 as examples. But you cannot treat them
as "like ASCII" or "extended ASCII" because they are multibyte encodings.

Unlike UTF-8, if you mangle a Shift-JIS or Big5 multibyte sequence, you
don't just corrupt a single character, you corrupt a potentially unlimited
amount of subsequent text.

I don't mind being corrected if I make a genuine mistake, in fact I
appreciate correction. But being corrected for something I already
acknowledged? That's just arguing for the sake of arguing.



[...]
> ASCII derivatives are in wide use in the Americas and Antarctica as
> well. They have been spotted in Australia, New Zealand, Oceania and
> Africa. You shouldn't be surprized if you run into them in Asia, either.

Of course.

But they're not *all encodings*, and while they're important, there are
plenty of non-ASCII encodings and encodings which violate the "one byte
equals one character" invariant followed by ASCII and extended-ASCII
encodings.




-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list