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 Window

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 syste

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

Re: How to install Python package from source on Windows

2017-05-15 Thread eryk sun
On Tue, May 16, 2017 at 12:51 AM, Chris Angelico wrote: > > The Python.org support policy is that Python X.Y will be > supported on Windows Z if and only if Windows Z was supported by > Microsoft as of when Python X.Y.0 was released. Python 3.4 is the last to support XP (2014-04-08 EOL). Python 3

Re: How to install Python package from source on Windows

2017-05-19 Thread eryk sun
On Fri, May 19, 2017 at 1:57 PM, bartc wrote: >> Yes, we acknowledge that there's much improvement needed to building >> Python, especially on Windows. > > The 'improvement' seems to involve making things more complicated rather > than less. > > (So I need VS2015, .NET, GIT, SVN and MSBUILD. Or ma

Re: How to install Python package from source on Windows

2017-05-19 Thread eryk sun
On Wed, May 17, 2017 at 10:49 PM, Michael Torrie wrote: > > In fact Python 3.6 ships with the latest version of the MSVCRT universal > runtime. Windows Python 3.6 is distributed with vcruntime140.dll, which is a relatively small component of the CRT that's closely coupled to the compiler. The Un

Re: How to install Python package from source on Windows

2017-05-19 Thread eryk sun
On Fri, May 19, 2017 at 9:18 PM, bartc wrote: > On 19/05/2017 19:53, eryk sun wrote: >> >> On Fri, May 19, 2017 at 1:57 PM, bartc wrote: > > >>> The 'improvement' seems to involve making things more complicated rather >>> than less. > > &

Re: How to install Python package from source on Windows

2017-05-22 Thread eryk sun
On Sun, May 21, 2017 at 5:40 PM, bartc wrote: > I think it was YOU that got me wasting time downloading that VS2015 > solution, all 1MB of it [download size; unknown installation size], Visual Studio installs a multi-architecture (x86, x64, arm, arm64) build environment for nati

Re: How to install Python package from source on Windows

2017-05-24 Thread eryk sun
On Thu, May 25, 2017 at 12:18 AM, Deborah Swanson wrote: > > When I tried to upgrade pip it failed because it could neither > find nor install Visual Studio 2015. Installing and upgrading pip does not require a C compiler. > So now I'm pipless. Read the thread if you want to know why I don't hav

Re: How to install Python package from source on Windows

2017-05-25 Thread eryk sun
On Thu, May 25, 2017 at 4:09 PM, Deborah Swanson wrote: > Could be, maybe it's something they do for every installation, whether > it will use it or not. But it always breaks when it can't install Visual > Studio. Upgrade pip does run and it works up to that point. It gets as > far as uninstalling

Re: How to install Python package from source on Windows

2017-05-25 Thread eryk sun
On Thu, May 25, 2017 at 11:11 PM, Deborah Swanson wrote: > Unfortunately I deleted that message and now I no longer have a pip You still have ensurepip to be able to install and upgrade pip: python -m ensurepip --verbose --default-pip python -m pip install --upgrade pip Or use get-pip.p

Re: Access flles on a Android device from Windows PC

2017-06-06 Thread eryk sun
On Tue, Jun 6, 2017 at 7:36 PM, Fred Fishbin wrote: > > I want to write little program that my friend can run - he'll plug a USB drive > into his Windows 7 PC, plug his phone in a USB port on same PC, then run my > program and it'll xfer some audiobook files over for him. > > I plugged the USB dri

Re: Question about propagating universal_newlines through subprocess.Popen to io.TextIOWrapper

2017-06-26 Thread eryk sun
On Mon, Jun 26, 2017 at 5:23 PM, Bill Deegan wrote: > > That universal_newlines value is discarded due to: > > text_mode = encoding or errors or universal_newlines > > ... > > if text_mode: > self.stdout = io.TextIOWrapper(self.stdout, > encoding=encoding, errors=errors) > > There

Re: Question about propagating universal_newlines through subprocess.Popen to io.TextIOWrapper

2017-06-26 Thread eryk sun
On Mon, Jun 26, 2017 at 8:59 PM, Bill Deegan wrote: > > Ideally (for my use case) it would be something which propagated > universal_newlines to io.TextIOWrapper().. rather than discards it. > In my case I want the stdout to be encoded utf-8, but I do not want \r's > changed to \n's as my test sys

