Subject: problem activating python
I tried several times to install and use python for youtube views with Tor using Youtube tutorials but I keep getting error after error. Please help me. regards Dimpho -- https://mail.python.org/mailman/listinfo/python-list
[issue39853] Segmentation fault with urllib.request.urlopen and threads
New submission from Anne Archibald : This was discovered in the astropy test suite, where ThreadPoolExecutor is used to concurrently launch a lot of urllib.request.urlopen. This occurs when the URLs are local files; I'm not sure about other URL schemes. The problem appears to occur in python 3.7 but not python 3.8 or python 3.6 (on a different machine). $ python urllib_segfault.py Linux-5.3.0-29-generic-x86_64-with-Ubuntu-19.10-eoan Python 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0] Segmentation fault (core dumped) $ python3.8 urllib_segfault.py Linux-5.3.0-29-generic-x86_64-with-glibc2.29 Python 3.8.0 (default, Oct 28 2019, 16:14:01) [GCC 9.2.1 20191008] $ python3 urllib_segfault.py Linux-4.15.0-88-generic-x86_64-with-Ubuntu-18.04-bionic Python 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] $ The Astropy bug report: https://github.com/astropy/astropy/issues/10008 -- components: Library (Lib) files: urllib_segfault.py messages: 363374 nosy: Anne Archibald priority: normal severity: normal status: open title: Segmentation fault with urllib.request.urlopen and threads type: crash versions: Python 3.7 Added file: https://bugs.python.org/file48950/urllib_segfault.py ___ Python tracker <https://bugs.python.org/issue39853> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29806] Requesting version info with lowercase -v or -vv causes an import crash
New submission from Anne Moroney: In trying to test the new feature in 3.6.0, $ python -VV # get more info than python -V or python --version I found several oddities. 1.On both Amazon Linux AMI Python 2.7.12 and also Anaconda Python 3.6.0, using lowercase v's causes a crash on some kind of import. 1a.AWS first lines are: [ec2-user@ip-172-31-2-101 ~]$ python -v # installing zipimport hook import zipimport # builtin # installed zipimport hook # /usr/lib64/python2.7/site.pyc matches /usr/lib64/python2.7/site.py import site # precompiled from /usr/lib64/python2.7/site.pyc 1b.Conda first lines are: (py36aws)me:tool-aws me$ python -v import _frozen_importlib # frozen import _imp # builtin import sys # builtin import '_warnings' # //etc 1c.In both cases, after lots of stuff, must quit python with quit() 2.Anaconda does not provide more information. Is that expected? (py36aws) $ python -VV Python 3.6.0 :: Continuum Analytics, Inc. (py36aws)$ python -V Python 3.6.0 :: Continuum Analytics, Inc. (py36aws)$ python --version Python 3.6.0 :: Continuum Analytics, Inc. -- assignee: docs@python components: Documentation messages: 289561 nosy: AnneTheAgile, docs@python priority: normal severity: normal status: open title: Requesting version info with lowercase -v or -vv causes an import crash type: crash versions: Python 2.7, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29806> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11796] Comprehensions in a class definition mostly cannot access class variable
Anne Rosa Wangnick added the comment: With https://bugs.python.org/issue13557 closed, this one should be reopened to amend 6.2.8 Generator expressions: "[However, the leftmost for clause is immediately evaluated] (in the local context)[, so that an error produced by it can be seen ...]" -- nosy: +Anne Rosa Wangnick ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11796> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Writing a function to calculate scores
Hello! I am trying to write a funtion that calculates scores of three random dots on a bean-bag board that land on different holes. Each hole holds a certain amount of point. I need to take where the computer has randomly places three points in my turtle graphic and calculate the total score. I have no idea how to do this. Please help if you can! Its really hard to explain it, but if anyone has the slightest idea please let me know. Thanks! -- https://mail.python.org/mailman/listinfo/python-list
[issue22317] action argument is not documented in argparse add_subparser() docs
Anne Moroney added the comment: This ticket's patch appears to have already been merged, yet it is open? On 2.7.9 docs [1], it has the exact language. The tutorial page [2] has a nice description as well. Finding this ticket really helped me understand argparse a bit better, and now I vote to close :). AnneTheAgile, inspired by CodeTriage 1.[] ; ; ; ; ; ; ; ; ; ; X.15.4. argparse — Parser for command-line options, arguments and sub-commands — Python 2.7.9 documentation https://docs.python.org/2/library action - The basic type of action to be taken when this argument is encountered at the command line. 2.[] ; ; ; ; ; ; ; ; ; ; X.Argparse Tutorial — Python 2.7.9 documentation https://docs.python.org/2/howto/argparse.html we now specify a new keyword, action, and give it the value store_true. This means that, if the option is specified, assign the value True to args.verbose. Not specifying it implies False. 3.[] ; ;List of all types of 'action', including customizable ; ; ; ; ; ; ; ; X.15.4. argparse — Parser for command-line options, arguments and sub-commands — Python 2.7.9 documentation https://docs.python.org/2/library/argparse.html#action action=store_true action='store_false' action=count action='store_const' action='append' action='version' action=CustomFooAction -- nosy: +AnneTheAgile ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22317 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
lists and for loops
I want to add 5 to each element of a list by using a for loop. Why doesn't this work? numbers = [1, 2, 3, 4, 5] for n in numbers: n = n + 5 print numbers -- http://mail.python.org/mailman/listinfo/python-list
What is the encoding of __file__?
Dear all, can someone quickly tell me what the encoding of __file__ is? I can't find it in the documentation. BTW, I'm using Python 2.5.1 on WIndows XP and Vista. Kind regards, Sebastian -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the encoding of __file__?
On 7 Jan., 23:06, Martin v. Löwis [EMAIL PROTECTED] wrote: can someone quickly tell me what the encoding of __file__ is? I can't find it in the documentation. BTW, I'm using Python 2.5.1 on WIndows XP and Vista. It's platform-specific - the same encoding that is used for file names (i.e. sys.getfilesystemencoding()). On Windows, it will be mbcs, which in turn is installation-specific - on Western European/US installations, it's windows-1252. Thanks, I'll then use sys.getfilesystemencoding() to decode _file__ and re-encode into utf-8, which is the default encoding of all strings in our software, as we deal a bit with Chinese terms. Windows-1252 on my box. I just created a directory containing Chinese characters (on Vista), and whoa, files opened with IDLE are empty, import doesn't find modules in that directory. Of course Windows-1252 can't encode these ... But I understand that Python 3 will clean this up? Kind regards, Sebastian -- http://mail.python.org/mailman/listinfo/python-list
Re: Unexpected __metaclass__ method behavior
Well, you see, I have some database functions that deal with things which are either classes or instances thereof. I though polymorphism would be a nice way to handle them identically, like: def do(thing): thing.Foo() do(t) do(Test) But never mind, I now understand that Test.__dict__ can contain only one entry for 'Foo', and that this must be matched. Kind regards, Sebastian -- http://mail.python.org/mailman/listinfo/python-list
Unexpected __metaclass__ method behavior
Dear fellow Pythonians, I just stumbled upon the following unexpected behavior: class TestType(type): def Foo(self): return 'TestType Foo' class Test(object): __metaclass__ = TestType def Foo(self): return 'Test Foo' t = Test() print t.Foo() print Test.Foo() This will produce: Test Foo Traceback (most recent call last): File test.py, line 8, in module print Test.Foo() TypeError: unbound method Foo() must be called with Test instance as first argument (got nothing instead) I can imagine why this is happening, and that there is no easy solution, but it is not what I was expecting. Anybody willing to explain the details of what's exactly going on during the method lookup of Test.Foo? Kind regards, Sebastian -- http://mail.python.org/mailman/listinfo/python-list
Re: BeautifulSoup bug when found in attribute value
Duncan Booth schreef: The / was in the original input that you gave it: param name=movie value=/images/offersBanners/sw04.swf?binfot=We offer fantastic rates for selected weeks or days!!blinkt=Click here linkurl=/Europe/Spain/Madrid/Apartments/Offer/2408 / You don't actually *have* to escape when it appears in html. You don't have to escape it in XML either, except when it's preceded by ]]. As I said before, it looks like BeautifulSoup decided that the tag ended at the first although it took text beyond that up to the closing as the value of the attribute. The remaining text was then simply treated as text content of the unclosed param tag. Finally it inserted a /param to close the unclosed param tag. The param element doesn't have a closing tag. http://www.w3.org/TR/html401/struct/objects.html#h-13.3.2 Mind you, the sentence before that says 'should' for quoting characters which is just plain silly. For quoted attribute values it isn't silly at all. It's actually part of how HTML works. -- Anne van Kesteren http://annevankesteren.nl/ http://www.opera.com/ -- http://mail.python.org/mailman/listinfo/python-list
logging problem
HI All, I am having an app that needs to display a lot of msgs. These msgs need to kept ina log. I have written it as : D EBUG =1 if DEBUG: import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='x.log', filemode='w') def DBG (s): if DEBUG: logging.debug(s) Then whereever i need i tried calling DBG(x) but i am getting error as: Traceback (most recent call last): File C:\Python24\lib\logging\__init__.py, line 712, in emit self.stream.write(fs % msg)ValueError: I/O operation on closed file Can anyone help me..i am new to python so plz help-- Regards,Shine Anne -- http://mail.python.org/mailman/listinfo/python-list
Inconsistency of special class method lookup?
Folks, I'm running into the following issue. A staticmethod of a class seems not to be accepted as a special class method of the class object itself. For example: class Foo(object): def __len__(): return 2 __len__ = staticmethod(__len__) print len(Foo) Traceback (most recent call last): File C:/Dokumente und Einstellungen/All Users/Dokumente/foo.py, line 4, in ? print len(Foo) TypeError: len() of unsized object However, the following works: class FooType(type): def __len__(self): return self.l() class Foo(object): __metaclass__ = FooType def l(): return 3 l = staticmethod(l) print len(Foo) 3 Any good reason why the lookup process doesn't find __len__ as staticmethod of the class? Regards, Sebastian (posting using the account of my wife) -- http://mail.python.org/mailman/listinfo/python-list
Re: Inconsistency of special class method lookup?
Thanks. -- http://mail.python.org/mailman/listinfo/python-list