Re: import locale and print range on same line

2016-01-24 Thread eryk sun
On Sat, Jan 23, 2016 at 8:45 PM, Terry Reedy wrote: > On 1/23/2016 8:58 AM, Chris Angelico wrote: >> On Sun, Jan 24, 2016 at 12:45 AM, Steven D'Aprano >> wrote: >>> [steve@ando ~]$ python -c "for i in range(5): print 'hello world' " >>> >>> hello world >>> hello world >>> hell

Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-26 Thread eryk sun
On Sun, Jan 24, 2016 at 7:27 PM, Terry Reedy wrote: > > More specifically, / is not accepted in paths to be executed. It seems to be > generally accepted in path arguments, as in cd path, or > > C:\Users\Terry>C:\programs\python35\python.exe C:/programs/python34/tem.py An exception that comes to

Re: problem in installing python

2016-02-03 Thread eryk sun
On Wed, Feb 3, 2016 at 12:57 AM, Salony Permanand wrote: > > I downloaded different version of python but no one is installed on my pc > because of same installation error each time having error code 2203. 2203 may be a Windows Installer error [1]. If so, the error message has the following templ

Re: __bases__ attribute on classes not displayed by dir() command

2016-02-04 Thread eryk sun
On Thu, Feb 4, 2016 at 2:03 AM, ast wrote: > but if I am using dir to display all Carre's attributes and methods, > __bases__ is not on the list. Why ? The __bases__ property is defined by the metaclass, "type". dir() of a class doesn't show attributes from the metaclass [1]. Because dir() i

Re: How this C function was called through ctypes this way?