Re: "Python launcher" required to run *.py scripts on Windows?

2017-06-27 Thread eryk sun
On Tue, Jun 27, 2017 at 5:41 AM, Ben S. via Python-list wrote: > > When I always call Python script from CommandPrompt like > > D:\tools\Python\python.exe mypythonscript.py > > then this Launcher should not be necessary. The launcher implements shebang support for directly running Python scripts

Re: sys.exc_info

2017-06-29 Thread eryk sun
On Thu, Jun 29, 2017 at 6:50 AM, Steven D'Aprano wrote: > try: > something > except: > exc_type, exc, tb = sys.exc_info() > print(traceback.extract_tb(tb)) > raise > > Why does it return the exception type separately from the exception, when > the type can be derived by calling `ty

Re: Python installer

2017-06-30 Thread eryk sun
On Fri, Jun 30, 2017 at 8:30 PM, Debiller 777 wrote: > I just get error that there is no module name 'encodings' First make sure that neither PYTHONHOME nor PYTHONPATH are defined in your environment. To check this type `set python` in a command prompt. Neither variable should be listed. -- http

Re: Python threading and sharing variables

2017-07-05 Thread eryk sun
On Wed, Jul 5, 2017 at 12:14 PM, Peter Otten <__pete...@web.de> wrote: > Chris Angelico wrote: > >> You can be confident that a single assignment will happen atomically. >> Even if "self.cnt = i" requires multiple instructions to perform > > For name binding > > cnt = i > > maybe, but > > self.cnt

Re: Python threading and sharing variables

2017-07-05 Thread eryk sun
On Wed, Jul 5, 2017 at 2:03 PM, Chris Angelico wrote: > On Wed, Jul 5, 2017 at 11:50 PM, eryk sun wrote: >> Assignment of a single variable in an unoptimized namespace isn't >> completely immune to this -- in principle. Think __setitem__, >> __getitem__, __hash_

Re: Python threading and sharing variables

2017-07-05 Thread eryk sun
On Wed, Jul 5, 2017 at 4:04 PM, Chris Angelico wrote: > On Thu, Jul 6, 2017 at 12:39 AM, eryk sun wrote: >>> This doesn't show a potential concurrency problem. Calculating a hash >>> on "cnt" is independent of other threads; the actual work of >>>

Re: Python threading and sharing variables

2017-07-05 Thread eryk sun
On Wed, Jul 5, 2017 at 5:06 PM, Chris Angelico wrote: > On Thu, Jul 6, 2017 at 2:24 AM, eryk sun wrote: >>> But what could it do? Most likely, it's going to end up mutating a >>> dict (the core type), so unless the __setitem__ is itself maintaining >>> complex

Re: Check Python version from inside script? Run Pythons script in v2 compatibility mode?

2017-07-07 Thread eryk sun
On Fri, Jul 7, 2017 at 7:53 AM, Steve D'Aprano wrote: > On Fri, 7 Jul 2017 04:30 pm, Ben S. wrote: > >> Is there a way to execute a python script with v3 python engine in v2 >> compatibility mode? I am thinking about a command parameter like (python.exe >> is v3.*): >> >> python.exe -execute_as_

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread eryk sun
On Tue, Jul 25, 2017 at 8:43 AM, Chris Angelico wrote: > > I'm not actually sure what happens if you use a global declaration at > top level. Is it ignored? Is it an error? It isn't ignored, but it shouldn't make a difference since normally at module level locals and globals are the same. It make

Re: If you are running 32-bit 3.6 on Windows, please test this

2017-09-01 Thread eryk sun
On Fri, Sep 1, 2017 at 3:23 AM, Peter Otten <__pete...@web.de> wrote: > > I think you have to specify the types yourself: > import ctypes libm = ctypes.cdll.LoadLibrary("libm.so") libm.sqrt(42) > 0 libm.sqrt.argtypes = [ctypes.c_double] libm.sqrt.restype = ctypes.c_double >

Re: If you are running 32-bit 3.6 on Windows, please test this

2017-09-01 Thread eryk sun
On Fri, Sep 1, 2017 at 2:24 AM, Pavol Lisy wrote: > > I was trying to call sqrt using ctypes from msvcrt but I am not succesful: > > import ctypes > msc = ctypes.windll.msvcrt msvcrt.dll is private to Windows components. It's not intended for applications. See my previous post in this thread for

