[issue46376] PyMapping_Check returns 1 for list
Change by Ashley Anderson : -- nosy: +aganders3 ___ Python tracker <https://bugs.python.org/issue46376> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45944] Avoid calling isatty() for most open() calls
New submission from Collin Anderson : isatty() is a system call on linux. Most open()s are files, and we're already getting the size of the file. If it has a size, then we know it's not a atty, and can avoid calling it. -- ___ Python tracker <https://bugs.python.org/issue45944> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45944] Avoid calling isatty() for most open() calls
Change by Collin Anderson : -- keywords: +patch pull_requests: +28096 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29870 ___ Python tracker <https://bugs.python.org/issue45944> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45944] Avoid calling isatty() for most open() calls
Change by Collin Anderson : -- components: IO nosy: collinanderson priority: normal severity: normal status: open title: Avoid calling isatty() for most open() calls type: performance versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue45944> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45894] exception lost when loop.stop() in finally
Amos Anderson added the comment: Ah, thank you, Serhiy. I didn't know that, but I see that in the documentation: https://docs.python.org/3/reference/compound_stmts.html#the-try-statement But what about the 2nd case I presented where a `RuntimeError` was raised? That's the actual case I'm working on. Based on this: > If the finally clause raises another exception, the saved exception is set as > the context of the new exception. My expectation is that the two exceptions would be chained. -- ___ Python tracker <https://bugs.python.org/issue45894> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45894] exception lost when loop.stop() in finally
Amos Anderson added the comment: If I do this instead: ``` try: logger.info("raising exception") raise ValueError("my exception1") finally: logger.info("stopped") loop.stop() await asyncio.sleep(0.5) ``` i.e., do an `await` instead of a `return`, then the original exception is also lost: ``` INFO:root:start DEBUG:asyncio:Using selector: EpollSelector INFO:root:raising exception INFO:root:stopped ERROR:root:Event loop stopped before Future completed. Traceback (most recent call last): File "test.py", line 37, in asyncio.run(another_level()) File "/home/amos/miniconda3/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/home/amos/miniconda3/lib/python3.8/asyncio/base_events.py", line 614, in run_until_complete raise RuntimeError('Event loop stopped before Future completed.') RuntimeError: Event loop stopped before Future completed. INFO:root:done ``` it's also a bit surprising that my handler in `another_level` didn't see either exception, but I'm not really sure what I'd expect in that case. -- ___ Python tracker <https://bugs.python.org/issue45894> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45894] exception lost when loop.stop() in finally
New submission from Amos Anderson : I found a case where an exception is lost if the loop is stopped in a `finally`. ``` import asyncio import logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger() async def method_that_raises(): loop = asyncio.get_event_loop() try: logger.info("raising exception") raise ValueError("my exception1") # except Exception as e: # logger.info("in catcher") # logger.exception(e) # raise finally: logger.info("stopped") loop.stop() # await asyncio.sleep(0.5) return async def another_level(): try: await method_that_raises() except Exception as e: logger.info("trapping from another_level") logger.exception(e) if __name__ == "__main__": logger.info("start") try: asyncio.run(another_level()) except Exception as e: logger.exception(e) logger.info("done") ``` gives this output in python 3.10.0 and 3.8.10 (tested in Ubuntu Windows Subsystem Linux) and 3.8.11 in Windows: ``` INFO:root:start DEBUG:asyncio:Using selector: EpollSelector INFO:root:raising exception INFO:root:stopped INFO:root:done ``` i.e., no evidence an exception was raised (other than the log message included to prove one was raised) If I remove the `return`, then the exception propagates as expected. I believe the exception should be propagated regardless of whether there's a `return` in the `finally` block. -- components: asyncio messages: 406957 nosy: Amos.Anderson, asvetlov, yselivanov priority: normal severity: normal status: open title: exception lost when loop.stop() in finally type: behavior versions: Python 3.10, Python 3.8 ___ Python tracker <https://bugs.python.org/issue45894> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43520] Make Fraction(string) handle non-ascii slashes
Carl Anderson added the comment: >The proposal I like is for a unicode numeric normalization functions that >return the ascii equivalent to exist. @Gregory P. Smith this makes sense to me. That does feel like the cleanest solution. I'm currently doing s = s.replace("⁄","/") but it would be good to have a well-maintained normalization method that contained the all the relevant mappings as an independent preprocess step to Fraction would work well. -- ___ Python tracker <https://bugs.python.org/issue43520> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43520] Make Fraction(string) handle non-ascii slashes
Carl Anderson added the comment: >Carl: can you say more about the problem that motivated this issue? @mark.dickinson I was parsing a large corpus of ingredients strings from web-scraped recipes. My code to interpret strings such as "1/2 cup sugar" would fall over every so often due to this issue as they used fraction slash and other visually similar characters -- ___ Python tracker <https://bugs.python.org/issue43520> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes
Carl Anderson added the comment: I guess if we are doing slashes, then the division sign ÷ (U+00F7) should be included too. There are at least 2 minus signs too (U+002D, U+02D7). -- ___ Python tracker <https://bugs.python.org/issue43520> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes
Carl Anderson added the comment: from https://en.wikipedia.org/wiki/Slash_(punctuation) there is U+002F / SOLIDUS U+2044 ⁄ FRACTION SLASH U+2215 ∕ DIVISION SLASH U+29F8 ⧸ BIG SOLIDUS U+FF0F / FULLWIDTH SOLIDUS (fullwidth version of solidus) U+1F67C VERY HEAVY SOLIDUS In XML and HTML, the slash can also be represented with the character entity or or .[42] there are a couple more listed here: https://unicode-search.net/unicode-namesearch.pl?term=SLASH -- ___ Python tracker <https://bugs.python.org/issue43520> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes
New submission from Carl Anderson : Fraction works with a regular slash: >>> from fractions import Fraction >>> Fraction("1/2") Fraction(1, 2) but there are other similar slashes such as (0x2044) in which it throws an error: >>> Fraction("0⁄2") Traceback (most recent call last): File "", line 1, in File "/opt/anaconda3/lib/python3.7/fractions.py", line 138, in __new__ numerator) ValueError: Invalid literal for Fraction: '0⁄2' This seems to come from the (?:/(?P\d+))? section of the regex _RATIONAL_FORMAT in fractions.py -- components: Library (Lib) messages: 388865 nosy: weightwatchers-carlanderson priority: normal severity: normal status: open title: Fraction only handles regular slashes ("/") and fails with other similar slashes type: enhancement versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue43520> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42917] Block stack size for frame objects should be dynamically sizable
Thomas Anderson added the comment: IIRC, some transpilers for functional languages create deeply nested code. In particular for things like haskell's do notation. Anyway, when I wrote the PR, it was initially to reduce the frame size. Then once I had dynamic block stack sizing working, I realized there was no longer a need to keep the limit of 20 blocks. It was just compile.c that had the artificial limit, so I removed it. I can add the limit back in the PR, but I'm not sure what benefit that would give. -- ___ Python tracker <https://bugs.python.org/issue42917> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43495] Missing frame block push in compiler_async_comprehension_generator()
New submission from Thomas Anderson : The runtime pushes a frame block in SETUP_FINALLY, so the compiler needs to account for that, otherwise the runtime block stack may overflow. -- components: Interpreter Core messages: 388696 nosy: tomkpz priority: normal severity: normal status: open title: Missing frame block push in compiler_async_comprehension_generator() versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue43495> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs
Tore Anderson added the comment: You're right. I got it confused with the conn object in the code I was working on, because it turns out that it has an execute() method: >>> import sqlite3 >>> c = sqlite3.connect('test.db') >>> c.execute('SELECT * FROM tbl') Closing, apologies for the noise! -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue43396> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs
Tore Anderson added the comment: You're looking in the wrong place, the buggy ones are at https://github.com/python/cpython/blame/e161ec5dd7ba9355eb06757b9304019ac53cdf69/Doc/library/sqlite3.rst#L74-L76 Tore -- ___ Python tracker <https://bugs.python.org/issue43396> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs
New submission from Tore Anderson : In https://docs.python.org/3/library/sqlite3.html, the following example code is found: > # Do this instead > t = ('RHAT',) > c.execute('SELECT * FROM stocks WHERE symbol=?', t) > print(c.fetchone()) However this fails as follows: > Traceback (most recent call last): > File "./test.py", line 8, in > print(c.fetchone()) > AttributeError: 'sqlite3.Connection' object has no attribute 'fetchone' I believe the correct code should have been (at least it works for me): > # Do this instead > t = ('RHAT',) > cursor = c.execute('SELECT * FROM stocks WHERE symbol=?', t) > print(cursor.fetchone()) Tore -- assignee: docs@python components: Documentation messages: 388078 nosy: docs@python, toreanderson priority: normal severity: normal status: open title: Non-existent method sqlite3.Connection.fetchone() used in docs versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43396> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
IDLE
Hi, I hope you are having a good day. I have a small IDLE problem and can’t seem to fix it. I have a .py file that I want to open using IDLE but there is no option I have even tried totally wiping python and reinstalling it nothing seems to work. Please help. Will Anderson [1]andersonwill...@gmail.com [2]Website References Visible links 1. mailto:andersonwill...@gmail.com 2. https://sites.google.com/view/willanderson/home -- https://mail.python.org/mailman/listinfo/python-list
[issue42917] Block stack size for frame objects should be dynamically sizable
Thomas Anderson added the comment: > Reducing the size of the frame object seems like a worthwhile goal, but > what's the point in increasing the maximum block stack? No point for humans, but it may be useful for code generators. -- ___ Python tracker <https://bugs.python.org/issue42917> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42917] Block stack size for frame objects should be dynamically sizable
New submission from Thomas Anderson : Currently the block stack size is hardcoded to 20. Similar to how the value stack is dynamically sizable, we should make the block stack dynamically sizable. This will reduce space on average (since the typical number of blocks for a function is well below 20) and allow code generators to generate code with more deep nesting. Note: the motivation is not necessarily to reduce memory usage, but to make L1 cache misses less likely for stack objects. -- components: Interpreter Core messages: 384991 nosy: tomkpz priority: normal severity: normal status: open title: Block stack size for frame objects should be dynamically sizable type: enhancement versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue42917> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38295] test_relative_path of test_py_compile fails on macOS 10.15 Catalina
Bo Anderson added the comment: > You don't even need a C program to reproduce Indeed, touch is built upon the POSIX file API (unless Apple modified it). The idea for the Apple bug report was to show it happening at a low level and not specific to a given tool. > And the "cd" is optional, I get the same error from my home directory Yes, /private/tmp is just an example but I'd be cautious saying the same happens everywhere. You won't be able to reproduce the issue if your current directory is /usr. /private/tmp, your home directory, etc. are all "firmlinked" to /System/Volumes/Data in Catalina. /System/Volumes/Data/private/tmp exists but /System/Volumes/Data/tmp doesn't exist. This shouldn't really be an issue as the idea of firmlinks is to make the /System/Volumes/Data invisible and thus you should be able to relatively go back up to the /System/Volumes/Data and be transported back to the root directory, where you can find the /tmp symlink (and indeed that works fine with `ls`). Evidently that doesn't seem to work properly for file operations. -- ___ Python tracker <https://bugs.python.org/issue38295> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38295] test_relative_path of test_py_compile fails on macOS 10.15 Catalina
Bo Anderson added the comment: Indeed. The issue can be trivially reproduced with: ``` #include #include #include #include int main() { char buf[255]; printf("Current dir: %s\n", getcwd(buf, 255)); int fd = open("../../tmp/test.txt", O_WRONLY | O_CREAT); if (fd < 0) { printf("errno %d\n", errno); return 1; } close(fd); printf("Success\n"); return 0; } ``` and running it in /private/tmp. I filed FB7467762 at the end of November. Downstream projects meanwhile are working around the issue by resolving the file path before passing it into `open`. -- ___ Python tracker <https://bugs.python.org/issue38295> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38295] test_relative_path of test_py_compile fails on macOS 10.15 Catalina
Bo Anderson added the comment: For what it's worth, this is having an impact on some real code: https://github.com/Homebrew/homebrew-core/pull/45110 Perhaps a simpler way to reproduce is: % cd /tmp % python3 -c 'import os; open(os.path.relpath("/tmp/test.txt"), "w")' Traceback (most recent call last): File "", line 1, in FileNotFoundError: [Errno 2] No such file or directory: '../../tmp/test.txt' -- nosy: +Bo98 ___ Python tracker <https://bugs.python.org/issue38295> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38833] Issue with multiprocessing.Pool & multiprocessing.Queue
New submission from Charles Anderson : When calling mp.Pool().apply_async(), and passing a mp.Queue() instance as an argument the execution halts. This is contrasted by using mp.Manager().Queue() which when passed to apply_async() works as expected. -- components: Library (Lib) files: python_mp_pool_queue_issue.py messages: 356822 nosy: bigbizze priority: normal severity: normal status: open title: Issue with multiprocessing.Pool & multiprocessing.Queue type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file48719/python_mp_pool_queue_issue.py ___ Python tracker <https://bugs.python.org/issue38833> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1154351] add get_current_dir_name() to os module
Change by Marc Adam Anderson : -- nosy: -marcadam ___ Python tracker <https://bugs.python.org/issue1154351> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34510] Add add HTTPConnection.settimeout()
Change by Collin Anderson : -- components: Library (Lib) nosy: collinanderson priority: normal pull_requests: 8422 severity: normal status: open title: Add add HTTPConnection.settimeout() type: enhancement ___ Python tracker <https://bugs.python.org/issue34510> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32151] -mvenv vs minor python version updates
Ric Anderson <azri...@gmail.com> added the comment: well then, I guess y'all can close this ticket -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32151> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32151] -mvenv vs minor python version updates
Ric Anderson <azri...@gmail.com> added the comment: Okay, are virtual env's expected to not be compatible as well? E.g., I built a venv under 3.5; venv copied in the 3.5 python executable, but not the needed library; should not -mvenv also copy libpython3.5 into the virutal setup or at least include the LD_LIBRARY_PATH to libpython3.5 in bin/activate, so that myenv/bin/python3.5 can find its needed library? -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32151> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32151] -mvenv vs minor python version updates
New submission from Ric Anderson <azri...@gmail.com>: When a site updates python3 from 3.5 to 3.6 (based on https://docs.python.org/3/faq/general.html#how-does-the-python-version-numbering-scheme-work, this is would be a minor version update),pre-upgrade venv setups created with "python3 -menv ..." break because "python3" in the venv is really 3.5, and needs the system libpython3.5m.so.1.0, which is no longer in the library search list. Should "python -mvenv ..." copy the libpython3.5m.so.1.0 to the venv directory/lib, or add the system path to libpython3.5m.so.1.0 to LD_LIBRARY_PATH, or should the minor version number (.5 ,or .6) be excluded from the library name, so that minor version updates don't break existing venv setups or ??? -- components: Installation, Interpreter Core, Library (Lib) messages: 307072 nosy: Ric Anderson priority: normal severity: normal status: open title: -mvenv vs minor python version updates type: behavior versions: Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32151> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30829] 'Cannot serialize socket object' after ssl.wrap_socket
Changes by Anderson <anders...@gmail.com>: -- title: 'Cannot serialize socket object' after ssl_wrap -> 'Cannot serialize socket object' after ssl.wrap_socket ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30829> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30829] 'Cannot serialize socket object' after ssl_wrap
New submission from Anderson: --- Traceback (most recent call last): File "/usr/local/lib/python3.6/socketserver.py", line 317, in _handle_request_noblock self.process_request(request, client_address) File "/opt/storage_server/server_tcp.py", line 121, in process_request self.pipes[self.proc_turn][1].send((request, client_address)) File "/usr/local/lib/python3.6/multiprocessing/connection.py", line 206, in send self._send_bytes(_ForkingPickler.dumps(obj)) File "/usr/local/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) File "/usr/local/lib/python3.6/socket.py", line 185, in __getstate__ raise TypeError("Cannot serialize socket object") TypeError: Cannot serialize socket object --- I am trying to send a ssl wrapped socket object (server side) into a pipe to another process using multiprocessing. Btw, without ssl_wrap it works. Basically this: newsocket, fromaddr = self.socket.accept() connstream = ssl.wrap_socket(newsocket, server_side=True, certfile=self.certfile, keyfile=self.keyfile) pipe = multiprocessing.Pipe() proc = multiprocessing.Process(target=proc_run, args=(pipe[0],), daemon=False) proc.start() #Error here pipe[1].send((connstream, fromaddr)) I am sorry if this is intentional. -- assignee: christian.heimes components: SSL messages: 297526 nosy: Anderseta, christian.heimes priority: normal severity: normal status: open title: 'Cannot serialize socket object' after ssl_wrap versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30829> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29574] python-3.6.0.tgz permissions borked
Dave Anderson added the comment: Sorry, should have shown sudo ls -l output for 3.6: [vagrant@developer tmp]$ sudo ls -l Python-3.6.0 total 1016 -rw-r--r-- 1 caturra games 10910 Dec 22 18:21 aclocal.m4 -rwxr-xr-x 1 caturra games 42856 Dec 22 18:21 config.guess -rwxr-xr-x 1 caturra games 35740 Dec 22 18:21 config.sub -rwxr-xr-x 1 caturra games 481627 Dec 22 18:21 configure -rw-r--r-- 1 caturra games 158661 Dec 22 18:21 configure.ac drwxr--r-- 18 caturra games 4096 Dec 22 18:23 Doc drwxr--r-- 2 caturra games 4096 Dec 22 18:21 Grammar drwxr--r-- 2 caturra games 4096 Dec 22 18:21 Include -rwxr-xr-x 1 caturra games 7122 Dec 22 18:21 install-sh drwxr--r-- 33 caturra games 4096 Dec 22 18:21 Lib -rw-r--r-- 1 caturra games 12767 Dec 22 18:21 LICENSE drwxr--r-- 8 caturra games 4096 Dec 22 18:21 Mac -rw-r--r-- 1 caturra games 58829 Dec 22 18:21 Makefile.pre.in drwxr--r-- 2 caturra games 4096 Dec 22 18:21 Misc drwxr--r-- 13 caturra games 4096 Dec 22 18:21 Modules drwxr--r-- 4 caturra games 4096 Dec 22 18:21 Objects drwxr--r-- 2 caturra games 4096 Dec 22 18:21 Parser drwxr--r-- 5 caturra games 4096 Dec 22 18:21 PC drwxr--r-- 2 caturra games 4096 Dec 22 18:21 PCbuild drwxr--r-- 2 caturra games 4096 Dec 22 18:21 Programs -rw-r--r-- 1 caturra games 41250 Dec 22 18:21 pyconfig.h.in drwxr--r-- 3 caturra games 4096 Dec 22 18:21 Python -rw-r--r-- 1 caturra games 8434 Dec 22 18:21 README -rw-r--r-- 1 caturra games 101041 Dec 22 18:21 setup.py drwxr--r-- 24 caturra games 4096 Dec 22 18:21 Tools [vagrant@developer tmp]$ -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29574> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29574] python-3.6.0.tgz permissions borked
New submission from Dave Anderson: Downloaded https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz Extracted on CentOS6 with sudo tar -xf Python-3.6.0.tgz Result: [vagrant@developer tmp]$ ls -l Python-3.6.0 ls: cannot access Python-3.6.0/Tools: Permission denied ls: cannot access Python-3.6.0/config.guess: Permission denied ls: cannot access Python-3.6.0/pyconfig.h.in: Permission denied ls: cannot access Python-3.6.0/config.sub: Permission denied ls: cannot access Python-3.6.0/configure.ac: Permission denied ls: cannot access Python-3.6.0/Python: Permission denied ls: cannot access Python-3.6.0/Objects: Permission denied ls: cannot access Python-3.6.0/PCbuild: Permission denied ls: cannot access Python-3.6.0/Include: Permission denied ls: cannot access Python-3.6.0/aclocal.m4: Permission denied ls: cannot access Python-3.6.0/configure: Permission denied ls: cannot access Python-3.6.0/Misc: Permission denied ls: cannot access Python-3.6.0/Makefile.pre.in: Permission denied ls: cannot access Python-3.6.0/setup.py: Permission denied ls: cannot access Python-3.6.0/Lib: Permission denied ls: cannot access Python-3.6.0/PC: Permission denied ls: cannot access Python-3.6.0/Doc: Permission denied ls: cannot access Python-3.6.0/README: Permission denied ls: cannot access Python-3.6.0/Programs: Permission denied ls: cannot access Python-3.6.0/install-sh: Permission denied ls: cannot access Python-3.6.0/LICENSE: Permission denied ls: cannot access Python-3.6.0/Modules: Permission denied ls: cannot access Python-3.6.0/Grammar: Permission denied ls: cannot access Python-3.6.0/Parser: Permission denied ls: cannot access Python-3.6.0/Mac: Permission denied total 0 -? ? ? ? ?? aclocal.m4 -? ? ? ? ?? config.guess -? ? ? ? ?? config.sub -? ? ? ? ?? configure -? ? ? ? ?? configure.ac d? ? ? ? ?? Doc d? ? ? ? ?? Grammar d? ? ? ? ?? Include -? ? ? ? ?? install-sh d? ? ? ? ?? Lib -? ? ? ? ?? LICENSE d? ? ? ? ?? Mac -? ? ? ? ?? Makefile.pre.in d? ? ? ? ?? Misc d? ? ? ? ?? Modules d? ? ? ? ?? Objects d? ? ? ? ?? Parser d? ? ? ? ?? PC d? ? ? ? ?? PCbuild d? ? ? ? ?? Programs -? ? ? ? ?? pyconfig.h.in d? ? ? ? ?? Python -? ? ? ? ?? README -? ? ? ? ?? setup.py d? ? ? ? ?? Tools [vagrant@developer tmp]$ Same operation with Python 3.5.2 tgz file downloaded from same location: [vagrant@developer tmp]$ ls -l Python-3.5.2 total 1008 -rw-r--r-- 1 1000 1000 8464 Jun 25 2016 aclocal.m4 -rwxr-xr-x 1 1000 1000 42856 Jun 25 2016 config.guess -rwxr-xr-x 1 1000 1000 35740 Jun 25 2016 config.sub -rwxr-xr-x 1 1000 1000 474932 Jun 25 2016 configure -rw-r--r-- 1 1000 1000 155069 Jun 25 2016 configure.ac drwxrwxr-x 18 1000 1000 4096 Jun 25 2016 Doc drwxrwxr-x 2 1000 1000 4096 Jun 25 2016 Grammar drwxrwxr-x 2 1000 1000 4096 Jun 25 2016 Include -rwxr-xr-x 1 1000 1000 7122 Jun 25 2016 install-sh drwxrwxr-x 46 1000 1000 12288 Jun 25 2016 Lib -rw-r--r-- 1 1000 1000 12767 Jun 25 2016 LICENSE drwxrwxr-x 8 1000 1000 4096 Jun 25 2016 Mac -rw-r--r-- 1 1000 1000 58449 Jun 25 2016 Makefile.pre.in drwxrwxr-x 2 1000 1000 4096 Jun 25 2016 Misc drwxrwxr-x 11 1000 1000 4096 Jun 25 2016 Modules drwxrwxr-x 4 1000 1000 4096 Jun 25 2016 Objects drwxrwxr-x 2 1000 1000 4096 Jun 25 2016 Parser drwxrwxr-x 4 1000 1000 4096 Jun 25 2016 PC drwxrwxr-x 2 1000 1000 4096 Jun 25 2016 PCbuild drwxrwxr-x 2 1000 1000 4096 Jun 25 2016 Programs -rw-r--r-- 1 1000 1000 41897 Jun 25 2016 pyconfig.h.in drwxrwxr-x 3 1000 1000 4096 Jun 25 2016 Python -rw-r--r-- 1 1000 1000 8060 Jun 25 2016 README -rw-r--r-- 1 1000 1000 99778 Jun 25 2016 setup.py drwxrwxr-x 22 1000 1000 4096 Jun 25 2016 Tools [vagrant@developer tmp]$ -- components: Build messages: 287891 nosy: Dave_Anderson priority: normal severity: normal status: open title: python-3.6.0.tgz permissions borked versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29574> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26688] unittest2 referenced in unittest.mock documentation
New submission from Ashley Anderson: I noticed a few references to `unittest2` in the documentation in the `unittest.mock` "getting started" section: https://docs.python.org/3.6/library/unittest.mock-examples.html#patch-decorators I am attaching a patch that just changes these occurrences from `unittest2` to `unittest`. -- assignee: docs@python components: Documentation files: unittest2.patch keywords: patch messages: 262767 nosy: aganders3, docs@python priority: normal severity: normal status: open title: unittest2 referenced in unittest.mock documentation versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file42346/unittest2.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26688> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Not downloading
Dear Python, After a workshop in my school today regarding python, i have downloaded it on my laptop however when i go to launch it, it either tells me to modify python, repair python or uninstall python. It will not let me go onto python at all. I do not know what is going on and i hope yourselves can help me. Thankyou -- https://mail.python.org/mailman/listinfo/python-list
[issue25228] Regression in cookie parsing with brackets and quotes
Collin Anderson added the comment: It should be safe to hard split on semicolon. `name="some;value"` is not valid, even though it's quoted. I think raw double quotes, commas, semicolons and backslashes are _always_ invalid characters in cookie values. >From https://tools.ietf.org/html/rfc6265: {{{ cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E ; US-ASCII characters excluding CTLs, ; whitespace DQUOTE, comma, semicolon, ; and backslash }}} -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25228] Regression in cookie parsing with brackets and quotes
Collin Anderson added the comment: The issue I'm currently running into, is that although browsers correctly ignore invalid Set-Cookie values, they allow 'any CHAR except CTLs or ";"' in cookie values set via document.cookie. So, if you say document.cookie = 'key=va"lue; path=/', the browser will happily pass 'key=va"lue;' to the server on future requests. So, I like the behavior of this patch, which skips over these invalid cookies and continues parsing. I've cleaned the patch up a little, but it should be the same logically. -- nosy: +collinanderson Added file: http://bugs.python.org/file41889/cookie-bracket-quotes.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %G, %V and %u directives
Changes by Ashley Anderson <agande...@gmail.com>: Added file: http://bugs.python.org/file40660/issue12006_10_complete.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %G, %V and %u directives
Ashley Anderson added the comment: Another *ping* for a patch review since it's been almost a month since the last one. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %G, %V and %u directives
Ashley Anderson added the comment: Thanks Alexander, but I think the latest patch is still mine. It seems strange to review my own patch. I'll do it if that's common, but since this will (hopefully, eventually) be my first accepted patch I would appreciate the feedback from another reviewer. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %G, %V and %u directives
Ashley Anderson added the comment: Haha, thanks Erik. It seems you know my tastes enough to not offer a chocolate-based reward. =) I was actually set to "ping" to request a patch review today, as it's been one month since my last submission. Please let me know if I need to update the patch against the current `tip`. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %G, %V and %u directives
Ashley Anderson added the comment: Thanks for the review and the good suggestions. Hopefully this new patch is an improvement. I didn't know about the context manager for assertRaises - I was just following the format for another ValueError test a few lines above. The frozenset and re-wrapped comment were left from playing around with another way to do the checks, and I've corrected them. I think the conditionals around calculating the julian and year are clearer now as well. Please (obviously) let me know if there are further changes. Also please let me know if this is not the proper way to respond to the code review! -- Added file: http://bugs.python.org/file40113/issue12006_8_complete.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %G, %V and %u directives
Ashley Anderson added the comment: Here is an updated patch with implementation as outlined in msg247525. -- Added file: http://bugs.python.org/file40085/issue12006_7_complete.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %G, %V and %u directives
Ashley Anderson added the comment: Wow, I can't believe this issue is so old now! I'm motivated to finally come back and address the remaining issues to get this merged. Sorry for seemingly abandoning this; I'm embarrassed I didn't push to finish it earlier. It sounds like the consensus is to raise a ValueError in cases where ambiguity may arise, with specific suggestions for resolving the ambiguity in each case. This is in contrast to certain other cases where strptime uses some default value for missing data (e.g. month/day = 1, year = 1900). Ambiguous or incomplete cases I have identified are: 1. ISO week (%V) is specified, but the year is specified with %Y instead of %G 2. ISO year (%G) and ISO week (%V) are specified, but a weekday is not 3. ISO year (%G) and weekday are specified, but ISO week (%V) is not 4. ISO year is specified alone (e.g. time.strptime('2015', '%G')) 5. Julian/ordinal day (%j) is specified with %G, but not %Y Hopefully that covers it...let me know if I need to add any cases or change behavior in any cases. I can have a patch (at least an initial attempt) ready for this in the next few days. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23933] Struct module should acept arrays
New submission from Anderson: Correct me if I'm wrong, the struct module does not work with array of ints, floats etc (just work with char in the form of strings). I think it should since this are valid elements in C structs. More specifically, consider I have this C struct struct{ int array[4]; }; I'm forced to do something like this: struct.pack('', v1,v2,v3,v4) #'4i' is just the same as '' I would like to do something like this: struct.pack('i[4]', [v1,v2,v3,v4]) Of course this is useful if I want to pack with zeros: struct.pack('i[4]', [0]*4) -- messages: 240610 nosy: gamaanderson priority: normal severity: normal status: open title: Struct module should acept arrays type: enhancement versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23933] Struct module should acept arrays
Anderson added the comment: @wolma, That would work in this simple example. But in a more complicated case this became inconvenient. Actually I'm working with reading and writing in python an extremely C-oriented file-type (MDV). For that I represent C-structs as python dics (e.q {array:[v1,v2,v3,v4]}), and because of this lack of arrays I'm forced to keep track if a key represents a single value or an array. It works, but I think everyone would benefit if struct could handle that simple task. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23038] #python.web irc channel is dead
New submission from Collin Anderson: Can we remove references to #python.web? I assume it was a flourishing channel at some point. https://docs.python.org/3/howto/webservers.html#other-notable-frameworks -- assignee: docs@python components: Documentation messages: 232550 nosy: collinanderson, docs@python priority: normal severity: normal status: open title: #python.web irc channel is dead versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23038 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20805] Error in 3.3 Tutorial
New submission from Gene Anderson: In the tutorial for Python 3.3 the content for 9.3.4 Method Objects seems to have an error. In the following lines: xf = x.f while True: print(xf()) ... it seems to me that based on the x object's method f(), the command should be print(x.f()) At least it did when I tried to run it without the endless loop. I'm pretty new at this Python stuff, though, so I could be wrong. -- messages: 212421 nosy: Andesheng priority: normal severity: normal status: open title: Error in 3.3 Tutorial versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20805 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20805] Error in 3.3 Tutorial
Gene Anderson added the comment: I failed to mention that the associated web address for the documentation is: http://docs.python.org/3.3/tutorial/classes.html#method-objects -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20805 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Can anyone help on conflicts between Python 2.5 and 2.7
I maintain a Delphi program, AAA, that runs Python 2.5 scripts using the PythonForDelphi (P4D)interface. I can install both Python 2.5 and Python 2.7 on my computer and AAA is unaffected. However one user of AAA uses another program, BBB, that requires Python 2.7. When they run AAA, an error is generated that suggests that AAA has been directed to the Python 2.7 libraries. The specific error is identified in Python27\lib\linecache.py line 127 with open(fullname, 'rU') as fp: as compared with Python25\lib\linecache.py line 128 fp = open(fullname, 'rU') It appears that the BBB program installs Python 2.7 to be the default Python version, although I do not know how this is done. Assuming BBB cannot be changed, I would like to know how I can modify AAA so that it ignores any default settings and simply runs Python 2.5. Regards Errol Anderson -- https://mail.python.org/mailman/listinfo/python-list
Python with Delphi
Is there anyone out there who uses Python with Delphi, or knows someone who uses Python with Delphi or who used to use Python with Delphi? The latest version of Python for Delphi (P4D) works fine with Python 2.5 and Delphi 2007, but not for Python 2.7. Any assistance gratefully received. Errol Anderson -- https://mail.python.org/mailman/listinfo/python-list
Python for Delphi' Assistance
The Delphi program I maintain uses 'Python for Delphi' to run Python scripts within the program. The latest version of 'Python for Delphi' appears to stop at Delphi 2006 with Python 2.5, while I would like to run Delphi 2007 with Python 2.7. Are there any 'Python for Delphi' users out there who could help me. Best regards Errol Anderson -- https://mail.python.org/mailman/listinfo/python-list
Conflict between Python 2.5 and 2.7
I look after a Delphi program that uses Python 2.5 (via Python for Delphi). A customer who uses a modeling program that requires Python 2.7 experiences a Python conflict when trying to run the Delphi program. I have installed both Python 2.5 and 2.7 on a test-bed computer and can run the Delphi program. I have searched the FAQ, and have found some mention of being able to set a default Python version when installing, which I presume has occurred when the customer installed Python 2.7, so that the Delphi program is being directed to Python 2.7. However, I do not see this option when I install Python 2.7, and I do not see how to remove this option so I can advise the customer what to do. The programs are running under Windows 7 - 32-bit. Any assistance gratefully received. Best regards Errol Anderson -- https://mail.python.org/mailman/listinfo/python-list
[issue1154351] add get_current_dir_name() to os module
Marc Adam Anderson added the comment: This enhancement has been implemented. The code is based on hoffman's code. Tests for this enhancement, as well as tests for os.getcwd() have also been added. The docs have been updated and tested locally. -- keywords: +patch nosy: +marcadam Added file: http://bugs.python.org/file29522/get_current_dir_name.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1154351 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5993] python produces zombie in webbrowser.open
Marc Adam Anderson added the comment: Unable to reproduce this bug on Mac OS X 10.8.3 (12D78) using Python 3.4.0a0 and the following browsers: - Google Chrome 25.0.1364.172 - Firefox 13.0.1 - Safari 6.0.3 (8536.28.10) -- nosy: +marcadam ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8862] curses.wrapper does not restore terminal if curses.getkey() gets KeyboardInterrupt
Marc Adam Anderson added the comment: Tested patch using Python 3.4.0a0 on Mac OS X 10.8.3 (12D78). Patch appears to fix the bug. -- nosy: +marcadam ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8862 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: Attaching a patch for the documentation just in time for the weekend! -- Added file: http://bugs.python.org/file22240/12006_doc.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Nacked Girls HD Wallpapers
http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://cutehotestgirls.blogspot.com/ http://www.newfunmaza.com http://www.newfunmaza.com http://www.newfunmaza.com http://www.newfunmaza.com -- http://mail.python.org/mailman/listinfo/python-list
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: When trying to add cases for %V and %u in the tests, I ran into an issue of year ambiguity. The problem comes when the ISO year does not match the Gregorian year for a given date. I think this should be fixed by implementing the %G directive (ISO year, which is present in strftime) as well. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: The example that triggered the issue in testing was January 1, 1905. The ISO date for this day is 1904 52 7. This is reported correctly if you use datetime.isocalendar() or datetime.strftime('%G'), but you get 1905 if you use datetime.strftime('%Y'). When it's read back in it causes the test to fail because ISO '1904 52 7' is different from ISO '1905 52 7'. Likewise if you consider a year starting on a Tuesday, Wednesday, or Thursday, there will be several days at the end of the previous year that will have an ISO year ahead of their Gregorian representation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: I disagree, I think %G is necessary in strptime(). Take Monday, December 31, 2001 as an example. The ISO date is 2002 01 1. Now, given only the Gregorian year (2001) for this date, and the ISO week and weekday (01 1), there is an ambiguity with Monday, January 1, 2001, which has an ISO date of 2001 01 1. The ISO week/weekday combination of (01 1) occurs twice in the year 2001, and can only be differentiated by the corresponding ISO year. We can, of course, debate on what the behavior in this case should be. The way I see it, we can: 1) Assume the year taken in by %Y is equivalent to the ISO year, which it often is. Assuming %Y is the ISO year IFF %V is used accomplishes the same result. 2) Default the year to some value, currently 1900 is used when %Y is absent. This is how it is handled now. 3) Report an error/exception that insufficient data was provided, and maybe mention %G should be used instead of %Y for this case. I'm attaching a patch now that includes some minor changes, includes %G and adds some tests. I am also working on the documentation but it's not quite ready. -- Added file: http://bugs.python.org/file22137/12006_3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: OK, here is my second attempt. I think it functions as desired, but a code review may reveal flaws in my implementation. I'm sure there are associated tests and documentation to write, but I have basically no experience with that yet. If this looks like the right direction, I can take it to the python-mentors list for help with the test/docs. -- Added file: http://bugs.python.org/file22113/12006_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Changes by Ashley Anderson agande...@gmail.com: Removed file: http://bugs.python.org/file22101/12006.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: Thanks everyone, please take your time if there are more pressing issues; I'll get to work on tests and documentation in the mean time. I agree that '_calc_julian_from_V' is a bit strange. I was mimicking a similar helper function's name ('_calc_julian_from_U_or_W'), but perhaps that is no defense. Also, I know the functionality is there with 'toisocalendar' and 'toisoweekday', but maybe %V and %u should be implemented for 'strftime' for completeness. Any thoughts? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Changes by Ashley Anderson agande...@gmail.com: -- nosy: +Ashley.Anderson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: I've recently joined the python-mentors mailing list because I love Python and want to get involved. I found this bug in the list of Easy issues and thought I'd try my hand. Anyway, this is my first patch, so please forgive me if I am breaking protocol or stepping on anyone's toes here. I also hope my code isn't embarrassing. This adds a constructor to the date class that allows construction based on an ISO-8601 WWD string. Does this address the issue in a logical way? -- keywords: +patch Added file: http://bugs.python.org/file22101/12006.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12006] strptime should implement %V or %u directive from libc
Ashley Anderson agande...@gmail.com added the comment: Thanks, I think I understand the original post now. Upon reading the docs and code, however, it seems this is possible using the %W and %w directives. Is the issue just to support the different letters (%V and %u) specifically, or that they are not quite the same format as the corresponding ISO numbers? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12006 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
USA Free classified site for free ad posting !!!
We are providing free services for all !!! Guys, are you looking for having nice opportunity to post or submit your advertisement without any impediments! Just visit and get gigantic chance to give free advertisement in our here !!! Just visit at: http://www.webadlist.com/ -- http://mail.python.org/mailman/listinfo/python-list
Nothing to repeat
Hello everyone, long time no see, This is probably not a Python problem, but rather a regular expressions problem. I want, for the sake of arguments, to match strings comprising any number of occurrences of 'spa', each interspersed by any number of occurrences of the 'm'. 'any number' includes zero, so the whole pattern should match the empty string. Here's the conversation Python and i had about it: Python 2.6.4 (r264:75706, Jun 4 2010, 18:20:16) [GCC 4.4.4 20100503 (Red Hat 4.4.4-2)] on linux2 Type help, copyright, credits or license for more information. import re re.compile((spa|m*)*) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.6/re.py, line 190, in compile return _compile(pattern, flags) File /usr/lib/python2.6/re.py, line 245, in _compile raise error, v # invalid expression sre_constants.error: nothing to repeat What's going on here? Why is there nothing to repeat? Is the problem having one *'d term inside another? Now, i could actually rewrite this particular pattern as '(spa|m)*'. But what i neglected to mention above is that i'm actually generating patterns from structures of objects (representations of XML DTDs, as it happens), and as it stands, patterns like this are a possibility. Any thoughts on what i should do? Do i have to bite the bullet and apply some cleverness in my pattern generation to avoid situations like this? Thanks, tom -- If it ain't broke, open it up and see what makes it so bloody special. -- http://mail.python.org/mailman/listinfo/python-list
[issue3646] MacOS X framework install to non-standard directory fails
Amos Anderson nitroa...@gmail.com added the comment: I believe I applied the patch correctly to my Python-2.6.5.tar.bz2, on my OSX 10.6.3 machine, configured with: ./configure --enable-framework=/Users/amos/triad/trunk/src/python but make install now fails with this error at the end: ln: /usr/local/bin/python2.6: Permission denied ln: /usr/local/bin/pythonw2.6: Permission denied ln: /usr/local/bin/idle2.6: Permission denied ln: /usr/local/bin/pydoc2.6: Permission denied ln: /usr/local/bin/python2.6-config: Permission denied ln: /usr/local/bin/smtpd2.6.py: Permission denied make[1]: *** [altinstallunixtools] Error 1 make: *** [frameworkaltinstallunixtools] Error 2 everything else appears ok... p.s. I tried: ./configure --enable-universalsdk --with-universal-archs=intel --enable-framework=/Users/amos/triad/trunk/src/python and got the same error. -- nosy: +Amos.Anderson versions: +Python 2.6 -Python 2.7, Python 3.2 Added file: http://bugs.python.org/file17233/buildpython.script ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3646 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Beginning with Python; the right choice?
In learning most programming languages, in my experience anyway, it's easy to get overwhelmed and want to give up. Python is easy enough that you should be able to pick it to a point that it will be useful to you while still learning the more advanced features. Python generally teaches good programming practices and I can see easily moving from Python to a more advanced language. BASIC is so far removed from modern languages that, IMO, it would make it difficult to transition to a modern language like C, C++ or Java. Python.org has a tutorial that should get you going. It seems to assume some programming knowledge but I think it's clear enough that even an absolute beginner could learn from it. http://docs.python.org/tutorial/index.html I learned C++ coming from Applesoft BASIC and Tandy Coco3 BASIC. I got a Sam's Teach Yourself book to do it. I really don't recommend that approach to anybody. It was very hard for me to understand the concepts necessary to make good use of C++. If I had only known about Python. On Fri, Jun 26, 2009 at 9:22 PM, sato.ph...@gmail.com sato.ph...@gmail.comwrote: Hi, As you can imagine, I am new, both to this group and to Python. I have read various posts on the best book to buy or online tutorial to read and have started to go through them. I was wondering, as someone with virtually no programming experience (I am a photographer by trade), is Python the right language for me to try and learn? I do vaguely remember learning what I think was BASIC on some old Apple's back in elementary school (circa 1992). Would something like that (the name at least makes it SOUND easier) be more feasible? If I do choose to learn Python, are there any tutorials for the absolute beginner. I do not mean beginner to Python, but rather, beginner to programming. Someone who hasn't a clue what object oriented whatcha-ma-whoozit means. I ask again because I understand that content is always evolving and there might be new tutorials out there. Thanks! -Daniel Sato -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: os.walk and os.listdir problems python 3.0+
Thank you. That works very well when writing to a text file but what is the equivalent when writing the information to stdout using print? Sorry when I originally replied I sent it directly and it didn't go to the list. On Thu, Jun 25, 2009 at 12:57 AM, Mark Tolonen metolone+gm...@gmail.commetolone%2bgm...@gmail.com wrote: Amos Anderson amosander...@gmail.com wrote in message news:a073a9cf0906242007k5067314dn8e9d7b1c6da62...@mail.gmail.com... I've run into a bit of an issue iterating through files in python 3.0 and 3.1rc2. When it comes to a files with '\u200b' in the file name it gives the error... Traceback (most recent call last): File ListFiles.py, line 19, in module f.write(file:{0}\n.format(i)) File c:\Python31\lib\encodings\cp1252.py, line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u200b' in position 30: character maps to undefined Code is as follows... import os f = open(dirlist.txt, 'w') for root, dirs, files in os.walk(C:\\Users\\Filter\\): f.write(root:{0}\n.format(root)) f.write(dirs:\n) for i in dirs: f.write(dir:{0}\n.format(i)) f.write(files:\n) for i in files: f.write(file:{0}\n.format(i)) f.close() input(done) The file it's choking on happens to be a link that internet explorer created. There are two files that appear in explorer to have the same name but one actually has a zero width space ('\u200b') just before the .url extension. In playing around with this I've found several files with the same character throughout my file system. OS: Vista SP2, Language: US English. Am I doing something wrong or did I find a bug? It's worth noting that Python 2.6 just displays this character as a ? just as it appears if you type dir at the windows command prompt. In Python 3.x strings default to Unicode. Unless you choose an encoding, Python will use the default system encoding to encode the Unicode strings into a file. On Windows, the filesystem uses Unicode and supports the full character set, but cp1252 (on your system) is the default text file encoding, which doesn't support zero-width space. Specify an encoding for the output file such as UTF-8: f=open('blah.txt','w',encoding='utf8') f.write('\u200b') 1 f.close() -Mark -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: 3.2*2 is 9.6 ... or maybe it isn't?
I think what your experiencing is addressed on this page... http://docs.python.org/tutorial/floatingpoint.html ... it has to do with the binary representation of the numbers. On Thu, Jun 25, 2009 at 1:04 PM, Bojan Sudarevic bo...@sudarevic.comwrote: Hi, I'm PHP developer and entirely new to Python. I installed it (version 2.5.2, from Debian repos) today on the persuasion of a friend, who is a Python addict. The first thing I typed into it was 3.2*3 (don't ask why I typed *that*, I don*t know, I just did). And the answer wasn't 9.6. Here it is: 3.2*3 9.6014 So I became curious... 3.21*3 9.629 (3.2*3)*2 19.203 ... and so on ... After that I tried Windows version (3.1rc2), and... 3.2*3 9.601 I wasn't particularly good in math in school and university, but I'm pretty sure that 3.2*3 is 9.6. Cheers, Bojan -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
os.walk and os.listdir problems python 3.0+
I've run into a bit of an issue iterating through files in python 3.0 and 3.1rc2. When it comes to a files with '\u200b' in the file name it gives the error... Traceback (most recent call last): File ListFiles.py, line 19, in module f.write(file:{0}\n.format(i)) File c:\Python31\lib\encodings\cp1252.py, line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u200b' in position 30: character maps to undefined Code is as follows... import os f = open(dirlist.txt, 'w') for root, dirs, files in os.walk(C:\\Users\\Filter\\): f.write(root:{0}\n.format(root)) f.write(dirs:\n) for i in dirs: f.write(dir:{0}\n.format(i)) f.write(files:\n) for i in files: f.write(file:{0}\n.format(i)) f.close() input(done) The file it's choking on happens to be a link that internet explorer created. There are two files that appear in explorer to have the same name but one actually has a zero width space ('\u200b') just before the .url extension. In playing around with this I've found several files with the same character throughout my file system. OS: Vista SP2, Language: US English. Am I doing something wrong or did I find a bug? It's worth noting that Python 2.6 just displays this character as a ? just as it appears if you type dir at the windows command prompt. -- http://mail.python.org/mailman/listinfo/python-list
Parsing DTDs
Hello! I would like to parse XML DTDs. The goal is to be able to validate XML-like object structures against DTDs in a fairly flexible way, although i can get from a parsed DTD to a validation engine myself, so that's not an essential feature of the parser (although it would be nice!). What should i do? A bit of googling revealed that the xmlproc package contains a DTD parser that looks like it does just what i want, and that xmlproc became PyXML, and that PyXML is no longer maintained. Is there a DTD parser that is being maintained? Or does it not really matter that PyXML is no longer maintained, given that it's not like the DTD spec has changed very much? Thanks, tom -- Many of us adopted the File's slang as our own, feeling that we'd found a tangible sign of the community of minds we'd half-guessed to be out there. -- http://mail.python.org/mailman/listinfo/python-list
Re: What IDE support python 3.0.1 ?
Sam (I presume), Like you I am also in the process of learning to program in Python. I have been using Python 2.5.2 for quite some time but recently made the switch to 3.0.1. Why? Because I read an article where Guido van Rossum himself recommended that anyone starting out learning Python now was wasting their time if they didn't start with Python 3. Some folks on this list will tell you there is not much difference and that seems to be true but I pleased that I made the switch. Now for your question about an IDE. I am presuming you are just beginning, perhaps done some programming in another language and probably using a Windows based PC. Given that there are some things I would recommend you stay away from (this will get the juices going :-) ): Vi, Vim, Emacs and all those old fashioned UNIX/Linux based editors - they are just too hard and why bother anyway, there are much more civilised ways of proving your manhood. Eclipse is also an over-kill. I would recommend any of the popular text editors; most will recognise Python files. I can tell you what I use: *EditPad+* - http://www.editplus.com/index.html - A great general purpose text editor that has the additional benefit of clip libraries (what?). This might not seem important but it is a great time saver. A clip library is a text file of code snippets that when you 'double-click' the required clip the editor inserts that code at the current cursor position. For example the following is a clip I use for the heading of a short script file: #T=Short script ^# ^!.py ^# The purpose of this script is def main(): {code here} main() After the clip has been inserted the cursor is positioned where the ^! string is (before .py) waiting for the script name to be inserted. You just build these clips to suit yourself. TextPad is another text editor with the same features. The main drawback with EditPlus is that when you run a Python script from within EditPlus and that script uses stdin (eg. an input() function) the editor can't handle it and you get an error message. I overcome this problem by using easygui (http://easygui.sourceforge.net/) dialogs for text input; a piece of cake :-) . Another drawback is that EditPlus is shareware and you have to pay for it (US35). *SciTE* - http://www.scintilla.org/SciTE.html - Scite is a very good little editor, it does not have the bells and whistles that editors like EditPlus have but it does recognise Python files and can run them from within the editor. It can also handle stdin (not that elegantly, but it works) so you don't need the easygui work-around and its free. *IDLE* - the built-in Python IDE. I have it configured so that the editor panel loads first rather than the Python prompt. Everything runs in IDLE! *PyScripter* - http://code.google.com/p/pyscripter/ - From the web site: PyScripter is a free and open-source Python Integrated Development Environment (IDE) created with the ambition to become competitive in functionality with commercial Windows-based IDEs available for other languages. This is a true IDE with most of the things you would expect. However, I find that it gets a bit buggy at times. It does support Python 3 and is free so its worth a try. There are several other good Python editor/IDE's but they require wxPython and it has not yet been made available in a Python 3 compatible version. I hope that helps. Give me a reply if you want any more help with any of these things. Easygui is something that is really worth getting to know. A copy of Python (Second Edition) by Toby Donaldson (ISBN 13: 978-0-321-58544-8) is another good thing to have when you are learning. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 and easygui problem
Gabriel Genellina said: That's very short-lived; cmp is gone in 3.0.1 (should not have existed in 3.0 in the first place). Try with: choices.sort(key=str.lower) Gabriel, That's worked fine - thank you. I think I now have a version of easygui.py that works with Python 3, probably needs a bit more testing. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 and easygui problem
John Machin said: Has the OP tried to contact the author/maintainer of easygui [the usually-recommended approach to problems with not-widely-used third- party modules]? Don't you think the author/maintainer might like to be consulted before you incite an OP to claim-jump his package name on PyPI? The OP (I presume you mean me) has tried to contact Steve Ferg (the original developer) but I have not had a reply yet. See my e-mail above; it is NOT my intention to place my modified script on PyPI as I AM NOT the original developer. My claim to fame is changing a few import and print statements and getting some useful advice from other members of this list. I am happy to make my modified script available unofficially and if Steve does contact me I would prefer to pass it on to him for his consideration. This little project started out to solve a personal need not to plagiarise or usurp the rights and skills of another developer. I was happy to make my simple effort available, unofficially, in return for help from other list members. I hope that resolves the issue. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 and easygui problem
Terry, I have not used PyPI before and feel a little uneasy about putting this modified script into such a public place. I have previously contacted Steve Ferg (the original developer of EasyGui) but have not had a reply. Clearly the bulk of the work is his still where as the modifications are mine (and several helpers from the Python List). Until I work out what I ought to do I have attached a copy of my script (and the test script I have been using) as is. I would really appreciate any comments. If Steve does not reply and further testing proves my modified script is sound then I will certainly look at a 'public' release. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 and easygui problem
John Machin said:* *... the knowledge that you had attempted to contact Steve Ferg and have not yet had a response was not available on c.l.py and in any case is not a justification for incitement to hijack. John, I resent the implication that I am trying to hijack Steve's project. This was never my intention. I am uneasy about posting this rebuttal on the list as this is not what I think lists like this are for; but given your response I will post this one reply in my defence. I think that if you want to follow up this matter do it off line. For your information I have since been in contact with Steve and sent him a copy of my code. Its been my experience that there are some users of these lists who ought to hesitate before they jump in because they often are not in full possession of all the facts. Once again (and for the last time) this was a personal project, I offered to share my additions to Steve's work in an informal way to anyone who helped me with fixing error responses I was getting - its a very long bow to draw to say this constitutes hijacking. It was NEVER my intention to hijack anyone's work and I resent the accusation. To end, I have included below a statement that I added to the script that I sent to Terry: - This is an experimental version of EasyGui that has converted the latest 'official' version so that it will run under Python 3.0.1 The script is still being tested and any comments would be appreciated. NOTE: This version of the script is not from Steve Ferg although his contribution of the original script is acknowledged. This script is released under the same Creative Commons Attribution 2.0 License as the original script. Modified by: Peter Anderson Date: Monday, 23 February 2009 Contact: peterjohnander...@gmail.com - As far as I am concerned that is the end of the matter on this list. Feel free to contact me off line if you want to follow up this post. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Python 3 and easygui problem
I have just installed Python 3. I have been using Tkinter and easygui (with Python 2.5.4) for any GUI needs. I have just started to port some of my existing scripts to Python 3 and discovered problems with easygui. I was using the following script for testing: from easygui import * import sys while 1: msgbox(Hello, world!) msg =What is your favorite flavor? title = Ice Cream Survey choices = [Vanilla, Chocolate, Strawberry, Rocky Road] choice = choicebox(msg, title, choices) # note that we convert choice to string, in case # the user cancelled the choice, and we got None. msgbox(You chose: + str(choice), Survey Result) msg = Do you want to continue? title = Please Confirm if ccbox(msg, title): # show a Continue/Cancel dialog pass # user chose Continue else: sys.exit(0) # user chose Cancel I have changed the easygui source to Python 3 'import' and 'print' requirements and the initial message box in the above script displays fine fine. However the subsequent message boxes do not display and after the script completes I get the following error message: -- Python 3 -- Traceback (most recent call last): File easyguidemo.py, line 10, in choice = choicebox(msg, title, choices) File C:\Python30\lib\site-packages\easygui.py, line 703, in choicebox return __choicebox(msg,title,choices,buttons) File C:\Python30\lib\site-packages\easygui.py, line 824, in __choicebox choices.sort( lambda x,y: cmp(x.lower(), y.lower())) # case-insensitive sort TypeError: must use keyword argument for key function Output completed (7 sec consumed) -- Fixing this is a bit beyond my skills and I was wondering whether anyone has any thoughts. I am happy to post a copy of my revised easygui.py script. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: what IDE is the best to write python?
I have a thing about editors; a good editor is my tool of trade! I have tried many editors over the years mainly in the MS Windows, Linux and IBM mainframe environments. After all this I really like EditPlus (and the a slightly lesser extent Textpad). What both have in common is their Clip Library or Clip Text (I think its called in Textpad). A Clip Library is a simple text file that appears in a side panel next to the main edit panel. Double click on a Clip Library element and it is automatically pasted into the edit panel at the current cursor position. The Clip Library content can also be pased around highlighted text in the edit panel. Here is a simple of an EditPlus Clip Library for what I call a short script: #T=Short script ^# ^!.py ^# The purpose of this script is def main(): {code here} main() #T=Next Clip Library element #T= defines the name of the Clip Library element ^# the ^ character must proceed a character that is normally a Clip Library syntax character but which you want to use in another context (a Python line comment in this case) ^! is the cursor positin after the Clip Library element has been inserted, in this case the cursor is positioned to alloy the name of the script to be typed The Clip Library element ends when the Clip Library parser finds either another element definition or the end of the file. Clip Libraries are stored in simple text files. This is such a simple concept but is so very productive. Who needs an IDE?. I would love to have a Linux text editor (like Scite or GEdit) that could do this. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Pexpect and telnet not communicating properly
I am trying to automate the following session - to talk to my router: === telnet speedtouch Trying 192.168.1.254... Connected to speedtouch. Escape character is '^]'. Username : Administrator Password : __ SpeedTouch 780 ___/_/\ / /\ 6.1.7.2 _/__ / \ _/ /\_/___ \ Copyright (c) 1999-2006, THOMSON // / \ /\ \ ___//___/\ / _\/__ / / \ \// //\ __/ / \ \ // // _\__ / / / \___\// // / /\ /_/__/___/ // /___/ \ \ \ \___\ \\ \ \ / \_\ \ / /\\ \\ \___\/ \ \/ / \\ \\ / \_/ /\\ \\/ /__/ \\ / \ _ \ /_\/ \ //\ \/___\/ // \ \ / \\ /___\/ \\/ _{Administrator}=? Following commands are available : help : Displays this help information menu : Displays menu ?: Displays this help information exit : Exits this shell. .. : Exits group selection. saveall : Saves current configuration. ping : Send ICMP ECHO_REQUEST packets. traceroute : Send ICMP/UDP packets to trace the ip path. Following command groups are available : firewallservice autopvc connection cwmp dhcpdns dsd dyndns eth adslatm config debug env exprgrp hostmgr ids igmp interface ip ipqos label language mbusmemmmlp nat ppp pptpscript snmpsntpsoftware system systemlog upgrade upnpuser voice wireless {Administrator}=exit I am using the following code: #!/usr/bin/env python import pexpect import sys child = pexpect.spawn('telnet 192.168.1.254') fout = file('mylog.txt','w') child.logfile = fout child.expect('sername : ') child.sendline('Administrator') child.expect('assword : ') child.sendline('') child.expect('_{Administrator}=') child.sendline('?') child.expect('_{Administrator}=') child.expect('exit') This times out after child.sendline('Administrator') mylog.txt contains: Trying 192.168.1.254... Connected to 192.168.1.254. Escape character is '^]'. Username : Administrator Administrator Can anyone help me in finding out what I am doing wrong? Regards David -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs vs. Eclipse vs. Vim
What I have done is skipped the whole Vim/Emacs obscure editor thing and opted for PyScripter (see http://mmm-experts.com/Products.aspx?ProductID=4 ). It might not be as complete/complex as these other editors but it is easy to use and just lets me get on with the task of cutting code. As a fall-back I also use EditPlus (see http://www.editplus.com/index.html ). Its only for Windows and its shareware so you need to pay for it. Its clip library makes it a VERY GOOD text editor. It's a real shame there are NO text editors with such a comprehensive and easy to modify clip library function (I would be really pleased to be proven wrong on this last point :-) ). However, the best advice I think that can be given about editors is keep trying them until you find the one YOU like. We all like different things, especially when it comes to editors. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs vs. Eclipse vs. Vim
Stef asked: / // As a fall-back I also use EditPlus (see // http://www.editplus.com/index.html ). Its only for Windows /but PyScripter is also only for windows ;-) / and its shareware so you need to pay for it. Its clip library makes it // a VERY GOOD text editor. It's a real shame there are NO text editors // with such a comprehensive and easy to modify clip library function (I // would be really pleased to be proven wrong on this last point :-) ). /What so great about it ? I think you would really need to try it. As I said yesterday, I find the clip library really very useful; its simple to use and easy to create/extend. Here is a short piece of clip library from a HTML clip lib: #T=Bold b^!/b #T=Italic i^!/i #T=Underline text span class=underline^!/span #T=Superscript (end note) sup^!/sup #T=Code fragment code^!/code #T=Highligt text - yellow span class=highlight^!/span #T=Centre text div align=center ^! /div Only the text on the line after the T# appears in the clip lib side panel. Double click on the text label and EditPlus inserts the clip text into the document being edited. The ^! is where the cursor sits after the clip insertion. Clips can be inserted around existing text. Very neat; if you use Windows its really worth a try. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: IDE Question
I have been using the two following Python IDE's on both Windows and Ubuntu: * PyScripter - http://mmm-experts.com/ * DrPython - http://sourceforge.net/projects/drpython/ PyScripter is, I think, the better but both are nice editors and easy to use. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: improving a huge double-for cycle
Bruno Desthuilliers wrote: Alexzive a écrit : Hello there :) , I am a python newbie and need to run following code for a task in an external simulation programm called Abaqus which makes use of python to access the mesh (ensamble of nodes with xy coordinates) of a certain geometrical model. [IN is the starting input containing the nodes to be check, there are some double nodes with the same x and y coordinates which need to be removed. SN is the output containing such double nodes] Code: Select all for i in range(len(IN)): #scan all elements of the list IN for j in range(len(IN)): if i j: if IN[i].coordinates[0] == IN[j].coordinates[0]: if IN[i].coordinates[1] == IN[j].coordinates[1]: SN.append(IN[i].label) Unfortunately my len(IN) is about 100.000 and the running time about 15h :( Any idea to improve it? A couple ones have been submitted. Harald gets a point about the redundant tests (even if his solution seems to be broken, cf below) - your inner loop should have looked like : for j in xrange(i+1, len(IN)) Now the obvious winner is pruebono - even unoptimized, using sets seems to be *way* faster than even the most optimized corrected version of your algorithm. Here's a quick bench - please everyone doublecheck it to make sure it's ok: snip code Results here (py2.5, gentoo linux, athlonxp1800, 512 ram): test_results() True test_times() doubles0 : 1.55667901039 doubles1 : 0.719144105911 doubles2 : 0.703393936157 doubles3 : 0.700654983521 doubles4 : 0.706257104874 doubles5 : 0.528184890747 doubles6 : 0.461633205414 doubles8 : 0.0134379863739 doubles9 : 0.0108540058136 Not surprisingly, half less iterations makes for half less time. Aliasing, as often, proves to be a good optimization too. But obviously, using the correct data structure / algorithm combo is the key : simpler code, and 115 times faster (143 times with aliasing). If pruebono solution's is correct (and it as AFAICT), your 15 hours computation should by now take less than 10 minutes... Ubuntu 8.04 core2 2.6(i think) without psycho doubles0 : 0.610555171967 doubles1 : 0.29314494133 doubles2 : 0.286273956299 doubles3 : 0.281984090805 doubles4 : 0.28240609169 doubles5 : 0.207377910614 doubles6 : 0.156388044357 doubles8 : 0.00533080101013 doubles9 : 0.00458884239197 with psycho doubles0 : 0.127684116364 doubles1 : 0.069571018219 doubles2 : 0.064826965332 doubles3 : 0.0702300071716 doubles4 : 0.0647261142731 doubles5 : 0.0522589683533 doubles6 : 0.0437579154968 doubles8 : 0.00190806388855 doubles9 : 0.00214099884033 On this small test its a variance between ~6x to 2X still its basically free so why not ;- -- http://mail.python.org/mailman/listinfo/python-list
Re: improving a huge double-for cycle
psyco might help a fair bit (10x-40x) here ;- perhaps look at dumping the data into sqlite then pulling it back out. It (or the other databases) are designed for tossing around large lumps of data. Alexzive wrote: Hello there :) , I am a python newbie and need to run following code for a task in an external simulation programm called "Abaqus" which makes use of python to access the mesh (ensamble of nodes with xy coordinates) of a certain geometrical model. [IN is the starting input containing the nodes to be check, there are some double nodes with the same x and y coordinates which need to be removed. SN is the output containing such double nodes] Code: Select all for i in range(len(IN)): #scan all elements of the list IN for j in range(len(IN)): if i j: if IN[i].coordinates[0] == IN[j].coordinates[0]: if IN[i].coordinates[1] == IN[j].coordinates[1]: SN.append(IN[i].label) Unfortunately my len(IN) is about 100.000 and the running time about 15h :( Any idea to improve it? I have already tried to group the "if statements" in a single one: Code: Select all if i j and if IN[i].coordinates[0] == IN[j].coordinates[0] and if IN[i].coordinates[1] == IN[j].coordinates[1]: but no improvements. Many thanks, Alex -- http://mail.python.org/mailman/listinfo/python-list -- Vapour Forge Jake Anderson Project Manager Mobile:0412 897 125 Email:[EMAIL PROTECTED] Web Page:www.vapourforge.com Your source for custom IT services -- http://mail.python.org/mailman/listinfo/python-list
wxPython problem
I am trying to teach myself how to program in Python and use wxPython for GUIs. I am using PyScripter, IDLE and EditPlus as my IDEs. I have experienced an odd problem where I run a script once and it runs fine. Run it again and I get an error and the script fails. If the script is run directly from Python ('Run' from Windows Explorer) or from EditPlus (in which I have a user-defined tool which calls C:\Python25\pythonw.exe with the parameter of $(FileName)) then there is *never* any error, no matter how many times the script is run. Close down PyScripter or IDLE and then start either up again, load the script and run it - it runs fine. Run it again and it fails. It seems like something is already set in memory and cant be re-set (my lack of knowledge is showing here :-( ). More details are shown below. Any help or hints would be greatly appreciated. Regards, Peter RUNNING SIMPLE.PY (AND OTHER SCRIPTS USING WXPYTHON) FROM PYSCRIPTER I GET THE FOLLOWING ERROR MESSAGE: PyNoAppError: The wx.App object must be created first! PyScripter loads a module (I presume from wxPython) called _windows.py and highlights a particular line in red and displays the error message from above. I have Googled the error message but the results have not helped. LISTING FOR SIMPLE.PY #!/usr/bin/python # simple.py import wx app = wx.App() frame = wx.Frame(None, -1, 'simple.py') frame.Show() app.MainLoop() EXERPT FROM _WINDOWS.PY - PYSCRIPTER HIGHLIGHTS SECOND LAST LINE class Frame(TopLevelWindow): Proxy of C++ Frame class thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): __init__(self, Window parent, int id=-1, String title=EmptyString, Point pos=DefaultPosition, Size size=DefaultSize, long style=DEFAULT_FRAME_STYLE, String name=FrameNameStr) - Frame # The following line is highlighted as where the error occures _windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs)) self._setOORInfo(self) RUNNING THE SIMPLE.PY SCRIPT FROM WITHIN IDLE PRODUCES THE FOLLOWING ERROE MESSAGE: Traceback (most recent call last): File C:\Documents and Settings\Peter\My Documents\Dev\Python\WxPython Tutorial\absolute.py, line 28, in module Absolute(None, -1, '') File C:\Documents and Settings\Peter\My Documents\Dev\Python\WxPython Tutorial\absolute.py, line 9, in __init__ wx.Frame.__init__(self, parent, id, title, size=(250, 180)) File C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py, line 505, in __init__ _windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs)) PyNoAppError: The wx.App object must be created first! -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython problem
Stef Mientki said: In PyScripter, you should run wxPython in the plain remote machine (not the wxPython remote),and you should set reset before run flag or reset the remote machine each time yourself. Stef, Thanks for the help! It has taken several hours to find and install the correct version of Rpyc (which is required to run the remote Python engine but it now seems to be working fine. And the Reinitialise the Python engine {Alt]+[F2] does need to be done between script runs. Given all that, the script now runs multiple times in PyScripter. The script still only runs ONCE in IDLE but I can live with that. In case others find this message from a search; I am using Python 2.5.2 and it requires rpyc-2.60.zip from the Rpyc download page (see http://rpyc.wikispaces.com/ click on the Download link and make sure you select the main link under the Packages column at Sourceforge. You will be shown a list of Rpyc versions. For Python 2.5.2 choose Relese 2.60. This will save you the several hours its cost me. Thanks again Stef. Regards, Peter -- Peter Anderson There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning Python
James, I have several Python books and am currently working my way through John Zelle's PYTHON PROGRAMMING: An Introduction to Computer Science (Publisher: Franklin, Beedle Associates, ISBN-10: 1887902996, ISBN-13: 978-1887902991). I think this is a very good introduction to both Python AND programming I would highly recommend it. If you finish the Zelle book then you can go onto Problem Solving With Algorithms And Data Structures Using Python by Bradley N. Miller and David L. Ranum (Publisher: Franklin Beedle Associates, ISBN-10: 1590280539, ISBN-13: 978-1590280539). These are equivalent to Python 101 and 201. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Mail delivery problems
In the last two days I have posted relies twice to the Python List. Each time my e-mail has listed successfully but I have received a reply like the following: This is an automatically generated Delivery Status Notification. Delivery to the following recipients failed. [EMAIL PROTECTED] Reporting-MTA: dns;delhi-prod01.india.kring.com Received-From-MTA: dns;kring-vt01 Arrival-Date: Sun, 7 Sep 2008 07:16:17 +0530 Final-Recipient: rfc822;[EMAIL PROTECTED] Action: failed Status: 5.2.2 X-Display-Name: Ajay Deshpande Subject: Re: Learning Python From: Peter Anderson [EMAIL PROTECTED] Date: Sun, 07 Sep 2008 11:41:03 +1000 To: python-list@python.org The text of my message... Is this a problem? Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Books about Python.
Hi! I am currently working my way through Python Programming: An introduction to computer science by John Zelle. Published by Franklin, Beedle Associates. ISBN: 1-887902-99-6. Book's home page: http://www.fbeedle.com/99-6.html I have a small but quite good Python library and this is the best Python (actually best programming) book I have ever read. It is written as a text for a first year (US) college level course. Python is used because experience with other languages showed that their learning curves got in the road of the primary function of the course. Problem Solving With Algorithms And Data Structures Using Python by Bradley N. Miller and David L. Ranum (ISBN-10: 1590280539 or ISBN-13: 978-1590280539 Book's home page: http://www.fbeedle.com/053-9.html) is on my Amazon wish list to follow on from Zelle. This book is, as I understand it, a second year text. See the book's home page for content details. I hope that helps, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: programming toolbox
Bill Purcell said: ... I was wondering what more experienced programmers think about what languages are necessary to be able to handle most programming problems. ... Bill, I have a similar length of experience with python to you. I look at other languages from time to time but the only two I think are worth the effort are: * PHP - because I do a bit od WordPress website work for some not-for-profits; and * Java - because I don't know why but having done C and some mainframe based languages (Natural and COBOL) when I worked the portability of Java (and PHP and Python) appeal to me. Java is a that look's interesting propositioned while I am learning PHP. If I were programming for a living and working on my own I would look very seriously at X-Base languages (dBase is still available) as they are quite good for small business type projects - quick to code and (more importantly) maintain, easy to produce screens and part of the underlying data storage system - not fashionable but very productive. Biggest issue I have with Python is screen input and output. I am trying to master wxPython (and Tkinter) but find this aspect harder than it ought to be. While I'm rambling on; I recently purchased Python Programming: An introduction to Computer Science by John Zelle (ISBN: 1-887902-99-6) a really good book, best Python text I have read. Regards, Peter -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Dock box order
Hello, My name is Rev. Raymond Anderson. Can you Please provide unit cost on your dock boxes with the dimension ( 46W x 26D x 27H ) to enable me choose the quantities i will like to purchase. Hope to hear back from you. with kind regards Rev. Raymond Anderson. D -- http://mail.python.org/mailman/listinfo/python-list
Re: strptime and timezones
On Wed, 13 Aug 2008, Christian Heimes wrote: Tom Anderson wrote: Secondly, do you really have to do this just to parse a date with a timezone? If so, that's ridiculous. No, you don't. :) Download the pytz package from the Python package index. It's *the* tool for timezone handling in Python. The time zone definition are not part of the Python standard library because they change every few of months. Stupid politicians ... My problem has absolutely nothing to do with timezone definitions. In fact, it involves less timezone knowledge than the time package supplies! The wonderful thing about RFC 1123 timestamps is that they give the numeric value of their timezone, so you don't have to decode a symbolic one or anything like that. Knowing about timezones thus isn't necessary. The problem is simply that the standard time package doesn't think that way, and always assumes that a time is in your local timezone. That said, it does look like pytz might be able to parse RFC 1123 dates. Ill check it out. tom -- Come on thunder; come on thunder. -- http://mail.python.org/mailman/listinfo/python-list
strptime and timezones
Hello! Possibly i'm missing something really obvious here. But ... If i have a date-time string of the kind specified in RFC 1123, like this: Tue, 12 Aug 2008 20:48:59 -0700 Can i turn that into a seconds-since-the-epoch time using the standard time module without jumping through substantial hoops? Apart from the timezone, this can be parsed using time.strptime with the format: %a, %d %b %Y %H:%M:%S You can stick a %Z on the end for the timezone, but that parses timezone names ('BST', 'EDT'), not numeric specifiers. Also, it doesn't actually parse anything, it just requires that the timezone that's in the string matches your local timezone. Okay, no problem, so you use a regexp to split off the timezone specifier, parse that yourself, then parse the raw time with strptime. Now you just need to adjust the parsed time for the timezone. Now, from strptime, you get a struct_time, and that doesn't have room for a timezone (although it does have room for a daylight saving time flag), so you can't add the timezone in before you convert to seconds-since-the-epoch. Okay, so convert the struct_time to seconds-since-the-epoch as if it were UTC, then apply the timezone correction. Converting a struct_time to seconds-since-the-epoch is done with mktime, right? Wrong! That does the conversion *in your local timezone*. There's no way to tell it to use any specific timezone, not even just UTC. So how do you do this? Can we convert from struct_time to seconds-since-the-epoch by hand? Well, the hours, minutes and seconds are pretty easy, but dealing with the date means doing some hairy calculations with leap years, which are doable but way more effort than i thought i'd be expending on parsing the date format found in every single email in the world. Can we pretend the struct_time is a local time, convert it to seconds-since-the-epoch, then adjust it by whatever our current timezone is to get true seconds-since-the-epoch, *then* apply the parsed timezone? I think so: def mktime_utc(tm): Return what mktime would return if we were in the UTC timezone return time.mktime(tm) - time.timezone Then: def mktime_zoned(tm, tz): Return what mktime would return if we were in the timezone given by tz return mktime_utc(tm) - tz The only problem there is that mktime_utc doesn't deal with DST: if tm is a date for which DST would be in effect for the local timezone, then we need to subtract time.altzone, not time.timezone. strptime doesn't fill in the dst flag, as far as i can see, so we have to round-trip via mktime/localtim: def isDST(tm): tm2 = time.localtime(time.mktime(tm)) assert (tm2.isdst != -1) return bool(tm2.isdst) def timezone(tm): if (isDST(tm)): return time.altzone else: return time.timezone mktime_utc then becomes: def mktime_utc(tm): return time.mktime(tm) - timezone(tm) And you can of course inline that and eliminate a redundant call to mktime: def mktime_utc(tm): t = time.mktime(tm) isdst = time.localtime(t).isdst assert (isdst != -1) if (isdst): tz = time.altzone else: tz = time.timezone return t - tz So, firstly, does that work? Answer: i've tested it a it, and yes. Secondly, do you really have to do this just to parse a date with a timezone? If so, that's ridiculous. tom -- 102 FX 6 (goblins) -- http://mail.python.org/mailman/listinfo/python-list
Re: Upgrading to DB-API (was Re: Corrupted images ...)
Aahz wrote: In article [EMAIL PROTECTED], Fredrik Lundh [EMAIL PROTECTED] wrote: Ouch. Please use parameters instead of explicit escapes and string formatting; Python's not PHP. How would you recommend upgrading an application that is more than ten years old and contains something like 100K lines of code? Very carefully? ;- It would be a manual process but it shouldn't be too bad, the stuff before and after that code block should be unaffected -- http://mail.python.org/mailman/listinfo/python-list
RE: very newbie question
Try this: # The player tries to guess it and the computer lets # the player know if the guess is too high, too low # or right on the money import random print \tWelcome to 'Guess My Number'! print \nI'm thinking of a number between 1 and 100. print Try to guess it in as few attempts as possible.\n # set the initial values the_number = random.randrange(100) + 1 tries = 0 def ask_number(): guess = int(raw_input(Take a guess: )) tries = 1 while (guess != the_number): if (guess the_number): print Lower... else: print Higher... tries += 1 guess = int(raw_input(Take a guess: )) tries += 1 ask_number() print You guessed it! The number was, the_number print And it only took you, tries, tries!\n raw_input(\n\nPress the enter key to exit.) The variables the_number and tries were not available outside the ask_number() module. Alternatively drop the def function and lump it all into a simple script. -- *Peter Anderson* There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things—Niccolo Machiavelli, /The Prince/, ch. 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: very large dictionary
Bruno Desthuilliers wrote: Simon Strobl a écrit : (snip) I would prefer to be able to use the same type of scripts with data of all sizes, though. Since computers have a limited RAM, this is to remain a wish. You can't obviously expect to deal with terabytes of data like you do with a 1kb text file. -- http://mail.python.org/mailman/listinfo/python-list You can, you just start off handling the multi GB case and your set. databases are really easy, I often use them for manipulating pretty small amounts of data because its just an easy way to group and join etc. -- http://mail.python.org/mailman/listinfo/python-list