2016-02-04 Thread eryk sun
On Thu, Feb 4, 2016 at 3:33 AM, wrote: > > class DoubleArrayType: > def from_param(self, param): > > [snip] > > DoubleArray = DoubleArrayType() > _avg = _mod.avg > _avg.argtypes = (DoubleArray, ctypes.c_int) > > [snip] > > What confuse me are: > (1) at line: _avg.argtypes = (DoubleArray, ctyp

Re: Copying void * string to

2016-02-10 Thread eryk sun
On Wed, Feb 10, 2016 at 6:07 AM, Martin Phillips wrote: > > Several functions in the C library return pointers to dynamically allocated > w_char null > terminated strings. I need to copy the string to a Python variable and call > an existing > library function that will free the dynamically allo

Re: Python Not Working as expected on Win 8 and above.

2016-02-13 Thread eryk sun
On Sat, Feb 13, 2016 at 7:35 AM, MWS wrote: > couldn't find the default install python directory (maybe i didn't pay > attention earlier), later, after some scratching my head and other > intelligent thoughts and experiments i found it got installed in the users > hidden appdata folder by default(

Re: extending PATH on Windows?

2016-02-16 Thread eryk sun
On Tue, Feb 16, 2016 at 2:30 AM, Ulli Horlacher wrote: > > So far, I use: > >system('setx PATH "%PATH%;'+bindir+'"') > > The problem: In a new process (cmd.exe) PATH contains a lot of double > elements. As far as I have understood, Windows builds the PATH > environment variable from a system c

Re: [Glitch?] Python has just stopped working

2016-02-16 Thread eryk sun
On Tue, Feb 16, 2016 at 10:19 AM, Theo Hamilton wrote: > Whenever I run python (3.5), I get the following message: > > Fatal Python error: Py_initialize: unable to load the file system codec > ImportError: No module named 'encodings' > > Current thread 0x2168 (most recent call first): The int

Re: extending PATH on Windows?

2016-02-17 Thread eryk sun
On Wed, Feb 17, 2016 at 11:49 AM, Ulli Horlacher wrote: > At startup cmd.exe runs a script which is defined by the registry variable > AutoRun in "HKCU\Software\Microsoft\Command Processor" > > I set this variable with: > > rc = "HKCU\Software\Microsoft\Command Processor" > ar = "%USERPROFILE%

Re: extending PATH on Windows?

2016-02-17 Thread eryk sun
On Wed, Feb 17, 2016 at 2:29 PM, Ulli Horlacher wrote: > eryk sun wrote: >> > >> > set PATH=%PATH%;%USERPROFILE%\Desktop >> >> The AutoRun command (it's a command line, not a script path) > > A script path is a legal command line, too. If the regist

Re: extending PATH on Windows?

2016-02-18 Thread eryk sun
On Wed, Feb 17, 2016 at 6:53 PM, Dennis Lee Bieber wrote: > On Wed, 17 Feb 2016 17:49:11 + (UTC), Ulli Horlacher > declaimed the following: > >>Thorsten Kampe wrote: >> >>> By the way: there is a script called `win_add2path.py` in your Python >>> distribution >> >>I have >>"Python 2.7.11 (v2

Re: extending PATH on Windows?

2016-02-19 Thread eryk sun
On Fri, Feb 19, 2016 at 4:48 AM, Chris Angelico wrote: > On Fri, Feb 19, 2016 at 9:42 PM, Ulli Horlacher > wrote: >> pyotr filipivich wrote: >> >>> > Windows (especially 7) search function is highly crippled. There is >>> >some command sequence that will open it up to looking at other file

Re: extending PATH on Windows?

2016-02-19 Thread eryk sun
On Thu, Feb 18, 2016 at 10:55 AM, Ulli Horlacher wrote: > Ulli Horlacher wrote: > >> > but simpler still and more reliable to just call QueryValueEx. >> >> I find it more complicated. > > I have now (after long studying docs and examples):: > > def get_winreg(key,subkey): > try: > rkey = wi

Re: extending PATH on Windows?

2016-02-19 Thread eryk sun
On Fri, Feb 19, 2016 at 8:18 AM, Gisle Vanem wrote: > Dennis Lee Bieber wrote: > How can one search for files with DOS? >>> >>> dir /s /b \*add2path.* >>> >>> ChrisA >> >> Or move to PowerShell... >> >> Windows PowerShell >> Copyright (C) 2009 Microsoft Corporation. All rights reserved.

Re: extending PATH on Windows?

2016-02-20 Thread eryk sun
On Fri, Feb 19, 2016 at 6:57 PM, Dennis Lee Bieber wrote: > > Problem -- if the OP's PATH had contained the location of the add2path > script, the OP might not have needed to search for it... (presuming their > configuration also was set up to treat .py files as executable, entering > win_

Re: How to define what a class is ?

2016-02-25 Thread eryk sun
On Thu, Feb 25, 2016 at 3:54 AM, ast wrote: > So we can conclude that inspect.isclass(x) is equivalent > to isinstance(x, type) > > lets have a look at the source code of isclass: > > def isclass(object): >"""Return true if the object is a class. > >Class objects provide these attributes:

Re: Bug in Python?

2016-02-26 Thread eryk sun
On Fri, Feb 26, 2016 at 4:08 PM, Sven R. Kunze wrote: > Python sometimes seems not to hop back and forth between C and Python code. > Can somebody explain this? Normally a C extension would call PySequence_SetItem, which would call the type's sq_ass_item, which for MyList is slot_sq_ass_item. Th

Re: Bug in Python?

2016-02-26 Thread eryk sun
On Fri, Feb 26, 2016 at 4:37 PM, Ian Kelly wrote: > So I would guess that the difference here is because one > implementation is entirely C, and the other implementation is entirely > Python. Exactly, the C implementation of siftup is only called internally. So there's no need to export it as a f

Re: What arguments are passed to the __new__ method ?

2016-03-01 Thread eryk sun
On Tue, Mar 1, 2016 at 11:24 AM, ast wrote: > > class Premiere: > >def __new__(cls, price): >return object.__new__(cls, price) > >def __init__(self, price): >pass > > p = Premiere(1000) > > it fails. It is strange because according to me it is equivalent to: > > class Premi

Re: What arguments are passed to the __new__ method ?

2016-03-01 Thread eryk sun
On Tue, Mar 1, 2016 at 2:27 PM, Terry Reedy wrote: > On 3/1/2016 12:24 PM, ast wrote: > >> class Premiere: >> def __init__(self, price): >> pass >> p = Premiere(1000) >> >> which is OK. > > Premiere is callable because it inherits object.__call__. That function, or > the implementati

Re: a clarification on the "global" statement sought

2016-03-11 Thread eryk sun
On Fri, Mar 11, 2016 at 2:13 AM, Charles T. Smith wrote: > When might a "global" statement be used in the outermost level of a module? You wouldn't need this in a normal module, because locals and globals are the same. It may be useful if you're using exec with separate locals and globals, and ne

Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?

2016-03-20 Thread eryk sun
On Sun, Mar 20, 2016 at 5:33 PM, wrote: > On Wednesday, October 14, 2015 at 9:06:11 PM UTC+2, John S. James wrote: >> I installed 3.5.0 today and it's working fine -- either from the command >> prompt, or running a .py script. >> >> But the Python 3.4 that was previously installed on the compute

Re: os.rename on Windows

2016-03-23 Thread eryk sun
On Wed, Mar 23, 2016 at 7:17 AM, Steven D'Aprano wrote: > > According to the documentation, os.rename(original, new) will fail if new > already exists. In 3.3+ you can use os.replace. For POSIX systems it's functionally the same as os.rename. pyosreplace [1] backports os.replace for 2.6, 2.7 and

Re: Not downloading

2016-03-23 Thread eryk sun
On Wed, Mar 23, 2016 at 12:31 PM, louis anderson wrote: > 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 a

Re: setup

2016-03-26 Thread eryk sun
On Sat, Mar 26, 2016 at 6:20 PM, Joel Goldstick wrote: > I'm guessing you are on windows and you could google the error code, but > also search the list because this question has been asked and answered I > believe A little knowledge helps. An upper word of 0x8007 indicates a COM HRESULT error (0

Re: Rename file without overwriting existing files

2017-02-09 Thread eryk sun
On Thu, Feb 9, 2017 at 11:46 AM, Steve D'Aprano wrote: > > So to summarise, os.rename(source, destination): > > - is atomic on POSIX systems, if source and destination are both on the > same file system; > - may not be atomic on Windows? > - may over-write an existing destination on POSIX system

Re: subprocess problem

2017-02-09 Thread eryk sun
On Thu, Feb 9, 2017 at 10:50 PM, Cameron Simpson wrote: > This is why I suggested the check_returncode() method, which examines the > error code. You must be thinking of the returncode attribute, which isn't a method. check_returncode() is a method of the CompletedProcess object that's returned b

Re: subprocess problem

2017-02-09 Thread eryk sun
On Fri, Feb 10, 2017 at 12:05 AM, Wildman via Python-list wrote: > > Corrected code: > > def which(target) > for p in pathlist: > fullpath = p + "/" + target > if os.path.isfile(fullpath) and os.access(fullpath, os.X_OK): > return fullpath, True > return None, F

Re: os.path.isfile

2017-02-10 Thread eryk sun
On Fri, Feb 10, 2017 at 9:09 PM, Vincent Vande Vyvre wrote: > Le 10/02/17 à 22:03, Vincent Vande Vyvre a écrit : >> Le 10/02/17 à 21:36, Peter Otten a écrit : >>> Vincent Vande Vyvre wrote: Le 10/02/17 à 19:11, epro...@gmail.com a écrit : > > Python 3.5.2 > > Windows 10 >

Re: os.path.isfile

2017-02-11 Thread eryk sun
On Sun, Feb 12, 2017 at 3:52 AM, Steve D'Aprano wrote: > In Python, you should always use forward slashes for paths, even on Windows. There are cases where slash doesn't work (e.g. some command lines; \\?\ prefixed paths; registry subkey paths), so it's simpler to follow a rule to always convert

Re: Rename file without overwriting existing files

2017-02-12 Thread eryk sun
On Sun, Feb 12, 2017 at 4:09 AM, Steve D'Aprano wrote: > On Fri, 10 Feb 2017 12:07 am, eryk sun wrote: > >> On Thu, Feb 9, 2017 at 11:46 AM, Steve D'Aprano >> wrote: >>> >>> So to summarise, os.rename(source, destination): >>> >>>

Re: os.path.isfile

2017-02-12 Thread eryk sun
On Sun, Feb 12, 2017 at 4:29 AM, Chris Angelico wrote: > Registry subkeys aren't paths, and the other two cases are extremely > narrow. Convert slashes to backslashes ONLY in the cases where you > actually need to. \\?\ paths are required to exceed MAX_PATH (a paltry 260 characters) or to avoid q

Re: How to access installed scripts on Windows?

2017-02-18 Thread eryk sun
On Sat, Feb 18, 2017 at 8:38 PM, ddbug wrote: > I am very perplexed by inability to tell the Windows installer (bdist_wininst > or pip) where to > install scripts (or "entry points"). > > By default (and I don't see other options) scripts go to > %USERPROFILE%/Appdata/Roaming/Python/Scripts. Tha

Re: Python application launcher (for Python code)

2017-02-21 Thread eryk sun
On Tue, Feb 21, 2017 at 1:25 AM, Steve D'Aprano wrote: > (2) Add each category to the PYTHONPATH. One easy way to do so is by adding > the directories to a .pth file. PYTHONPATH isn't a synonym for sys.path. The PYTHONPATH environment variable gets used by every installed interpreter, which can b

Re: [Glitch?] Python has just stopped working

2017-02-23 Thread eryk sun
On Thu, Feb 23, 2017 at 8:14 AM, wrote: > W dniu wtorek, 16 lutego 2016 21:09:50 UTC+1 użytkownik Theo Hamilton napisał: >> I woke up two days ago to find out that python literally won't work any >> more. I have looked everywhere, asked multiple Stack Overflow questions, >> and am ready to give u

Re: Python 3.6 installation doesn't add launcher to PATH

2017-02-24 Thread eryk sun
On Fri, Feb 24, 2017 at 12:38 PM, ChrisW wrote: > However, I've installed Python 3.6 with the 'include PATH' checkbox ticked > for my user only, and although C:\Windows\py.exe exists, it has not been > added to my PATH. > > I also tried installing for all users, and this also doesn't add it to the

Re: Python 3.6 installation doesn't add launcher to PATH

2017-02-26 Thread eryk sun
On Sun, Feb 26, 2017 at 3:09 PM, ChrisW wrote: > On Saturday, 25 February 2017 07:21:30 UTC, eryk sun wrote: >> On Fri, Feb 24, 2017 at 12:38 PM, ChrisW wrote: >> > However, I've installed Python 3.6 with the 'include PATH' checkbox ticked >> > for my

Re: Odd wording it docs for shutil.move?

2017-03-03 Thread eryk sun
On Fri, Mar 3, 2017 at 5:13 PM, Grant Edwards wrote: > At https://docs.python.org/2/library/shutil.html it says: > > shutil.move(src, dst) > > Recursively move a file or directory (src) to another location > (dst). > > [...] > > If the destination is on the current filesystem, the

Re: How to access installed scripts on Windows?

2017-03-05 Thread eryk sun
On Sun, Mar 5, 2017 at 2:35 AM, ddbug wrote: > >> You can also develop using venv virtual environments. You can symlink >> or shell-shortcut to the activation script of a virtual environment. > > Interesting idea. But I have not seen any installers or guidance how to > deploy something packaged >

Re: Export Event log via python in .txt

2017-03-06 Thread eryk sun
On Mon, Mar 6, 2017 at 3:36 PM, wrote: > I'm a student learning about python I would like to know how to export > Security log Application and generate folder path via python please help If you're asking about the Windows event logs, then it'll be easiest from a scripting POV to use wevtutil.exe

Re: Importing with ctypes in Python: fighting overflows

2017-03-07 Thread eryk sun
On Tue, Mar 7, 2017 at 12:45 PM, wrote: > Importing with ctypes in Python: fighting overflows: > https://www.cossacklabs.com/blog/fighting-ctypes-overflows.html C int is 32-bit on all platforms currently supported by CPython -- both 32-bit and 64-bit. It's the default result type and the default

Re: No module named 'encodings' Python 3.6 on Windows 10 failure

2017-03-07 Thread eryk sun
On Wed, Mar 8, 2017 at 1:24 AM, wrote: > > Every attempt to make Python 3.6.0 or 3.6.1rc1 to run on Windows 10 > has resulted in the error message shown below. I was running Python > 3.5.2 successfully and wanted to upgrade. > > C:\Python36-32>python > Fatal Python error: Py_Initialize: unable t

Re: Compiling new Pythons on old Windows compilers

2017-03-12 Thread eryk sun
On Sun, Mar 12, 2017 at 5:02 PM, Eric Frederich wrote: > Any idea why compatibility was dropped recently? There used to be a PC > directory with different VS directories in the source tree, now it isn't > there any more. CPython 3.5+ uses the Universal CRT on Windows, which is a system component

Re: When will os.remove fail?

2017-03-13 Thread eryk sun
On Sun, Mar 12, 2017 at 5:48 PM, Steve D'Aprano wrote: > > Does os.remove work like this under Windows too? os.remove calls DeleteFile on Windows. This in turn calls NtOpenFile to instantiate a kernel File object that has delete access and return a handle to it. Next it calls NtSetInformationFile

Re: When will os.remove fail?

2017-03-14 Thread eryk sun
On Tue, Mar 14, 2017 at 11:32 AM, Steve D'Aprano wrote: > On Mon, 13 Mar 2017 08:47 pm, eryk sun wrote: > >> One hurdle to getting delete access is the sharing mode. If there are >> existing File objects that reference the file, they all have to share >> delete acc

Re: When will os.remove fail?

2017-03-14 Thread eryk sun
On Tue, Mar 14, 2017 at 1:07 PM, Chris Angelico wrote: > On Tue, Mar 14, 2017 at 10:32 PM, Steve D'Aprano > wrote: > >> I take it that you *can* delete open files, but only if the process that >> opens them takes special care to use "delete sharing". Is that correct? > > Yes, but you can't always

Re: When will os.remove fail?

2017-03-14 Thread eryk sun
On Tue, Mar 14, 2017 at 7:01 PM, Grant Edwards wrote: > > 1. I think I can see the VMS heritage of Windows shining through. That's not surprising considering that VMS and NT have the same architect -- Dave Cutler -- and that I/O system and file systems were design by former DEC programmers that h

Re: When will os.remove fail?

2017-03-14 Thread eryk sun
On Tue, Mar 14, 2017 at 10:05 PM, Dennis Lee Bieber wrote: > On Wed, 15 Mar 2017 00:07:32 +1100, Chris Angelico > >>Yes, but you can't always control the process that opens them. For >>example, it's annoyingly difficult to update a running executable. >> > I wouldn't be surprised if Windows mmap(

Re: python script Non-ASCII character

2017-03-19 Thread eryk sun
On Sun, Mar 19, 2017 at 11:06 PM, MRAB wrote: > > If you're using Unicode string literals, your choices are: > > 1. Raw string literals: > > var1 = ur"C:\Users\username\Desktop\η γλωσσα μου\mylanguage\myfile" Raw unicode literals are practically useless in Python 2. They're not actually raw b

Re: Subprocess .wait() is not waiting

2017-03-24 Thread eryk sun
On Fri, Mar 24, 2017 at 6:42 PM, adam.c.bernier wrote: > > I am on Windows 7. Python 2.7 > > I'm trying to have a program run another program using `subprocess.Popen` > > import subprocess as sp > > args = shlex.split(args) Is this command supposed to run cross-platform? If not, then spli

Re: Subprocess .wait() is not waiting

2017-03-24 Thread eryk sun
On Fri, Mar 24, 2017 at 8:24 PM, Ian Kelly wrote: > On Fri, Mar 24, 2017 at 2:09 PM, Chris Angelico wrote: > >> Errr been a while since I messed with Windows from memory, I >> think you can "start /wait programname" to make it wait?? Worth a try, >> at least. > > start /wait is for batch

Re: Subprocess .wait() is not waiting

2017-03-24 Thread eryk sun
On Fri, Mar 24, 2017 at 8:44 PM, adam.c.bernier wrote: > On Friday, March 24, 2017 at 1:37:49 PM UTC-7, eryk sun wrote: > >> Without knowing the command you're running, all we can do is >> speculate. It could be that it's an application that uses a single >&g

Re: Installation issue with Python 3.6.1 for 64 bit Windows

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 4:01 AM, arjun.janah wrote: > > I ran the file and it appeared to install properly. But when I tried to run > Python from > the Windows All Programs menu tab, I got the following message, in a small > window by the window with a black screen: >

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 3:37 PM, Chris Angelico wrote: > > Just use Unicode. Everything else, these days, is a subset of Unicode > anyway. Unless you're stuck on the default Windows shell/terminal, you > should be able to use UTF-8 everywhere and have the entire Unicode > range available. The Win

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 5:29 PM, Chris Angelico wrote: > Rounded corners? > > ╭─┬─╮ > ├─┼─┤ > ╰─┴─╯ This prints fine in the Windows console with Consolas as the font, but the older Courier New and Lucida Console fonts lack glyphs for the rounded corners. -- https://mail.python.org/mailman/listin

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 5:58 PM, Chris Angelico wrote: >> The Windows console can render any character in the BMP, but it >> requires configuring font linking for fallback fonts. It's Windows, so >> of course the supported UTF format is UTF-16. The console's UTF-8 >> support (codepage 65001) is to

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 5:49 PM, eryk sun wrote: > On Sun, Mar 26, 2017 at 5:29 PM, Chris Angelico wrote: >> Rounded corners? >> >> ╭─┬─╮ >> ├─┼─┤ >> ╰─┴─╯ > > This prints fine in the Windows console with Consolas as the font, but > the older Courier Ne

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 6:57 PM, Chris Angelico wrote: > > In actual UCS-2, surrogates are entirely disallowed; in UTF-16, they *must* be > correctly paired. Strictly-speaking UCS-2 disallows codes that aren't defined by the standard, but the kernel couldn't be that restrictive. Unicode was a mov

Re: Python under PowerShell adds characters

2017-03-29 Thread eryk sun
On Wed, Mar 29, 2017 at 4:06 PM, wrote: > I wrote a Python script, which executed as intended on Linux and > from cmd.exe on Windows. Then, I ran it from the PowerShell >command line, all print statements added ^@ after every character. ISE is the only command-line environment that's specific t

Re: Python under PowerShell adds characters

2017-03-29 Thread eryk sun
On Wed, Mar 29, 2017 at 5:42 PM, Jay Braun wrote: > > I'm not using ISE. I'm using a pre-edited script, and running it with the > python command. > > Consider the following simple script named hello.py (Python 2.7): > > print "Hello" > > If I enter: > python hello.py > out.txt > > from cmd.exe I

Re: Python under PowerShell adds characters

2017-03-29 Thread eryk sun
On Wed, Mar 29, 2017 at 7:13 PM, Marko Rauhamaa wrote: > eryk sun : >> PowerShell is far more invasive. Instead of giving the child process a >> handle for the file, it gives it a handle for a *pipe*. PowerShell >> reads from the pipe, and like an annoying busybody that no

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-04-01 Thread eryk sun
On Sat, Apr 1, 2017 at 4:55 PM, Chris Angelico wrote: > On Sun, Apr 2, 2017 at 2:43 AM, Marko Rauhamaa wrote: >> Steve D'Aprano : >> >>> Open your eyes, there is a whole world past the borders of your insular, >>> close-minded little country. 95% of the world is not American, and there >>> are mi

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-04-01 Thread eryk sun
On Sat, Apr 1, 2017 at 5:38 PM, Steve D'Aprano wrote: > Or, for Windows, I suppose a dozen or so more characters: > > https://support.office.com/en-us/article/Invalid-characters-in-file-or-folder-names-or-invalid- > file-types-in-OneDrive-for-Business-64883A5D-228E-48F5-B3D2-EB39E07630FA It's mor

Re: VirtualEnvs (venv) and Powershell

2017-04-01 Thread eryk sun
On Sat, Apr 1, 2017 at 12:03 AM, Carl Caulkett wrote: > I've just started to investigate VirtualEnvironments as a means of > preventing my 3rd party code becoming chaotic. I've discovered that > venv's can be managed quite effectively using Powershell. When > Activate.ps1 is run, the PowerShell ch

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread eryk sun
On Mon, Apr 3, 2017 at 9:08 AM, Paul Moore wrote: > I know I've seen this before, but for the life of me I can't find any > reference. > > If I write a simple web server using wsgiref, something like > > from wsgiref.simple_server import make_server, demo_app > > with make_server('', 800

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread eryk sun
On Mon, Apr 3, 2017 at 12:34 PM, Paul Moore wrote: > On Monday, 3 April 2017 13:23:11 UTC+1, eryk sun wrote: >> It works for me when run from a command prompt in Windows 10. >> serve_forever() uses select() with a timeout of 0.5s, so it doesn't >> block the main t

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread eryk sun
On Mon, Apr 3, 2017 at 1:20 PM, Paul Moore wrote: > On Monday, 3 April 2017 14:00:18 UTC+1, eryk sun wrote: >> It should service the request and return to the serve_forever() loop. >> Do you see a line logged for each request, like "[IP] - - [date] "GET >> ...&quo

Re: Which directory should requests and openpyxl modules be installed to?

2017-04-03 Thread eryk sun
On Tue, Apr 4, 2017 at 1:45 AM, Dennis Lee Bieber wrote: > > C:\Users\Wulfraed>assoc .py > .py=Python.File > > C:\Users\Wulfraed>ftype python.file > python.file="C:\Python27\python.exe" "%1" %* The Windows shell stores the user file-association choice in HKCU\Software\Microsoft\Windows\CurrentVer

Re: Problem installing 3.6.1 AMD64

2017-04-05 Thread eryk sun
On Wed, Apr 5, 2017 at 6:46 PM, Colin J. Williams wrote: >Successful install reported, but: > > Microsoft Windows [Version 10.0.14393] > (c) 2016 Microsoft Corporation. All rights reserved. You're using Windows 10. > C:\Users\CJW>cd\python > The system cannot find the pat

Re: Problem installing 3.6.1 AMD64

2017-04-05 Thread eryk sun
On Thu, Apr 6, 2017 at 12:12 AM, MRAB wrote: import os [p for p in os.environ['PATH'].split(';') if 'Python35' in p] > > Remove those references from the PATH environment variable: > os.environ['PATH'] = ';'.join(p for p in os.environ['PATH'].split(';') if 'Python35' not in p)

Re: Installing Python 3.6.1 on a Windows 10

2017-04-10 Thread eryk sun
On Mon, Apr 10, 2017 at 3:45 PM, Colin J. Williams wrote: > Below is the tail of my Install Log. > Is this a problem that I should be able to resolve? > Advice sought. Open a Windows / Installation issue on bugs.python.org. Zip up the installation logs and attach the zip to the issue. -- https:/

Re: IOError: [Errno 12] Not enough space

2017-04-11 Thread eryk sun
On Tue, Apr 11, 2017 at 12:30 PM, LnT wrote: > Opening browser 'firefox' to base url 'https://onbdev.nbpa.com/zae' > [ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: > No browser is open > | FAIL | > IOError: [Errno 12] Not enough space >

Re: Calling dunder methods manually

2017-04-13 Thread eryk sun
On Thu, Apr 13, 2017 at 5:29 AM, Steven D'Aprano wrote: > Should you call dunder methods (Double leading and trailing UNDERscores) > manually? For example: > > > my_number.__add__(another_number) > > > The short answer is: > > NO! In general, you shouldn't do it. > > > Guido recently commented: >

Re: Calling dunder methods manually

2017-04-13 Thread eryk sun
On Thu, Apr 13, 2017 at 5:29 AM, Steven D'Aprano wrote: > > my_number.__add__(another_number) > > The short answer is: > > NO! In general, you shouldn't do it. For example: class C: def __add__(self, other): return NotImplemented class D: def __radd__(self, o

Re: Calling dunder methods manually

2017-04-13 Thread eryk sun
On Thu, Apr 13, 2017 at 8:24 AM, Chris Warrick wrote: > On 13 April 2017 at 09:43, eryk sun wrote: >> The functions in the operator module implement abstract behavior (e.g. >> PyNumber_Add in CPython): >> >> >>> operator.__add__(C(), D()) >>

Re: Check multiple file parms in single os.access?

2017-04-13 Thread eryk sun
On Thu, Apr 13, 2017 at 1:46 PM, Ben Bacarisse wrote: > James McMahon writes: > >> Is there a way to mask the F_OK, R_OK, and W_OK in a single os.access >> call? I'm guessing there must be, rather than doing this >> >> if ( os.access(fqfname,os.F_OK) and os.access(fqfname,os.R_OK) and >> os.acces

Re: Buffers and pointers (Py3.4)

2017-04-17 Thread eryk sun
On Mon, Apr 17, 2017 at 5:58 PM, Rob Gaddi wrote: > buffertype = c_uint8 * size > return addressof(buffertype.from_buffer(buf, offset)) > > works but is inefficient and woefully inelegant. A lot of the cost there is in creating buffertype, but why do you need that? You can use c_char.from_buffer

Re: Unable to use Python IDLE after downloading the application

2017-04-17 Thread eryk sun
On Mon, Apr 17, 2017 at 9:06 PM, ASHISH A wrote: > > I could not launch IDLE and it gave me an error saying DLL file missing > (attached snapshot). python-list doesn't send attachments. Please do your best to paraphrase error messages that can't be pasted as plain text. > I have downloaded the D

Re: Looping [was Re: Python and the need for speed]

2017-04-17 Thread eryk sun
On Tue, Apr 18, 2017 at 1:37 AM, MRAB wrote: > In Python 3 it's: > > c = next(itertools.dropwhile( > lambda c: c==' ', > iter(lambda: sys.stdin.read(1),None) > )) iter's sentinel should be an empty string. -- https://mail.python.org/mailman/listinfo/python-list

Re: Rawest raw string literals

2017-04-20 Thread eryk sun
On Thu, Apr 20, 2017 at 5:27 PM, Chris Angelico wrote: > On Fri, Apr 21, 2017 at 2:26 AM, wrote: >> I find this:- >> >> s = r"ffmpeg -i '\\server-01\D\SER_Bigl.mpg' " >> >> vastly superior. > > It's semantically different though. I don't know whether single quotes > are valid in that context, o

Re: OrderedDict with kwds

2017-04-22 Thread eryk sun
On Fri, Apr 21, 2017 at 6:08 PM, Albert-Jan Roskam wrote: > Would the insertion order be preserved if the last line were to be > replaced with: > > if kwds: > for k, v in kwds.items(): > self[k] = v > if args: > self.__update(*args) # no **kwds! The basic problem is that kwds is

Re: String escaping utility for Python (was: Rawest raw string literals)

2017-04-22 Thread eryk sun
On Sun, Apr 23, 2017 at 2:06 AM, Mikhail V wrote: > > But are you joking, right? Even if it worked, how can this be convinient, > e.g. in console one cannot even select and copy paste easily. The X terminals that I've used make it easy to copy text to the clipboard. For Windows, it's a pain prior

Re: I encounter a problem during installations!!!

2017-04-26 Thread eryk sun
On Wed, Apr 26, 2017 at 2:51 PM, Paul Moore wrote: > > You could probably also install the UCRT manually from > https://www.microsoft.com/en-us/download/details.aspx?id=48234. KB3118401 is a more recent version. https://support.microsoft.com/en-us/kb/3118401 -- https://mail.python.org/mailman/

Re: Unable to subclass ctypes.c_uint64: was: Re: Battle of the garbage collectors, or ARGGHHHHHH!!!!

2017-04-27 Thread eryk sun
On Thu, Apr 27, 2017 at 8:55 PM, CFK wrote: > > I'm still working on fixing the battle of the garbage collectors, but as a > part of that work I've realized that it would be handy for me to subclass > various ctypes like so: > > """ > from ctypes import * > class foo(c_uint64): > def __init__(

Re: "Edit with IDLE" doesn't work any more ?

2017-04-28 Thread eryk sun
On Fri, Apr 28, 2017 at 12:04 PM, Yip, Kin wrote: > > I've tried to do : > > "c:\program files\python36\pythonw.exe" -m idlelibmypythoncodes.py Change this to use "python.exe" and run it from a command prompt. This way you can see the traceback if an exception is raised. -- https://mail.py

Re: "Edit with IDLE" doesn't work any more ?

2017-04-28 Thread eryk sun
On Fri, Apr 28, 2017 at 12:32 PM, Yip, Kin wrote: > Traceback (most recent call last): > File "c:\Program Files\Python36\lib\idlelib\pyshell.py", line 4, in > from tkinter import * > File "C:\Users\kinyip\Desktop\Python Codes\tkinter.py", line 1, in > from turtle import * > File "c

Re: tempname.mktemp functionality deprecation

2017-05-01 Thread eryk sun
On Sat, Apr 29, 2017 at 6:45 PM, Tim Chase wrote: > Working on some deduplication code, I want do my my best at > performing an atomic re-hard-linking atop an existing file, akin to > "ln -f source.txt dest.txt" > > However, when I issue > > os.link("source.txt", "dest.txt") > > it fails with an

Re: how to share/access variables from multiprocessing target function

2017-05-03 Thread eryk sun
On Wed, May 3, 2017 at 2:04 PM, Iranna Mathapati wrote: > how to share/access the " global returndict_st_FP,returndict_st_RP" target > function variables acors the main program.. You can share a dict using a Manager. https://docs.python.org/3/library/multiprocessing.html#managers -- https://ma

Re: Python 2.7: no such module pip

2017-05-04 Thread eryk sun
On Thu, May 4, 2017 at 8:24 PM, jeff saremi wrote: > Did a fresh install of python-2.7.amd64.msi on windows 10. > > The install finishes with success. Python runs. No pip when the following is > run: > > C:\> python -m pip install elastalert > C:\Python27\python.exe: No module named pip Maybe yo

Re: Python 2.7 on Windows: Copy&Paste install

2017-05-04 Thread eryk sun
On Thu, May 4, 2017 at 8:27 PM, jeff saremi wrote: > I have scoured the net for any hints on this. We have some prod machines > where we're not able to run MSI installations. > Is it possible to copy Python2.7 from say c:\Python2.7 from one machine to > another? > What other steps do we need bey

Re: Python 2.7: no such module pip

2017-05-05 Thread eryk sun
On Fri, May 5, 2017 at 4:30 PM, jeff saremi wrote: > i checked the installation again. There is no option to select or deselect > PIP. I installed with everything included. No pip module is present despite > the fact that Python documentation says that PIP is a part of Python > installation and do

Re: Python 2.7: no such module pip

2017-05-05 Thread eryk sun
On Fri, May 5, 2017 at 4:57 PM, jeff saremi wrote: > > There is no such option in the installation. Please take a look at the > screenshot I enclosed. Sorry, I overlooked that you said you're installing "python-2.7.amd64.msi" -- as in 2.7.0. Please download and install 2.7.13: https://www.python

Re: Low level I/O: because I could

2017-05-10 Thread eryk sun
On Wed, May 10, 2017 at 10:30 PM, Rob Gaddi wrote: > Sorry, but I'm just too proud of this. > > Given that you have: > > class RegisterLayout(ctypes.Structure): > ...yadayadayada... > > You can then: > > fh = os.open('/dev/devicethingy', os.O_RDWR) > mm = mmap.mmap(fh, ctypes.sizeof(Regi

Re: Embedded Python import fails with zip/egg files (v3.6.1)

2017-05-11 Thread eryk sun
On Thu, May 11, 2017 at 9:02 PM, Griebel, Herbert wrote: > > 07:59:04,3205458python.exe4224CreateFile > C:\Users\hansi\Downloads\python-emb\python36.zipSUCCESS Desired Access: > Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO > Non-Alert, Open Reparse Point

Re: Out of memory while reading excel file

2017-05-12 Thread eryk sun
On Fri, May 12, 2017 at 8:03 PM, Peter Otten <__pete...@web.de> wrote: > I don't have a Windows system to test, but doesn't that mean that on Windows > > with open("tmp.csv", "w") as f: > csv.writer(f).writerows([["one"], ["two"]]) > with open("tmp.csv", "rb") as f: > print(f.read()) > > wo

Re: How to install Python package from source on Windows

2017-05-14 Thread eryk sun
On Sun, May 14, 2017 at 8:46 PM, Deborah Swanson wrote: > I want to install the recordclass package: > https://pypi.python.org/pypi/recordclass > > But they've only released wheel files for two platforms, macosx and > win_amd64, neither of which will install on my system. I need win_x86 or > intel

Re: How to install Python package from source on Windows

2017-05-14 Thread eryk sun
On Mon, May 15, 2017 at 4:19 AM, Deborah Swanson wrote: > Unfortunately I don't have Visual Studio 2015+ installed and I can't > install it on Windows XP SP2 (plus I really don't want to). Probably I > should have mentioned that, but I didn't know I'd need to build C/C++. 3.5+ doesn't work in XP,

Re: How to install Python package from source on Windows

2017-05-15 Thread eryk sun
On Mon, May 15, 2017 at 6:37 AM, Deborah Swanson wrote: > > Where did you find recordclass-0.4.3-cp34-cp34m-win32.whl? There > weren't any win32 builds on https://pypi.python.org/pypi/recordclass. It's in the middle of the file list: recordclass-0.4.3-cp34-cp34m-win32.whl (md5) Python Wheel

Re: How to install Python package from source on Windows

2017-05-15 Thread eryk sun
On Mon, May 15, 2017 at 7:43 PM, MRAB wrote: > On 2017-05-15 13:52, eryk sun wrote: >> >> The wheel doesn't need a compiler. It has an ABI tag because it >> already includes the compiled extension module. >> > I used pip to install into Python 3.4 (32-bit) f

<    1   2   3   4   5   6   7   >