Re: Delay a computation in another thread

2017-09-02 Thread eryk sun
On Sat, Sep 2, 2017 at 5:53 AM, Steve D'Aprano wrote: > > The problem is that after the message is printed, the REPL's prompt is > disrupted. This is especially annoying when I'm in the middle of typing a > line. > This is just a cosmetic flaw, but it would be nice if I could tell Python to > red

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Eryk Sun via Python-list
On 6/7/23, Thomas Passin via Python-list wrote: > > You have by now seen several responses, and the one most likely to be > helpful is to run pip with > > py -m pip That won't be of any help if pip isn't installed. By default, Python's installer attempts to install pip by running the ensurepip pa

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-08 Thread Eryk Sun via Python-list
On 6/7/23, Thomas Passin via Python-list wrote: > On 6/7/2023 6:28 PM, Eryk Sun wrote: > >> That won't be of any help if pip isn't installed. By default, Python's >> installer attempts to install pip by running the ensurepip package, >> but sometimes it fa

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-08 Thread Eryk Sun via Python-list
On 6/8/23, Thomas Passin via Python-list wrote: > > It always gets installed, though. By default, the option to install pip is enabled. It's implemented by executing ensurepip after the interpreter is installed. However, ensurepip may silently fail during installation. As a CPython triager I've c

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-10 Thread Eryk Sun via Python-list
On 6/10/23, Thomas Passin via Python-list wrote: > > We can find pip.exe using good old-fashioned dir (we don't need any > new-fangled Powershell): > > C:\Users\tom>dir AppData\Local\Programs\Python /Aa /S /W /B |find > "pip"|find "Scripts" CMD's `dir` and `for` commands support simple wildcard m

Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-10 Thread Eryk Sun via Python-list
On 6/10/23, Thomas Passin via Python-list wrote: > > Yes; I didn't want to get too esoteric with commands that are hard to > figure out and remember, because then why not use Powershell, whose > commands are hard to figure out and remember? Using `dir /s [/ad] [/b] "[path\]pattern"` with a wildca

Re: Compiling python on windows with vs

2023-06-13 Thread Eryk Sun via Python-list
On 6/13/23, Thomas Schweikle via Python-list wrote: > > Since Git enables Windows NTFS case sensitivity while checking out > sources ... is it a bug or a "feature"? And: is there a simple AFAIK the Windows version of Git (you're not using the Linux version of Git via WSL, right?) does not automat

Re: Compiling python on windows with vs

2023-06-14 Thread Eryk Sun via Python-list
On 6/14/23, Inada Naoki via Python-list wrote: >> Since Git enables Windows NTFS case sensitivity while checking out sources > > I didn't know that. Would you give us a link to this feature? > As far as I know, `git config core.ignorecase` doesn't mean NTFS case > sensitive. If a repo is cloned i

Re: Compiling python on windows with vs

2023-06-15 Thread Eryk Sun via Python-list
On 6/15/23, Thomas Schweikle via Python-list wrote: > > In this case: not sure what is going on. Possibly you have a setting configured that affects the behavior of Git via the MinGW-w64 runtime, such that calling mkdir() ends up calling NtSetInformationFile() to set the FileCaseSensitiveInformat

Re: Compiling python on windows with vs

2023-06-15 Thread Eryk Sun via Python-list
On 6/15/23, Thomas Schweikle via Python-list wrote: > > No. This flag is not inherited. Someone has to set it for created > directories. It is easy to confirm: take a directory not under MSYS or > cygwin control (because it is mounted by MSYS or cygwin), set the flag, > then create directories. Th

Re: win32clipboard writing to clipboard on Windows 11

2024-06-18 Thread Eryk Sun via Python-list
On Mon, Jun 17, 2024 at 8:36 PM MRAB via Python-list wrote: > On 2024-06-17 20:27, Rob Cliffe via Python-list wrote: > > > SetClipboardData(CF_UNICODETEXT, "0") > > CloseClipboard() win32clipboard.SetClipboardData() first tries to covert the second argument as an integer handle to global memory,

Re: win32clipboard writing to clipboard on Windows 11

2024-06-18 Thread Eryk Sun via Python-list
On Tue, Jun 18, 2024 at 2:19 AM Eryk Sun wrote: > > > def set_clipboard_text(text): > hMem = global_alloc_text(text) > try: > win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, > hMem) &g

<    2   3   4   5   6   7