Re: MTG: Introductions to PyQt and DataClasses
Actually, I have a sleep disorder that requires me to keep a constant sleep schedule. Thats why I asked. Sent from my iPhone > On Mar 17, 2024, at 3:36 PM, dn via Python-list > wrote: > > On 17/03/24 23:40, Jim Schwartz wrote: >> Will it be recorded? > > Better than that (assumption) "coming soon" - please join-up or keep an eye > on PySprings' Meetup ANNs: https://www.meetup.com/pysprings/ > > >>>> On Mar 17, 2024, at 1:47 AM, dn via Python-list >>>> wrote: >>> >>> The Auckland Branch of NZPUG meets this Wednesday, 20 March at 1830 NZDT >>> (0530 UTC, midnight-ish Tue/Wed in American time-zones), for a virtual >>> meeting. >>> >>> Part 1: Learn the basics of PyQt with code examples. >>> Hannan Khan is currently consulting as a Data Scientist for the (US) >>> National Oceanic and Atmospheric Administration. He holds a Bachelor's >>> degree in Neuroscience as well as a Masters in Computer Science. As a keen >>> member of the PySprings Users' Group (Colorado), his contribution is part >>> of a collaboration between our two PUGs. >>> >>> Part 2: Why use Dataclasses? >>> - will be the question asked, and answered, by yours truly. After surveying >>> a number of groups, it seems most of us know that Dataclasses are >>> available, but we don't use them - mostly because we haven't ascertained >>> their place in our tool-box. By the end of this session you will, and will >>> have good reason to use (or not) Dataclasses! >>> >>> Everyone is welcome from every location and any time-zone. The NZPUG Code >>> of Conduct applies. JetBrains have kindly donated a door-prize. Our >>> BigBlueButton web-conferencing instance is best accessed using Chromium, >>> Brave, Vivaldi, Safari, etc, (rather than Firefox - for now). A head-set >>> will facilitate asking questions but text-chat will be available. >>> >>> Please RSVP at https://www.meetup.com/nzpug-auckland/events/299764049/ >>> See you there! >>> =dn, Branch Leader >>> -- >>> https://mail.python.org/mailman/listinfo/python-list > > -- > Regards, > =dn > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: MTG: Introductions to PyQt and DataClasses
Will it be recorded? Sent from my iPhone > On Mar 17, 2024, at 1:47 AM, dn via Python-list > wrote: > > The Auckland Branch of NZPUG meets this Wednesday, 20 March at 1830 NZDT > (0530 UTC, midnight-ish Tue/Wed in American time-zones), for a virtual > meeting. > > Part 1: Learn the basics of PyQt with code examples. > Hannan Khan is currently consulting as a Data Scientist for the (US) National > Oceanic and Atmospheric Administration. He holds a Bachelor's degree in > Neuroscience as well as a Masters in Computer Science. As a keen member of > the PySprings Users' Group (Colorado), his contribution is part of a > collaboration between our two PUGs. > > Part 2: Why use Dataclasses? > - will be the question asked, and answered, by yours truly. After surveying a > number of groups, it seems most of us know that Dataclasses are available, > but we don't use them - mostly because we haven't ascertained their place in > our tool-box. By the end of this session you will, and will have good reason > to use (or not) Dataclasses! > > Everyone is welcome from every location and any time-zone. The NZPUG Code of > Conduct applies. JetBrains have kindly donated a door-prize. Our > BigBlueButton web-conferencing instance is best accessed using Chromium, > Brave, Vivaldi, Safari, etc, (rather than Firefox - for now). A head-set will > facilitate asking questions but text-chat will be available. > > Please RSVP at https://www.meetup.com/nzpug-auckland/events/299764049/ > See you there! > =dn, Branch Leader > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Python misbehavior
Friends, Please forgive me if this is not the proper forum for dealing with an issue of mine, but I am at a loss in finding a fix for a python problem in the program ClipGrab. The program allows one to download videos or audios from YouTube and other media sites. My limited understanding of the process suggests that python facilitates the transfer of data from YouTube to ClipGrab. As of recently, I am unable to use the ClipGrab program and the issue at fault has something to do with python. In an "about" screen within ClipGrab my (now) incapable python script reads: youtube-dlp: (C:\Program Files (x86)\ClipGrab\python\python.exe: can't find '_main_' module in " ) Python: C:/Program Files (x86)/ClipGrab/python/python.exe (Python 3.8.9) Since this problem began I downloaded ClipGrab on to another desktop computer and it runs perfectly without a problem. The script on the "about" page does not indicate anything about "can't find -main- module" etc. Is there any advice you can offer to overcome this and recover my downloading connections to YouTube? Or, if this is the wrong group to handle such issues, could you please pass my message on to a better choice? Gratefully, Jim Haas Sent from my iPhone -- https://mail.python.org/mailman/listinfo/python-list
Re: fCONV_AUSRICHTG is not defined - Why?
Where do you define fCONV_AUSRICHTG? It must be initialized or defined somewhere. Did you leave out a statement from the python 2 version? Sent from my iPhone > On Nov 7, 2023, at 1:06 PM, Thomas Passin via Python-list > wrote: > > On 11/7/2023 12:47 PM, Egon Frerich via Python-list wrote: >> I've no idea why this happens. In a module there are lists and definitions: >> Felder = [ >> # Name lg1 lg2 typ Ausrichtung Holen Prüfen Prüfvorg >> ["Jahr", 4, 5, "u", "", "right", "center"], >> ["Monat", 2, 5, "u", "", "right", "center"], >> ["Tag", 2, 3, "u", "", "right", "center"], >> ["Belegnr", 5, 7, "s", "", "right", "center"], >> ["Bank", 2, 4, "u", "", "center", "center"], >> ["Art", 2, 3, "u", "", "center", "center"], >> ["Aufg", 2, 4, "u", "", "center", "center"], >> ["Text", 25, 25, "s", "-", "left", "left"], >> ["Ergänzung", 12, 12, "s", "-", "left", "left"], >> ["Betrag", 13, 13, "s", "", "right", "right"], >> ["W", 1, 2, "s", "", "center", "center"], >> ["WBetrag", 7, 7, "s", "", "right", "right"], >> ["Kurs", 6, 6, "s", "", "right", "right"], >> ] >> "Reihenfolge in der Dimension 1" >> ( >> fJAHR, >> fMONAT, >> fTAG, >> fBELEGNR, >> fBANK, >> fART, >> fAUFGABE, >> fTEXT, >> fTEXTERG, >> fBETRAG, >> fWAEHRUNG, >> fBETRAGinWAEHRUNG, >> fUMRECHNUNGSKURS, >> ) = list(range(13)) >> "Reihenfolge in der Dimension 2" >> ( >> fNAME, >> fLG1, >> fLG2, >> fTYP, >> fCONV_AUSRICHTG, >> fENTRY_AUSRICHTG, >> fTEXT_AUSRICHTUNG, >> fHOLFUNKT, >> fPRUEFFUNKT, >> fPRUEF_ARG, >> ) = list(range(10)) >> Two lines with test statements follow and the statement which produces an >> error: >> print(Felder) >> print(fJAHR, fNAME, fTYP, fCONV_AUSRICHTG) >> akette = "%" + "%".join( >> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder]) >> The traceback shows: >> $ python3 testGeldspurGUI.py >> [['Jahr', 4, 5, 'u', '', 'right', 'center'], ['Monat', 2, 5, 'u', '', >> 'right', 'center'], ['Tag', 2, 3, 'u', '', 'right', 'center'], ['Belegnr', >> 5, 7, 's', '', 'right', 'center'], ['Bank', 2, 4, 'u', '', 'center', >> 'center'], ['Art', 2, 3, 'u', '', 'center', 'center'], ['Aufg', 2, 4, 'u', >> '', 'center', 'center'], ['Text', 25, 25, 's', '-', 'left', 'left'], >> ['Ergänzung', 12, 12, 's', '-', 'left', 'left'], ['Betrag', 13, 13, 's', '', >> 'right', 'right'], ['W', 1, 2, 's', '', 'center', 'center'], ['WBetrag', 7, >> 7, 's', '', 'right', 'right'], ['Kurs', 6, 6, 's', '', 'right', 'right']] >> 0 0 3 4 >> Traceback (most recent call last): >> File "/home/egon/Entw/Geldspur/geldspur/testGeldspurGUI.py", line 15, in >> >> from tests.testU2 import testU2 >> File "/home/egon/Entw/Geldspur/geldspur/tests/testU2.py", line 9, in >> >> from gui.GUI_Konfig import GUIcfg >> File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11, in >> >> class GUIcfg: >> File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in >> GUIcfg >> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder]) >> File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in >> >> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder]) >> NameError: name 'fCONV_AUSRICHTG' is not defined >> You see "Felder" and with "0 0 3 4" the correct value 4 for fCONV_AUSRICHTG. >> But there is the NameError. >> What does mean? Is there a change from python2 to python3? > > You are using a syntax that I don't understand, but "listcomp" means a list > comprehenson. > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
RE: Writing to clipboard in Python 3.11
It doesn't work in python 3.12.0 -Original Message- From: Python-list On Behalf Of Thomas Passin via Python-list Sent: Tuesday, November 7, 2023 12:08 PM To: python-list@python.org Subject: Re: Writing to clipboard in Python 3.11 On 11/5/2023 7:51 PM, Rob Cliffe via Python-list wrote: > Recently I switched from Python 3.8.3 to Python 3.11.4. A strange > problem appeared which was not there before: > I am using the win32clipboard backage (part of pywin32), and when I > use > SetClipboardData() to write text which consists ENTIRELY OF DIGITS to > the clipboard, I either get an error (not always the same error > message) or a program crash. The problem does not appear if I use > SetClipboardText() instead. > Sample program: > > from win32clipboard import * > OpenClipboard() > SetClipboardData(CF_UNICODETEXT, "A") > SetClipboardData(CF_UNICODETEXT, "A0") > SetClipboardData(CF_UNICODETEXT, "0A") SetClipboardText("0", > CF_UNICODETEXT) print("OK so far") SetClipboardData(CF_UNICODETEXT, > "0") > CloseClipboard() > > Sample output: > > OK so far > Traceback (most recent call last): >File "R:\W.PY", line 8, in > SetClipboardData(CF_UNICODETEXT, "0") > pywintypes.error: (0, 'SetClipboardData', 'No error message is > available') > > I can get round the problem by using SetClipboardText(). But can > anyone shed light on this? No, but I use pyperclip. It's cross platform. Maybe it doesn't have this problem, though I don't know for sure. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Question(s)
Does this link help? It seems to have a Linux package here. [1]Eclipse Packages | The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and [2]favicon.ico over 350 open source projects... eclipse.org Sent from my iPhone On Oct 25, 2023, at 7:55 AM, o1bigtenor via Python-list wrote: On Wed, Oct 25, 2023 at 7:00AM Dieter Maurer wrote: o1bigtenor wrote at 2023-10-25 06:44 -0500: On Wed, Oct 25, 2023 at 6:24?AM Dieter Maurer wrote: ... There are different kinds of errors. Some can be avoided by using an integrated development environment (e.g. misspellings, type mismatches, ...). Haven't heard of a python IDE - - - doesn't mean that there isn't such - - just that I haven't heard of such. Is there a python IDE? There are several. Python comes with "IDLE". Interesting - - - started looking into this. There are several others, e.g. "ECLIPSE" can be used for Python development. Is 'Eclipse' a Windows oriented IDE? (Having a hard time finding linux related information on the website.) Search for other alternatices. Will do. Thanks for the assistance. -- https://mail.python.org/mailman/listinfo/python-list References Visible links 1. https://www.eclipse.org/downloads/packages/ 2. https://www.eclipse.org/downloads/packages/ -- https://mail.python.org/mailman/listinfo/python-list
RE: Compiling python on windows with vs
One expert told me to do the following when compiling via cython and cl: cython -3 --embed -o c_file_namepython_file_name Then, assuming python is installed in your apps directory and not your program files directory: set "PYTHON_DIR=%LocalAppData%\Programs\Python\Python311" or whatever directory you put python in. cl /O2 /I"%PYTHON_DIR%\Include" c_file_name /link /libpath:"%PYTHON_DIR%\libs" If that doesn't work, that's all I have. Sorry. -Original Message- From: Python-list On Behalf Of Thomas Schweikle via Python-list Sent: Tuesday, June 13, 2023 1:12 PM To: Python Cc: Thomas Schweikle Subject: Re: Compiling python on windows with vs Am Di., 13.Juni.2023 um 19:20:38 schrieb Jim Schwartz: > What version of visual studio are you using? Visual Studio 2022, aka 17.6.2. > What version of python? python 3.10.11 or 3.11.4 > I’ve had success with using the cython package in python and cl from visual > studio, but I haven’t tried visual studio alone. Same problem at the same place: directory "../modules/..." not found, Renaming it from "Modules" to "modules" it is found, but then fails to find "Modules". Looks like it awaits, compiling in Windows an filesystem only case aware, not case sensitive -- I'm assuming this a bug now. Building within cygwin (or MSYS, Ubuntu) this works as expected. But there it does not search for "modules" once and "Modules" at an other place. >> On Jun 13, 2023, at 11:59 AM, Thomas Schweikle via Python-list >> wrote: >> >> Fehler beim Buildvorgang -- Thomas -- https://mail.python.org/mailman/listinfo/python-list
Re: Compiling python on windows with vs
What version of visual studio are you using? What version of python? I’ve had success with using the cython package in python and cl from visual studio, but I haven’t tried visual studio alone. Sent from my iPhone > On Jun 13, 2023, at 11:59 AM, Thomas Schweikle via Python-list > wrote: > > Fehler beim Buildvorgang -- https://mail.python.org/mailman/listinfo/python-list
RE: Learning tkinter
This works for me. Hope it helps. from tkinter import messagebox messagebox.showerror("Hi", f"Hello World") -Original Message- From: Python-list On Behalf Of Rob Cliffe via Python-list Sent: Friday, May 12, 2023 3:55 AM To: Python Subject: Learning tkinter I am trying to learn tkinter. Several examples on the internet refer to a messagebox class (tkinter.messagebox). But: Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tkinter >>> tkinter.messagebox Traceback (most recent call last): File "", line 1, in AttributeError: module 'tkinter' has no attribute 'messagebox' >>> Why is this? TIA Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Help on ctypes.POINTER for Python array
I’m not sure this is the shortest method, but you could set up two python scripts to do the same thing and convert them to c using cython. I wouldn’t be able to read the c scripts, but maybe you could. Maybe someone else has a more direct answer. Sent from my iPhone > On May 11, 2023, at 10:00 AM, Jason Qian via Python-list > wrote: > > Hi, > > Need some help, > > in the Python, I have a array of string > > var_array=["Opt1=DG","Opt1=DG2"] > > I need to call c library and pass var_array as parameter > > In the argtypes, how do I set up ctypes.POINTER(???) for var_array? > > func.argtypes=[ctypes.c_void_p,ctypes.c_int, ctypes.POINTER()] > > In the c code: > > int func (void* obj, int index, char** opt) > > Thanks > Jason > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Christoph Gohlke and compiled packages
What’s the problem now? Is it with python on windows? I use python on windows so I’d like to know. Thanks Sent from my iPhone > On Apr 11, 2023, at 2:24 AM, Chris Angelico wrote: > > On Tue, 11 Apr 2023 at 14:20, Mike Dewhirst wrote: >> >> It seems Christoph Gohlke has been cut adrift and his extremely valuable >> web page ... >> >> https://www.lfd.uci.edu/~gohlke/pythonlibs/ >> >> ... turned into an archive getting staler by the day. >> >> What does the Python Software Foundation and the community think about this? > > My personal view? Windows is *really really really* hard to support, > and ONE PERSON did a stellar job of supporting the platform for an > incredibly long job. > > I don't know if he'll ever read this, but if he does, thank you > Christoph for your amazing contribution to the community. > > The fact that we have a problem now is a testament to the length of > time that we *didn't* have a problem, thanks to him. > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
RE: Windows installer from python source code without access to source code
Thanks everyone for the help. I got my app working with using cython to generate the c code, cl to compile, and visual studio to create the setup.exe and the msi installer. I appreciate the help. -Original Message- From: Python-list On Behalf Of Jim Schwartz Sent: Friday, April 7, 2023 7:28 AM To: 'Eryk Sun' Cc: python-list@python.org Subject: RE: Windows installer from python source code without access to source code Is this what you'd recommend doing when distributing a cython-generated code compiled with cl. I want to distribute this in a windows or other operating system installer. I'll start with windows first. I don't think I can use cx_freeze to create the installer, unless I know which files to include in the package and list them. https://stackoverflow.com/questions/62390978/minimal-set-of-files-required-t o-distribute-an-embed-cython-compiled-code-and-ma -Original Message- From: Jim Schwartz Sent: Friday, April 7, 2023 5:33 AM To: 'Eryk Sun' Cc: 'python-list@python.org' Subject: RE: Windows installer from python source code without access to source code Yea, thanks a lot. That makes sense. I was testing it on my development environment and got it to work that way, but I need to package it and test it on my dual boot "user" environment. Thanks again for the help. I've deleted that environment variable. -Original Message- From: Eryk Sun Sent: Thursday, April 6, 2023 8:06 PM To: Jim Schwartz Cc: python-list@python.org Subject: Re: Windows installer from python source code without access to source code On 4/6/23, Jim Schwartz wrote: > Never mind. I found it on the web. I needed to point my PYTHONPATH > to > sitepackages: In most cases an application should be isolated from PYTHON* environment variables. If you're creating a Python application or embedding Python in an application, use the embeddable distribution, and add any additional required sys.path directories to the included "._pth" file (e.g. "python311._pth"). https://docs.python.org/3/library/sys_path_init.html#pth-files -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
RE: Windows installer from python source code without access to source code
Is this what you'd recommend doing when distributing a cython-generated code compiled with cl. I want to distribute this in a windows or other operating system installer. I'll start with windows first. I don't think I can use cx_freeze to create the installer, unless I know which files to include in the package and list them. https://stackoverflow.com/questions/62390978/minimal-set-of-files-required-to-distribute-an-embed-cython-compiled-code-and-ma -Original Message- From: Jim Schwartz Sent: Friday, April 7, 2023 5:33 AM To: 'Eryk Sun' Cc: 'python-list@python.org' Subject: RE: Windows installer from python source code without access to source code Yea, thanks a lot. That makes sense. I was testing it on my development environment and got it to work that way, but I need to package it and test it on my dual boot "user" environment. Thanks again for the help. I've deleted that environment variable. -Original Message- From: Eryk Sun Sent: Thursday, April 6, 2023 8:06 PM To: Jim Schwartz Cc: python-list@python.org Subject: Re: Windows installer from python source code without access to source code On 4/6/23, Jim Schwartz wrote: > Never mind. I found it on the web. I needed to point my PYTHONPATH > to > sitepackages: In most cases an application should be isolated from PYTHON* environment variables. If you're creating a Python application or embedding Python in an application, use the embeddable distribution, and add any additional required sys.path directories to the included "._pth" file (e.g. "python311._pth"). https://docs.python.org/3/library/sys_path_init.html#pth-files -- https://mail.python.org/mailman/listinfo/python-list
RE: Windows installer from python source code without access to source code
Yea, thanks a lot. That makes sense. I was testing it on my development environment and got it to work that way, but I need to package it and test it on my dual boot "user" environment. Thanks again for the help. I've deleted that environment variable. -Original Message- From: Eryk Sun Sent: Thursday, April 6, 2023 8:06 PM To: Jim Schwartz Cc: python-list@python.org Subject: Re: Windows installer from python source code without access to source code On 4/6/23, Jim Schwartz wrote: > Never mind. I found it on the web. I needed to point my PYTHONPATH > to > sitepackages: In most cases an application should be isolated from PYTHON* environment variables. If you're creating a Python application or embedding Python in an application, use the embeddable distribution, and add any additional required sys.path directories to the included "._pth" file (e.g. "python311._pth"). https://docs.python.org/3/library/sys_path_init.html#pth-files -- https://mail.python.org/mailman/listinfo/python-list
RE: Windows installer from python source code without access to source code
Never mind. I found it on the web. I needed to point my PYTHONPATH to sitepackages: https://stackoverflow.com/questions/56857449/importerror-after-cython-embed -Original Message- From: Python-list On Behalf Of Jim Schwartz Sent: Thursday, April 6, 2023 2:50 PM To: 'Barry' Cc: python-list@python.org Subject: RE: Windows installer from python source code without access to source code I downloaded VS community 2022 and I know how to access the developer command prompt. I'm using the one called x64 Native Tools Command Prompt for VS 2022 I ran a command to compile my python code that was converted to c with the following command: H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>cl /O2 /I"C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\include\\" aws_pc_backup.c C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32216.1 for x64 Copyright (C) Microsoft Corporation. All rights reserved. aws_pc_backup.c Microsoft (R) Incremental Linker Version 14.35.32216.1 Copyright (C) Microsoft Corporation. All rights reserved. /out:aws_pc_backup.exe aws_pc_backup.obj C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib Creating library aws_pc_backup.lib and object aws_pc_backup.exp When I ran the program, I got this, though. Obviously, it doesn't know about the requests package. Do I have to link something in with the executable? H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>aws_pc_backup.exe -m:lb Traceback (most recent call last): File "src\\python\\aws_pc_backup_main.py", line 7, in init python.aws_pc_backup_main ModuleNotFoundError: No module named 'requests' -Original Message- From: Barry Sent: Tuesday, April 4, 2023 1:25 PM To: Jim Schwartz Cc: Eryk Sun ; python-list@python.org Subject: Re: Windows installer from python source code without access to source code > On 4 Apr 2023, at 16:28, Jim Schwartz wrote: > > Where can I download that cl program? I've used gcc before, but I hear that > cl can use a setup.py program to run the compile and link and create a > windows .msi installer. Is that true? It is part of visual studio C++. Once you have that installed there are bat files that setup environment in the terminal. Then you can use cl, nmake etc Barry > > -Original Message- > From: Eryk Sun > Sent: Friday, March 31, 2023 12:55 PM > To: Jim Schwartz > Cc: python-list@python.org > Subject: Re: Windows installer from python source code without access > to source code > >> On 3/31/23, Jim Schwartz wrote: >> I want a windows installer to install my application that's written >> in python, but I don't want the end user to have access to my source code. > > Cython can compile a script to C source code for a module or executable > (--embed). The source can be compiled and linked normally. > For example, the following builds a "hello.exe" executable based on a > "hello.py" script. > >> cython -3 --embed hello.py >> set "PYI=C:\Program Files\Python311\include" >> set "PYL=C:\Program Files\Python311\libs" >> cl /I"%PYI%" hello.c /link /libpath:"%PYL%" >> copy hello.exe embed >> embed\hello.exe >Hello, World! > > I extracted the complete embeddable distribution of Python 3.11 into the > "embed" directory. You can reduce the size of the installation, if needed, by > minimizing the zipped standard library and removing pyd extensions and DLLs > that your application doesn't use. > > The generated "hello.c" is large and not particularly easy to read, but here > are some snippets [...]: > >[...] >/* Implementation of 'hello' */ >static PyObject *__pyx_builtin_print; >static const char __pyx_k_main[] = "__main__"; >static const char __pyx_k_name[] = "__name__"; >static const char __pyx_k_test[] = "__test__"; >static const char __pyx_k_print[] = "print"; >static const char __pyx_k_Hello_World[] = "Hello, World!"; >[...] > /* "hello.py":1 > * print("Hello, World!") # <<<<<<<<<<<<<< > */ > __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World); >if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error) >[...] > /* "hello.py":1 > * print("Hello, World!") # <<<<<<<<<<<<<< > */ > __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, >
Re: Windows installer from python source code without access to source code
Could someone please help Carlos? I’m not sure how to answer his question Sent from my iPhone On Apr 6, 2023, at 3:53 PM, Carlos Fulqueris wrote: Hello Jim, How can I unsubscribe to this email list? I'm waiting for your response. Thanks Carlos El jue, 6 abr 2023 a las 16:52, Jim Schwartz (<[1]jsch...@sbcglobal.net>) escribió: I downloaded VS community 2022 and I know how to access the developer command prompt. I'm using the one called x64 Native Tools Command Prompt for VS 2022 I ran a command to compile my python code that was converted to c with the following command: H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>cl /O2 /I"C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\include\\" aws_pc_backup.c C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32216.1 for x64 Copyright (C) Microsoft Corporation. All rights reserved. aws_pc_backup.c Microsoft (R) Incremental Linker Version 14.35.32216.1 Copyright (C) Microsoft Corporation. All rights reserved. /out:aws_pc_backup.exe aws_pc_backup.obj C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib Creating library aws_pc_backup.lib and object aws_pc_backup.exp When I ran the program, I got this, though. Obviously, it doesn't know about the requests package. Do I have to link something in with the executable? H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>aws_pc_backup.exe -m:lb Traceback (most recent call last): File "src\\python\\aws_pc_backup_main.py", line 7, in init python.aws_pc_backup_main ModuleNotFoundError: No module named 'requests' -Original Message- From: Barry <[2]ba...@barrys-emacs.org> Sent: Tuesday, April 4, 2023 1:25 PM To: Jim Schwartz <[3]jsch...@sbcglobal.net> Cc: Eryk Sun <[4]eryk...@gmail.com>; [5]python-list@python.org Subject: Re: Windows installer from python source code without access to source code > On 4 Apr 2023, at 16:28, Jim Schwartz <[6]jsch...@sbcglobal.net> wrote: > > Where can I download that cl program? I've used gcc before, but I hear that cl can use a setup.py program to run the compile and link and create a windows .msi installer. Is that true? It is part of visual studio C++. Once you have that installed there are bat files that setup environment in the terminal. Then you can use cl, nmake etc Barry > > -Original Message- > From: Eryk Sun <[7]eryk...@gmail.com> > Sent: Friday, March 31, 2023 12:55 PM > To: Jim Schwartz <[8]jsch...@sbcglobal.net> > Cc: [9]python-list@python.org > Subject: Re: Windows installer from python source code without access > to source code > >> On 3/31/23, Jim Schwartz <[10]jsch...@sbcglobal.net> wrote: >> I want a windows installer to install my application that's written >> in python, but I don't want the end user to have access to my source code. > > Cython can compile a script to C source code for a module or executable (--embed). The source can be compiled and linked normally. > For example, the following builds a "hello.exe" executable based on a "hello.py" script. > >> cython -3 --embed hello.py >> set "PYI=C:\Program Files\Python311\include" >> set "PYL=C:\Program Files\Python311\libs" >> cl /I"%PYI%" hello.c /link /libpath:"%PYL%" >> copy hello.exe embed >> embed\hello.exe > Hello, World! > > I extracted the complete embeddable distribution of Python 3.11 into the "embed" directory. You can reduce the size of the installation, if needed, by minimizing the zipped standard library and removing pyd extensions and DLLs that your application doesn't use. > > The generated "hello.c" is large and not particularly easy to read, but here are some snippets [...]: > > [...] > /* Implementation of 'hello' */ > static PyObject *__pyx_builtin_print; > static const char __pyx_k_main[] = "__main__"; > static const char __pyx_k_name[] = "__name__"; > static const char __pyx_k_test[] = &q
RE: Windows installer from python source code without access to source code
I downloaded VS community 2022 and I know how to access the developer command prompt. I'm using the one called x64 Native Tools Command Prompt for VS 2022 I ran a command to compile my python code that was converted to c with the following command: H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>cl /O2 /I"C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\include\\" aws_pc_backup.c C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32216.1 for x64 Copyright (C) Microsoft Corporation. All rights reserved. aws_pc_backup.c Microsoft (R) Incremental Linker Version 14.35.32216.1 Copyright (C) Microsoft Corporation. All rights reserved. /out:aws_pc_backup.exe aws_pc_backup.obj C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib Creating library aws_pc_backup.lib and object aws_pc_backup.exp When I ran the program, I got this, though. Obviously, it doesn't know about the requests package. Do I have to link something in with the executable? H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>aws_pc_backup.exe -m:lb Traceback (most recent call last): File "src\\python\\aws_pc_backup_main.py", line 7, in init python.aws_pc_backup_main ModuleNotFoundError: No module named 'requests' -Original Message- From: Barry Sent: Tuesday, April 4, 2023 1:25 PM To: Jim Schwartz Cc: Eryk Sun ; python-list@python.org Subject: Re: Windows installer from python source code without access to source code > On 4 Apr 2023, at 16:28, Jim Schwartz wrote: > > Where can I download that cl program? I've used gcc before, but I hear that > cl can use a setup.py program to run the compile and link and create a > windows .msi installer. Is that true? It is part of visual studio C++. Once you have that installed there are bat files that setup environment in the terminal. Then you can use cl, nmake etc Barry > > -Original Message- > From: Eryk Sun > Sent: Friday, March 31, 2023 12:55 PM > To: Jim Schwartz > Cc: python-list@python.org > Subject: Re: Windows installer from python source code without access > to source code > >> On 3/31/23, Jim Schwartz wrote: >> I want a windows installer to install my application that's written >> in python, but I don't want the end user to have access to my source code. > > Cython can compile a script to C source code for a module or executable > (--embed). The source can be compiled and linked normally. > For example, the following builds a "hello.exe" executable based on a > "hello.py" script. > >> cython -3 --embed hello.py >> set "PYI=C:\Program Files\Python311\include" >> set "PYL=C:\Program Files\Python311\libs" >> cl /I"%PYI%" hello.c /link /libpath:"%PYL%" >> copy hello.exe embed >> embed\hello.exe >Hello, World! > > I extracted the complete embeddable distribution of Python 3.11 into the > "embed" directory. You can reduce the size of the installation, if needed, by > minimizing the zipped standard library and removing pyd extensions and DLLs > that your application doesn't use. > > The generated "hello.c" is large and not particularly easy to read, but here > are some snippets [...]: > >[...] >/* Implementation of 'hello' */ >static PyObject *__pyx_builtin_print; >static const char __pyx_k_main[] = "__main__"; >static const char __pyx_k_name[] = "__name__"; >static const char __pyx_k_test[] = "__test__"; >static const char __pyx_k_print[] = "print"; >static const char __pyx_k_Hello_World[] = "Hello, World!"; >[...] > /* "hello.py":1 > * print("Hello, World!") # <<<<<<<<<<<<<< > */ > __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World); >if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error) >[...] > /* "hello.py":1 > * print("Hello, World!") # <<<<<<<<<<<<<< > */ > __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, > NULL); >if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) >[...] >int wmain(int argc, wchar_t **argv) { >[...] >if (argc && argv) >Py_SetProgramName(argv[0]); >Py_Initialize(); >if (argc && argv) >PySys_SetArgv(argc, argv); >[...] > m = PyInit_hello(); >[...] >if (Py_FinalizeEx() < 0) >return 2; >[...] >return 0; >[...] > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
RE: Windows installer from python source code without access to source code
Where can I download that cl program? I've used gcc before, but I hear that cl can use a setup.py program to run the compile and link and create a windows .msi installer. Is that true? -Original Message- From: Eryk Sun Sent: Friday, March 31, 2023 12:55 PM To: Jim Schwartz Cc: python-list@python.org Subject: Re: Windows installer from python source code without access to source code On 3/31/23, Jim Schwartz wrote: > I want a windows installer to install my application that's written in > python, but I don't want the end user to have access to my source code. Cython can compile a script to C source code for a module or executable (--embed). The source can be compiled and linked normally. For example, the following builds a "hello.exe" executable based on a "hello.py" script. > cython -3 --embed hello.py > set "PYI=C:\Program Files\Python311\include" > set "PYL=C:\Program Files\Python311\libs" > cl /I"%PYI%" hello.c /link /libpath:"%PYL%" > copy hello.exe embed > embed\hello.exe Hello, World! I extracted the complete embeddable distribution of Python 3.11 into the "embed" directory. You can reduce the size of the installation, if needed, by minimizing the zipped standard library and removing pyd extensions and DLLs that your application doesn't use. The generated "hello.c" is large and not particularly easy to read, but here are some snippets [...]: [...] /* Implementation of 'hello' */ static PyObject *__pyx_builtin_print; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_print[] = "print"; static const char __pyx_k_Hello_World[] = "Hello, World!"; [...] /* "hello.py":1 * print("Hello, World!") # <<<<<<<<<<<<<< */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error) [...] /* "hello.py":1 * print("Hello, World!") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) [...] int wmain(int argc, wchar_t **argv) { [...] if (argc && argv) Py_SetProgramName(argv[0]); Py_Initialize(); if (argc && argv) PySys_SetArgv(argc, argv); [...] m = PyInit_hello(); [...] if (Py_FinalizeEx() < 0) return 2; [...] return 0; [...] -- https://mail.python.org/mailman/listinfo/python-list
RE: [Python-Dev] Small lament...
Yea, it is funny. I commented on it. -Original Message- From: Python-list On Behalf Of Eryk Sun Sent: Saturday, April 1, 2023 2:23 PM To: Skip Montanaro Cc: Python ; python-dev Dev Subject: Re: [Python-Dev] Small lament... On 4/1/23, Skip Montanaro wrote: > Just wanted to throw this out there... I lament the loss of waking up > on April 1st to see a creative April Fool's Day joke on one or both of > these lists, often from our FLUFL... Maybe such frivolity still > happens, just not in the Python ecosystem? I thought this one was funny: https://github.com/python/cpython/issues/103172 -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows Gui Frontend
Are there any ide’s that will let me design the screen and convert it to python? I doubt it because it was mentioned that this is time consuming. Thanks for the responses everyone. I appreciate it. Sent from my iPhone > On Apr 1, 2023, at 10:37 AM, Eryk Sun wrote: > > On 4/1/23, Jim Schwartz wrote: >> I have another question. I have an app written in python, but I want to >> add a windows GUI front end to it. Can this be done in python? What >> packages would allow me to do that? > > Here are a few of the GUI toolkit libraries in common use: > >* tkinter (Tk) >* PyQt (Qt) >* PySide (Qt) >* wxPython (wxWidgets) >* PyGObject (GTK) > > tkinter is included in Python's standard library. -- https://mail.python.org/mailman/listinfo/python-list
Windows Gui Frontend
I have another question. I have an app written in python, but I want to add a windows GUI front end to it. Can this be done in python? What packages would allow me to do that? Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows installer from python source code without access to source code
I am writing an app but I’m not sure I’ll sell it yet. I have it in a private GitHub location and GitHub prompts me for a license. I don’t really understand licenses so I just picked Apache 2.0. Maybe I’m going too far with my worry about which license I pick. I’m not selling it now so it doesn’t matter. I have to do a lot more work before I get to that point Sent from my iPhone > On Mar 31, 2023, at 6:52 PM, Chris Angelico wrote: > > On Sat, 1 Apr 2023 at 10:34, Jim Schwartz wrote: >> >> Yea. You’re right. I probably need a lawyer someday. Thanks. >> > > If your needs are basic, you shouldn't need a lawyer. Copyright law > and treaties DO protect you. But it's important to be aware that no > amount of legal protection - whether you hire a lawyer or not, and > whether you identify copyright and license or not - will stop people > from copying your code. NOTHING will stop people from copying your > code if they have access to it. All you can do is discourage them. > > So that brings us back to the original question: Why protect your > *source code* specifically? There are two extremes available to > everyone: > > 1) Distribute the source code. Let everyone see it. Stick a license on > it that permits them to use it, modify it, distribute modified > versions. Set your code free and let it be used. > > 2) Don't distribute the program *at all*. Don't distribute the source > OR the binary. Instead, permit people to *access* the program - which, > in today's world, usually means a web service. > > Both of these are very popular and work well. I don't have access to > the Gmail source code but I'm using the service. I don't have access > to the Twitch.tv source code but I'm using the service. Meanwhile, I > have Python programs running on a Debian system using the Linux > kernel, invoked using bash, served from an ext4 mass storage device, > etc, etc. I have the binary code for all of these, and I'm legally > guaranteed access to the source if I want it, so there's no incentive > to steal it. > > The middle ground of "distribute binaries but stop people from > accessing the source" is a much narrower use-case, and I would say > that it's not actually a single use-case but a family of them, each > with different needs and requirements. So it's essential to know what > you're actually trying to protect, and why. > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows installer from python source code without access to source code
Yea. You’re right. I probably need a lawyer someday. Thanks. Sent from my iPhone > On Mar 31, 2023, at 5:12 PM, Thomas Passin wrote: > > On 3/31/2023 5:16 PM, Jim Schwartz wrote: >> What license do I have to choose so people can't use my code? I don't know >> this stuff. > > It would help if you would explain what you want to accomplish and why. Do > you expect to make money off your software? If not, why do want so badly to > protect it? > > The most basic answer is that your code is automatically protected by > copyright law unless you say differently. But it is still a good idea to > state outright what actions would be allowed and what would be forbidden. > > If you do expect to make money, you could look at what phone apps developers > include with their apps. And it would be good to consult a lawyer who > practices in this field. > > >> -Original Message- >> From: Python-list On >> Behalf Of Chris Angelico >> Sent: Friday, March 31, 2023 7:09 AM >> To: python-list@python.org >> Subject: Re: Windows installer from python source code without access to >> source code >>> On Fri, 31 Mar 2023 at 23:01, Jim Schwartz wrote: >>> >>> I want a windows installer to install my application that's written in >>> python, but I don't want the end user to have access to my source code. >>> >>> >>> >>> Is that possible using python? I was using cx-freeze, but that has >>> the source code available. So does pyinstaller. I think gcc does, too. >>> >>> >>> >>> Does anyone know of a way to do this? >>> >> Fundamentally no, it's not. Python code will always be distributed as some >> form of bytecode. The only way to make it available without revealing >> anything is to put it on a server and let people access it without running >> it themselves. >> But why is that a problem? Copyright law protects you from people stealing >> your code and making unauthorized changes to it, and if you're not worried >> about them making changes, there's no reason to hide the source code >> (whatever you distribute would be just as copiable). Are you concerned that >> people will see your bugs? We all have them. >> ChrisA >> -- >> https://mail.python.org/mailman/listinfo/python-list > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
RE: Windows installer from python source code without access to source code
What license do I have to choose so people can't use my code? I don't know this stuff. -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Friday, March 31, 2023 7:09 AM To: python-list@python.org Subject: Re: Windows installer from python source code without access to source code On Fri, 31 Mar 2023 at 23:01, Jim Schwartz wrote: > > I want a windows installer to install my application that's written in > python, but I don't want the end user to have access to my source code. > > > > Is that possible using python? I was using cx-freeze, but that has > the source code available. So does pyinstaller. I think gcc does, too. > > > > Does anyone know of a way to do this? > Fundamentally no, it's not. Python code will always be distributed as some form of bytecode. The only way to make it available without revealing anything is to put it on a server and let people access it without running it themselves. But why is that a problem? Copyright law protects you from people stealing your code and making unauthorized changes to it, and if you're not worried about them making changes, there's no reason to hide the source code (whatever you distribute would be just as copiable). Are you concerned that people will see your bugs? We all have them. ChrisA -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Windows installer from python source code without access to source code
I want a windows installer to install my application that's written in python, but I don't want the end user to have access to my source code. Is that possible using python? I was using cx-freeze, but that has the source code available. So does pyinstaller. I think gcc does, too. Does anyone know of a way to do this? -- https://mail.python.org/mailman/listinfo/python-list
test
haven't received anything from the list for quite awhile. Got no response when I tried to contact the administrator. -- https://mail.python.org/mailman/listinfo/python-list
Not receiving posts
I have been reading the python-list for some time now. At first via gemane and since it's demise via a subscription. Recently I noticed that I have not received any emails for quite sometime. I tried resubscribing but still have received no emails from the list. To my knowledge I have done nothing to warrant removal. Can you please check and see what I need to do to start receiving emails once more. regards, Jim Byrnes -- https://mail.python.org/mailman/listinfo/python-list
Re: How to read file content and send email on Debian Bullseye
On 2023-02-05, ^Bart wrote: >> xdg-email appears to be for interactive use (it opens the user's >> "preferred email composer"); I think sendmail would work much better >> from a script. > > Like what I said in another post I think I could use ssmtp than > xdg-email or sendmail... > >> Otherwise, I had the same initial thought, to add to and/or build a >> wrapper around the existing lftp script. > > I'd like to know if there's a code made from lftp to understand when an > upload file is finished You make an lftp "script" to upload the file and write a log somewhere - write a script to run lftp with the lftp script, when the lftp has finished email the log. The log will show what happenned. In cron run the script. > but certainly I can read it from the log file > and I think it couldn't be hard to find a value in a *.txt file and if > this value is inside of it to send an email like "ok" otherwise a > message with "k.o.". > > Regards. > ^Bart -- https://mail.python.org/mailman/listinfo/python-list
Re: How to read file content and send email on Debian Bullseye
On 2023-02-05, ^Bart wrote: >> For example, try to do whatever parts you know how to do and when some part >> fails or is missing, ask. > > You're right but first of all I wrote what I'd like to do and if Python > could be the best choice about it! :) I'd say you want a simple shell script wrapped around your job, and a program to send email (bsdmail/sendmail or similar or mstmp on linux for instance). > >> I might have replied to you directly if your email email address did not >> look like you want no SPAM, LOL! > > Ahaha! I think you know what is spam and what is a reply\answer to a > post request so you can feel free to use also my email! :) > >> The cron stuff is not really relevant and it seems your idea is to read a >> part or all of a log file, parse the lines in some way and find a line that >> either matches what you need or fail to find it. Either way you want to send >> an email out with an appropriate content. > > You got the point! > >> Which part of that do you not know how to do in python? Have you done some >> reading or looking? > > Like what I wrote above I didn't know if Python can does what I need and > if to use Python is a good way I'll start to study how to do it! :) > > In my past I used Python for Arduino programming or to do easy things, > what I should do now is little more complex but I understood from years > and years by the Python's powers you can do everything! LOL! :) > > Regards. > ^Bart -- https://mail.python.org/mailman/listinfo/python-list
RE: Fwd: Installation hell
This type of response is not called for. I thought this list was designed to help people. That's not what this person was doing. Everyone has different experience levels and backgrounds. Help them learn. Don't berate them. Here's what was said: Issues installing python and sending an email? Ask for a refund on your compsci degree. -Original Message- From: Python-list On Behalf Of DFS Sent: Monday, December 19, 2022 12:58 PM To: python-list@python.org Subject: Re: Fwd: Installation hell On 12/18/2022 6:50 AM, Jim Lewis wrote: > I'm an occasional user of Python and have a degree in computer science. > Almost every freaking time I use Python, I go through PSH (Python > Setup Hell). Sometimes a wrong version is installed. Sometimes it's a path issue. > Or exe naming confusion: python, python3, phthon311, etc. Or library > compatibility issues - took an hour to find out that pygame does not > work with the current version of python. Then the kludgy PIP app and > using a DOS box under Windows with command prompts which is > ridiculous. God only knows how many novice users of the language (or > even intermediate users) were lost in the setup process. Why not clean > the infrastructure up and make a modern environment or IDE or > something better than it is now. Or at least good error messages that > explain exactly what to do. Even getting this email to the list took numerous steps. > > -- A frustrated user Issues installing python and sending an email? Ask for a refund on your compsci degree. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Installation hell
I'm an occasional user of Python and have a degree in computer science. Almost every freaking time I use Python, I go through PSH (Python Setup Hell). Sometimes a wrong version is installed. Sometimes it's a path issue. Or exe naming confusion: python, python3, phthon311, etc. Or library compatibility issues - took an hour to find out that pygame does not work with the current version of python. Then the kludgy PIP app and using a DOS box under Windows with command prompts which is ridiculous. God only knows how many novice users of the language (or even intermediate users) were lost in the setup process. Why not clean the infrastructure up and make a modern environment or IDE or something better than it is now. Or at least good error messages that explain exactly what to do. Even getting this email to the list took numerous steps. -- A frustrated user -- https://mail.python.org/mailman/listinfo/python-list
Re: Apparent Issue with Administrator Privileges
Is PYTHONPATH a user defined environment variable or system defined environment variable? Sent from my iPhone > On Oct 18, 2022, at 1:56 PM, Walsh, Ginny (US) wrote: > > Hello- > > I've been struggling with resolving environmental variables issues and I > believe it is linked to my company's administrator privileges. The program is > called ChemPlugin and I am attempting to run it using Python 3.10.8 on > Windows. I can't seem to get Python to recognize the PYTHONPATH that points > to the ChemPlugin\src. I have to download ChemPlugin using my administrator > login name, but Python is loaded to my local user profile. I can't seem to > bridge the gap. > > I have been working with both the ChemPlugin group and our internal IT and we > are all stumped. Is there any experience with this issue? > > Thanks, > > Ginny > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python scripts in .exe form
What method did you use to create the exe file from your python scripts? If it was pyinstaller, then it puts the compiled versions of these python scripts in a windows temp folder when you run them. You’ll be able to get the scripts from there. Sent from my iPhone > On Aug 19, 2022, at 9:51 PM, Mona Lee wrote: > > I'm pretty new to Python, and I had to do some tinkering because I was > running into issues with trying to download a package from PIP and must've > caused some issues in my program that I don't know how to fix > > 1. It started when I was unable to update PIP to the newest version because > of some "Unknown error" (VS Code error - unable to read file - > (Unknown(FileSystemError) where I believe some file was not saved in the > right location? > > 2. In my command line on VS code there used to be the prefix that looked > something like "PS C:\Users\[name]>" but now it is "PS > C:\Users\[name]\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts> > > From there I redownloaded my VS code but still have the 2) issue. > > also, my scripts are now in the .exe form that I cannot access because "it is > either binary or in a unsupported text encoding" I've tried to extract it > back into the .py form using pyinstxtractor and decompile-python3 but I can't > successfully work these. > > 3. also wanted to mention that some of my old Python programs are missing. > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem using cx_Freeze
This link covers how to use BDist_dmg. https://cx-freeze.readthedocs.io/en/latest/setup_script.html Sent from my iPhone > On Aug 15, 2022, at 12:11 PM, David at Booomer wrote: > > I’m trying to use cx_Freeze (https://pypi.org/project/cx-Freeze/) in a > python app but running into an error message: > > AttributeError: module 'cx_Freeze' has no attribute ‘BdistDMG’ > > I’m using Anaconda and error appears with the import command: from cx_Freeze > import * > > From the terminal the command: python setup.py build gives much the same > error. > > I believe there is an issue specifying the output file name but don’t know > how to resolve it. > > Any suggestions, thanks. David > > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed
Jim Wygralak added the comment: DATA: Just chiming in to report that I'm seeing this issue with the following freshly installed: Python 3.10.4 tkinter 8.6.12 PySimpleGUI 4.57.0 OS is Windows 10 As others have report it is related to the cursor entering the tool tip box before clicking the button. OBSERVATIONS: I've noticed that the tool tip always seems to appear up and to the right of the cursor. If I approach the button by moving the cursor down & left, the tool tip appears when the cursor enters the button, then as I continue to move the cursor to the center of the button I'm moving AWAY FROM the tool tip, and the issue doesn't appear. However, if I approach the button by moving the cursor up and to the right, the tool tip appears as the cursor enters the button, and it overlaps the button. As I continue to move the cursor to the center of the button, it enters the tool tip box and triggers this fault. The only 100% effective workaround appears to be not using tooltips. That is a loss of function, and not an acceptable long term solution. -- nosy: +jim.wygralak ___ Python tracker <https://bugs.python.org/issue46180> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34071] asyncio: repr(task) raises AssertionError for coros which loop.create_task accepts; complications ensue
Jim DeLaHunt added the comment: As the original reporter, I have no objection to closing this old report. It remains in the historical record. That was its purpose all along. Thank you to all the bug data maintainers! -- ___ Python tracker <https://bugs.python.org/issue34071> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
Jim Schwartz added the comment: Please let me know if you are able to reproduce this issue. -- ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
Jim Schwartz added the comment: my c drive and h drive are both internal drives and I run the python script from my user directory on my c drive. Not sure if that makes any difference. Just trying to think of things that might help you reproduce and fix this. -- ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
Jim Schwartz added the comment: when I run the following command: python "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py" "C:\\" I get this output: ... Traceback (most recent call last): File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", line 54, in main(sys.argv[0:]) File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", line 30, in main for file in get_files_in_dir(source): File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", line 11, in get_files_in_dir yield from get_files_in_dir(entry.path) File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", line 11, in get_files_in_dir yield from get_files_in_dir(entry.path) File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", line 11, in get_files_in_dir yield from get_files_in_dir(entry.path) [Previous line repeated 19 more times] File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", line 9, in get_files_in_dir for entry in os.scandir(source): FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\Jim\\Documents\\jschw_uiowtv3_old\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Extensions\\nenlahapcbofgnanklpelkaejcehkggg\\0.1.823.675_0\\notifications\\pages\\Cashback\\components\\CashBackResolve\\components\\RewardsActivation\\components\\CashbackSectionSimple' when I run the following command: python "H:\Users\LindaJim\Documents\AWS Python Learning\test_os_walk.py" "C:\\" I get this: ... file is C:\winutils\bin\winutils.exe End time is 2021-12-15.13:11:54 Duration is 0:06:05 I don't think this should happen, right? -- ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
Jim Schwartz added the comment: the issue is with the scandir script, not the os_walk script. I tried to upload the scandir python script before, but I guess it didn't upload. When I was running the two scripts, I used an input of C:\\ as the input parameter. Hope that helps. -- Added file: https://bugs.python.org/file50495/test_dir_scan_dir.py ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
Jim Schwartz added the comment: do you have this registry entry set to 1: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled set to 1. It works if you do. What version of windows do you have? I have version 21H2 (OS Build 19044.1387). I don't have windows 11 yet. -- ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
Jim Schwartz added the comment: yes, I do. C:\Users\Jim\Documents\jschw_uiowtv3_old\AppData\Local\Google\Chrome\User Data\Default\Extensions\nenlahapcbofgnanklpelkaejcehkggg\0.1.823.675_0\notifications\pages\Cashback\components\CashBackResolve\components\RewardsActivation\components\CashbackSectionSimple it's over the 260 character limit that's the default for windows 10. -- ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
Jim Schwartz added the comment: Here's the second file that works just fine under python 3.9 (by the way, I am using Windows 64-bit). I didn't test this on later python versions, however, nor did I test it on 32-bit versions. I see that many people on the internet have said to change the working directory as a work around. Could this possibly be why? -- Added file: https://bugs.python.org/file50493/test_os_walk.py ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not
New submission from Jim Schwartz : Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not. I've enclosed sample scripts that compare the two and have returned the results. the windows 10 registry entry to extend the path names fixes this issue (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled set to 1). I've enclosed a scripts that proved this occurs and can be used for testing. I have a script that does the same thing using os_walk, but I can't attach two scripts to this Issue. -- components: IO, Tests, Windows files: test_dir_scan_dir.py messages: 408607 nosy: jschwar313, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not type: crash versions: Python 3.9 Added file: https://bugs.python.org/file50492/test_dir_scan_dir.py ___ Python tracker <https://bugs.python.org/issue46084> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Jim Crist-Harif added the comment: Apologies for the delay here. I've pushed a documentation patch at https://github.com/python/cpython/pull/29760. -- ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Change by Jim Crist-Harif : -- keywords: +patch pull_requests: +27998 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29760 ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45883] reuse_address mistakenly removed from loop.create_server
Change by Jim Crist-Harif : -- keywords: +patch pull_requests: +27970 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29733 ___ Python tracker <https://bugs.python.org/issue45883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45883] reuse_address mistakenly removed from loop.create_server
New submission from Jim Crist-Harif : In https://bugs.python.org/issue45129 the deprecated `reuse_address` parameter to `create_datagram_endpoint` was removed. This PR mistakenly removed this parameter from `create_server` as well (where it wasn't deprecated). -- components: asyncio messages: 406876 nosy: asvetlov, jcristharif, yselivanov priority: normal severity: normal status: open title: reuse_address mistakenly removed from loop.create_server type: behavior versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue45883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45819] Avoid releasing the GIL in nonblocking socket operations
Change by Jim Crist-Harif : -- components: +asyncio -C API nosy: +asvetlov, yselivanov ___ Python tracker <https://bugs.python.org/issue45819> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45819] Avoid releasing the GIL in nonblocking socket operations
Change by Jim Crist-Harif : -- keywords: +patch pull_requests: +27822 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29579 ___ Python tracker <https://bugs.python.org/issue45819> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45819] Avoid releasing the GIL in nonblocking socket operations
New submission from Jim Crist-Harif : In https://bugs.python.org/issue7946 an issue with how the current GIL interacts with mixing IO and CPU bound work. Quoting this issue: > when an I/O bound thread executes an I/O call, > it always releases the GIL. Since the GIL is released, a CPU bound > thread is now free to acquire the GIL and run. However, if the I/O > call completes immediately (which is common), the I/O bound thread > immediately stalls upon return from the system call. To get the GIL > back, it now has to go through the timeout process to force the > CPU-bound thread to release the GIL again. This issue can come up in any application where IO and CPU bound work are mixed (we've found it to be a cause of performance issues in https://dask.org for example). Fixing the general problem is tricky and likely requires changes to the GIL's internals, but in the specific case of mixing asyncio running in one thread and CPU work happening in background threads, there may be a simpler fix - don't release the GIL if we don't have to. Asyncio relies on nonblocking socket operations, which by definition shouldn't block. As such, releasing the GIL shouldn't be needed for many operations (`send`, `recv`, ...) on `socket.socket` objects provided they're in nonblocking mode (as suggested in https://bugs.python.org/issue7946#msg99477). Likewise, dropping the GIL can be avoided when calling `select` on `selectors.BaseSelector` objects with a timeout of 0 (making it a non-blocking call). I've made a patch (https://github.com/jcrist/cpython/tree/keep-gil-for-fast-syscalls) with these two changes, and run a benchmark (attached) to evaluate the effect of background threads with/without the patch. The benchmark starts an asyncio server in one process, and a number of clients in a separate process. A number of background threads that just spin are started in the server process (configurable by the `-t` flag, defaults to 0), then the server is loaded to measure the RPS. Here are the results: ``` # Main branch $ python bench.py -c1 -t0 Benchmark: clients = 1, msg-size = 100, background-threads = 0 16324.2 RPS $ python bench.py -c1 -t1 Benchmark: clients = 1, msg-size = 100, background-threads = 1 Spinner spun 1.52e+07 cycles/second 97.6 RPS $ python bench.py -c2 -t0 Benchmark: clients = 2, msg-size = 100, background-threads = 0 31308.0 RPS $ python bench.py -c2 -t1 Benchmark: clients = 2, msg-size = 100, background-threads = 1 Spinner spun 1.52e+07 cycles/second 96.2 RPS $ python bench.py -c10 -t0 Benchmark: clients = 10, msg-size = 100, background-threads = 0 47169.6 RPS $ python bench.py -c10 -t1 Benchmark: clients = 10, msg-size = 100, background-threads = 1 Spinner spun 1.54e+07 cycles/second 95.4 RPS # With this patch $ ./python bench.py -c1 -t0 Benchmark: clients = 1, msg-size = 100, background-threads = 0 18201.8 RPS $ ./python bench.py -c1 -t1 Benchmark: clients = 1, msg-size = 100, background-threads = 1 Spinner spun 9.03e+06 cycles/second 194.6 RPS $ ./python bench.py -c2 -t0 Benchmark: clients = 2, msg-size = 100, background-threads = 0 34151.8 RPS $ ./python bench.py -c2 -t1 Benchmark: clients = 2, msg-size = 100, background-threads = 1 Spinner spun 8.72e+06 cycles/second 729.6 RPS $ ./python bench.py -c10 -t0 Benchmark: clients = 10, msg-size = 100, background-threads = 0 53666.6 RPS $ ./python bench.py -c10 -t1 Benchmark: clients = 10, msg-size = 100, background-threads = 1 Spinner spun 5e+06 cycles/second 21838.2 RPS ``` A few comments on the results: - On the main branch, any GIL contention sharply decreases the number of RPS an asyncio server can handle, regardless of the number of clients. This makes sense - any socket operation will release the GIL, and the server thread will have to wait to reacquire it (up to the switch interval), rinse and repeat. So if every request requires 1 recv and 1 send, a server with background GIL contention is stuck at a max of `1 / (2 * switchinterval)` or 200 RPS with default configuration. This effectively prioritizes the background thread over the IO thread, since the IO thread releases the GIL very frequently and the background thread never does. - With the patch, we still see a performance degradation, but the degradation is less severe and improves with the number of clients. This is because with these changes the asyncio thread only releases the GIL when doing a blocking poll for new IO events (or when the switch interval is hit). With low load (1 client), the IO thread becomes idle more frequently and releases the GIL. Under higher load though the event loop frequently still has work to do at the end of a cycle and issues a `selector.select` call with a 0 timeout (nonblocking), avoiding releasing the GIL at all during that loop (note the nonlinear effect of adding more clients). Since the IO thread still releases the GIL sometimes, the background thread still holds the GIL a larger percen
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Jim Crist-Harif added the comment: > Is tornado the only example or you are aware of other libraries with such > behavior? A quick survey of other language network stacks didn't turn anything up, *But* I also didn't find any implementations (other than asyncio & tornado) that bind multiple sockets with a single api call (as `create_server` does). I think part of the issue here is that dual IPV6 & IPV4 support is intentionally disabled in asyncio (and tornado), so two sockets are needed (one to support each interface). Other TCP implementations (e.g. both go and rust) don't disable this, so one listener == one socket. This makes comparing API designs across stacks harder - with e.g. Go it's straightforward to listen on a random port on IPV4 & IPV6 with a single TCPListener, since both can be handled by a single socket. Since this is disabled (by default) in asyncio we end up using 2 sockets and run into the issue described above. Also note that this issue will trigger for any address that resolves to multiple interfaces (not just `host=""`). For example, on osx `localhost` will resolve to `::1` and `127.0.0.1` by default, meaning that the following fairly straightforward asyncio code has a bug in it: ```python # Start a server on localhost with a random port server = await loop.create_server( EchoServerProtocol, host="localhost", port=0 ) # Retrieve and log the port port = server.sockets[0].getsockname()[1] print(f"listening at tcp://localhost:{port}") ``` As written, this looks correct enough, but on systems where localhost resolves to multiple interfaces this will accidentally listen on multiple ports (instead of one). This can be fixed with some additional logic external to asyncio, but it makes for a much less straightforward asyncio example. -- ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Jim Crist-Harif added the comment: If you decline that a change is needed here, at the very least the current behavior of `port=0` should be documented. I'd be happy to push up a fix if so. -- ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Jim Crist-Harif added the comment: > I'm not aware of an OS API call that binds both IPv4 and IPv6 to the same > random port. Sure, but `loop.create_server` is already higher-level than a single OS API call. By default `create_server` will already bind multiple sockets if `host=""`, `host=None`, or if `host` is a list. I'm arguing that the current behavior with `port=0` in these situations is unexpected. Other libraries (like tornado) have come to the same conclusion, and have implemented logic to handle this that seems to work well in practice (though can fail, as you've pointed out). Is there a use case where the current behavior (binding to multiple random ports) is desired? -- ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Jim Crist-Harif added the comment: Hmmm, I'd find that situation a bit surprising, but I suppose it could happen. Looks like tornado just errors, and that seems to work fine for them in practice (https://github.com/tornadoweb/tornado/blob/790715ae0f0a30b9ee830bfee75bb7fa4c4ec2f6/tornado/netutil.py#L153-L182). Binding IPv4 first might help reduce the chance of a collision, since I suspect there are more IPv4-only applications than IPv6-only. -- ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Jim Crist-Harif added the comment: > Is there an OS interface to ensure the same port on both stacks? I don't think this is needed? Right now the code processes as: - Expand host + port + family + flags into a list of one or more tuples of socket options (https://github.com/python/cpython/blob/401272e6e660445d6556d5cd4db88ed4267a50b3/Lib/asyncio/base_events.py#L1432-L1436) - Iterate through this list, creating a new socket for each option tuple, and bind to the corresponding host + port (https://github.com/python/cpython/blob/401272e6e660445d6556d5cd4db88ed4267a50b3/Lib/asyncio/base_events.py#L1441-L1464) In this case, each call to `socket.bind` gets a 0 port, thus binding to a new random open port number each time. What I'm asking for is that if the user passes in `port=0`, then the port is extracted in the first call to `socket.bind` when looping and used for all subsequent `socket.bind` calls in the loop. This way we only ever choose a single random open port rather than 1 for each interface. FWIW, this is also what tornado does when `port=0` is provided. -- ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
Change by Jim Crist-Harif : -- versions: +Python 3.10, Python 3.8 ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6
New submission from Jim Crist-Harif : To create a new server with `loop.create_server` that listens on all interfaces and a random port, I'd expect passing in `host=""`, `port=0` to work (per the documentation). However, as written this results in 2 different ports being used - one for ipv4 and one for ipv6. Instead I'd expect a single random port be determined once, and reused for all other interfaces. Running the example test code (attached) results in: ``` $ python test.py listening on 0.0.0.0:38023 listening on :::40899 Traceback (most recent call last): File "/home/jcristharif/Code/distributed/test.py", line 36, in asyncio.run(main()) File "/home/jcristharif/miniconda3/envs/dask/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/home/jcristharif/miniconda3/envs/dask/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/home/jcristharif/Code/distributed/test.py", line 30, in main assert len(ports) == 1, "Only 1 port expected!" AssertionError: Only 1 port expected! ``` This behavior can be worked around by manually handling `port=0` outside of asyncio, but as it stands naive use can result in accidentally listening on multiple ports. -- components: asyncio files: test.py messages: 405530 nosy: asvetlov, jcristharif, yselivanov priority: normal severity: normal status: open title: `loop.create_server` with port=0 uses different ports for ipv4 & ipv6 type: behavior versions: Python 3.9 Added file: https://bugs.python.org/file50421/test.py ___ Python tracker <https://bugs.python.org/issue45693> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45044] Agreeing on error raised by large repeat value for sequences
New submission from Jim Fasarakis-Hilliard : There's currently a slight disagreement between some of the sequences about what is raised when the value for `repeat` is too large. Currently, `str` and `bytes` raise an `OverflowError` while `bytearray`, `tuple`, `list` and `deque` raise a `MemoryError`. To make things more confusing, if we exercise a different path not currently caught by the check, both `str` and `bytes` raise `MemoryError`s: >>> b'abc' * maxsize Traceback (most recent call last): File "", line 1, in OverflowError: repeated bytes are too long >>> b'a' * maxsize Traceback (most recent call last): File "", line 1, in MemoryError Not sure what the original rationale for having these `OverflowError`s was but, should we change them to `MemoryError`s? -- messages: 400527 nosy: Jim Fasarakis-Hilliard priority: normal severity: normal status: open title: Agreeing on error raised by large repeat value for sequences type: behavior ___ Python tracker <https://bugs.python.org/issue45044> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44548] ttk Indeterminate Progressbar Not Animating Correctly After `start`
Jim Jewett added the comment: It sounds like the fix is a configuration change already included in the next version, so ... I think that counts as a fix. -- nosy: +Jim.Jewett resolution: -> fixed status: open -> pending ___ Python tracker <https://bugs.python.org/issue44548> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [OT] Annoying message duplication, was Re: Unsubscribe/can't login
On 5/5/21 1:07 PM, Jan van den Broek wrote: On 2021-05-05, Jim Byrnes wrote: On 5/5/21 9:39 AM, Peter Otten wrote: On 05/05/2021 16:10, Ethan Furman wrote: I see your messages twice (occasionally with other posters as well). I have no idea how to fix it.?? :( OK, I'll try another option from Thunderbird's context menu: Followup to Newsgroup. Does that appear once or twice? In theory it should go to the newsgroup only which would mirror it to the list. FWIW, none of the messages in this this thread are dupes for me and I can't remember the last time I saw a dupe from you. Are you reading this via the mailinglist or Usenet? Reading it using Thunderbird via news.gmane.io Regards, Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Annoying message duplication, was Re: Unsubscribe/can't login
On 5/5/21 9:39 AM, Peter Otten wrote: On 05/05/2021 16:10, Ethan Furman wrote: I see your messages twice (occasionally with other posters as well). I have no idea how to fix it. :( OK, I'll try another option from Thunderbird's context menu: Followup to Newsgroup. Does that appear once or twice? In theory it should go to the newsgroup only which would mirror it to the list. FWIW, none of the messages in this this thread are dupes for me and I can't remember the last time I saw a dupe from you. Regards, Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: pandas/jupyther notebook?
On 4/9/21 3:29 AM, Thomas Jollans wrote: On 07/04/2021 23:32, Jim Byrnes wrote: linux mint 20 python 3.8 jupyter 1.0.0 jedi 0.18.0 I am teaching myself pandas/jupyter notebooks. The problem I am having is tab autocomplete seems to be working erratically. Googling shows that most people solve autocomplete problems by putting import pandas as pd %config Completer.use_jedi = False One solution is to downgrade to jedi 0.17.2 That did not work for me. I ended up upgrading jupyter, ipython and jedi to the latest versions via pip and adding %config IPCompleter.greedy=True in the first cell of the notebook. Regards, Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: pandas/jupyther notebook?
On 4/7/21 4:32 PM, Jim Byrnes wrote: linux mint 20 python 3.8 jupyter 1.0.0 jedi 0.18.0 I am teaching myself pandas/jupyter notebooks. The problem I am having is tab autocomplete seems to be working erratically. Googling shows that most people solve autocomplete problems by putting import pandas as pd %config Completer.use_jedi = False in the first cell. I have done that and still have the following problem. if I type: df = pd.read it will drop down a list box that has read_csv in it. If I then type: emp it will fill in employees.csv. If I type: df.h type head, but if I type: df['Gender'] = df['Gender'].ast it will not complete astype. I wonder if someone can tell me why this is happening and maybe how to fix it. Thanks, Jim After some further digging I found that this line added to the notebook fixed the problem for me. %config IPCompleter.greedy=True Regards, Jim -- https://mail.python.org/mailman/listinfo/python-list
pandas/jupyther notebook?
linux mint 20 python 3.8 jupyter 1.0.0 jedi 0.18.0 I am teaching myself pandas/jupyter notebooks. The problem I am having is tab autocomplete seems to be working erratically. Googling shows that most people solve autocomplete problems by putting import pandas as pd %config Completer.use_jedi = False in the first cell. I have done that and still have the following problem. if I type: df = pd.read it will drop down a list box that has read_csv in it. If I then type: emp it will fill in employees.csv. If I type: df.h type head, but if I type: df['Gender'] = df['Gender'].ast it will not complete astype. I wonder if someone can tell me why this is happening and maybe how to fix it. Thanks, Jim -- https://mail.python.org/mailman/listinfo/python-list
[issue24275] lookdict_* give up too soon
Jim Jewett added the comment: What is the status on this? If you are losing interest, would you like someone else to turn your patch into a pull request? -- ___ Python tracker <https://bugs.python.org/issue24275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24275] lookdict_* give up too soon
Jim Jewett added the comment: Based on Hristo's timing, it appears to be a clear win. A near-wash for truly string-only dicts that shouldn't be effected; a near-wash for looking up non-(exact-)strings, and a nearly 40% speedup for the target case of looking up but not inserting a non-string or string subclass, then looking up strings thereafter. Additional comments: Barring objections, I will promote from patch review to commit review when I've had a chance to look more closely. I don't have commit privs, but I think some of the others following this issue do. The test looks pretty good enough -- good enough that I wonder if I'm missing something on the parts that seem odd. It would be great if you either cleaned them up or commented to explain why: Why is the first key vx1, which seems, if anything, like a variable? Why not k1 or string_key? Why is the first key built up as vx='x'; vx += '1' instead of just k1="x1"? Using a str subclass in the test is a great idea, and you've created a truly minimal one. It would probably be good to *also* test with a non-string, like 3 or 42.0. I can't imagine this affecting things (unless you missed an eager lookdict demotion somewhere), but it would be good to have that path documented against regression. This seems like a test that could probably be rolled into a bigger testfile for the actual commit. I don't have the name of such an appropriate file at hand right now, but will try to find it on a deeper review. -- ___ Python tracker <https://bugs.python.org/issue24275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24275] lookdict_* give up too soon
Jim Jewett added the comment: This was originally "can be reopened if a patch is submitted" and Hristo Venev has now done so. Therefore, I am reopening. -- resolution: rejected -> remind stage: -> patch review status: closed -> open versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue24275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36675] Doctest directives and comments missing from code samples
Jim DeLaHunt added the comment: My goodness, things get complex sometimes. If we cannot make Sphinx preserve doctest directives and comments, perhaps we should go back to the historical bug discussion to look at workarounds which we considered earlier. For instance, maybe we should modify the text surrounding the examples to explain that doctests directives should appear there, but that our tool chain currently removes them. At the moment, I see doctest directives in the doctest source code at: https://github.com/python/cpython/blob/master/Doc/library/doctest.rst#directives which do not appear in the corresponding HTML output at: https://docs.python.org/3/library/doctest.html#directives How about rewording the text before each of those examples? Or maybe finding some way to show those examples as literal text which Sphinx won't modify, even if it is not formatted like Python code examples? By the way, the discussion of this same problem back in 2011-2012 is at #12947 . At that time, we applied a "monkey patch" to the Sphinx code. I haven't read the discussion closely enough to figure out if such a patch would help now. -- ___ Python tracker <https://bugs.python.org/issue36675> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42363] I think it will be better to output self._state for debugging
Change by Jim Lin : -- keywords: +patch pull_requests: +22190 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23299 ___ Python tracker <https://bugs.python.org/issue42363> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42363] I think it will be better to output self._state for debugging
New submission from Jim Lin : I think the exception "raise ValueError("Pool not running")" is not easy for a programmer to quickly know the problem of their code. Therefore, I add the value of self._state when throwing the ValueError. -- components: Library (Lib) messages: 381016 nosy: jimlinntu priority: normal severity: normal status: open title: I think it will be better to output self._state for debugging versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue42363> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41246] IOCP Proactor same socket overlapped callbacks
Change by Jim Jewett : -- stage: patch review -> commit review ___ Python tracker <https://bugs.python.org/issue41246> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13828] Further improve casefold documentation
Jim Jewett added the comment: Unicode probably won't make the correction, because of backwards compatibility. I do support the sentence suggested in Thorsten's most recent reply. Is expanding ligatures the only other normalization it does? Ideally, we should also mention that it shifts to the canonical case, which is usually (but not always) lowercase. I think Cherokee is one that folds to the upper case. On Mon, Aug 24, 2020 at 11:02 AM Thorsten wrote: > > Thorsten added the comment: > > I see. I found the documents. That's an issue. That usage is incorrect. It > is still valid to upper case "ß" to SS since "ẞ" is fairly new as an > official German character, but the other way around is not valid. > > As such the current sentence in documentation also just does not make > sense. > > >"Since it is already lowercase, lower() would do nothing to 'ß'" > > Exactly. Why would it? It is nonsensical to change an already lowercase > character with a lowercase function. > > Suggest to update to: > > "For example, the Unicode standard for German lower case letter 'ß' > prescribes full casefolding to 'ss'. Since it is already lowercase, lower() > would do nothing to 'ß'; casefold() converts it to 'ss'. > In addition to full lowercasing, this function also expands ligatures, for > example, 'fi' becomes 'fi'." > > -- > > ___ > Python tracker > <https://bugs.python.org/issue13828> > ___ > -- ___ Python tracker <https://bugs.python.org/issue13828> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41405] python 3.9.0b5 test
Jim Jewett added the comment: Then I suspect they also exist in even earlier versions, and are actually tied to your development setup. That should still be fixed, but it is probably not in Python's own code. It might be in python's build process, which is still on us. Or it might be in your distribution, or in a dependency like Tk, or in your personal C compiler or setup. Could you look to see what your system's actual passwd file says, and how tcl rounds outside of python, and how many color pairs your curses supports or has? -- versions: +Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41405> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40841] Provide mimetypes.sniff API as stdlib
Jim Jewett added the comment: There are a zillion reasons a filename could be wrong -- but the standard says to trust the filesystem. So if it sniffs based on contents, it isn't quite following the standard. It is probably still a useful tool, but it won't be the One Right Way, and it isn't even clear that it should replace current heuristics. On Mon, Jul 27, 2020 at 7:22 PM Guido van Rossum wrote: > > Guido van Rossum added the comment: > > Whether the data was retrieved over a network has nothing to do with it. > > There are complementary ways of guessing what data you are working with -- > guess based on the filename extension or sniff based on the contents of the > file (or downloaded data). > > There are a zillion reasons why the filename could be a lie -- e.g. a user > could pick the wrong extension, or rename a file, or a tool could save a > file using the wrong extension or no extension at all. Then again sometimes > the contents of the file might not be enough, e.g. > ``` > foo() // bar > ``` > is both valid Python and valid JavaScript. :-) > > -- > > ___ > Python tracker > <https://bugs.python.org/issue40841> > ___ > -- ___ Python tracker <https://bugs.python.org/issue40841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41391] Make test_unicodedata pass when running without network
Jim Jewett added the comment: Looks Good To Me -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue41391> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31904] Python should support VxWorks RTOS
Jim Jewett added the comment: Is it safe to say that there is an now intent to support VxWorks within the main tree, with Wind River agreeing to be primary support? And this ticket has become a tracking ticket for the status on getting it there, small PR by small PR plus buildbot? -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue31904> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41407] Tricky behavior of builtin-function map
Jim Jewett added the comment: Why would you raise StopIteration if you didn't want to stop the nearest iteration loop? I agree that the result of your sample code seems strange, but that is because it is strange code. I agree with Steven D'Aprano that changing it would cause more pain than it would remove. Unless it gets a lot more support by the first week of August, I recommend closing this request as rejected. -- nosy: +Jim.Jewett status: open -> pending ___ Python tracker <https://bugs.python.org/issue41407> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18280] Documentation is too personalized
Jim Jewett added the comment: I won't speak of nroff or troff in particular, but many programs had trouble distinguishing the end of a sentence from an honorific abbreviation, such as Mr. Spock or Dr. Seuss. -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue18280> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40841] Provide mimetypes.sniff API as stdlib
Jim Jewett added the comment: The standard itself says that it only applies to content served over http; if the content is retrieved by ftp or from a file system, then you should trust that. I don't notice that in the code you pointed to. So maybe filetype is the right answer if the data isn't coming over the network? For whatwg demonstration code, it is reasonable to assume that, but in python -- at a minimum, you should document the assumption prominently in the docs and docstring. -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue40841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41409] deque.pop(index) is not supported
Jim Jewett added the comment: It may well have been intentional, as deques should normally be mutated only at the ends. But Raymond did make changes to conform to the ABC, so this should probably be supported too. Go ahead and include docstrings and/or discouraging it, though, except for i=0 and i=-1 -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue41409> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41405] python 3.9.0b5 test
Jim Jewett added the comment: Is this a platform where 3.8 was working? The curses test seems to think you have too many color-pairs defined, and this might well be part of a semi-compatible curses library. I guess I would add some output to the test showing how many (and which) color pairs it thinks there are. The pwd complaint is correct, but seems like it is complaining about the interface between python and your OS. The tkinter problem is really a failure to round a floating point, and I would be surprised if python had made changes there recently. I would be slightly less surprised if something in the compile chain of tk for your system hard-coded a specific rounding format. -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue41405> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: A rule for your twitlist/mailing list
On 7/14/20 9:51 PM, Grant Edwards wrote: On 2020-07-15, Cameron Simpson wrote: On 14Jul2020 08:49, Nomen Nescio wrote: Is the mailing list for comp.lang.python still open? If you mean the python-list mailing list, yes. It is what I use, and it does not suffer from the spam you describe. Here: https://mail.python.org/mailman/listinfo/python-list It gateways with the newsgroup, but has much better spam qualities. And if you prefer to read the mailing list with an NNTP client, you can point your favorite newsreader at news.gmane.org and subscribe to gmane.comp.python.general -- Grant I think that should now be news.gmane.io, at least that's how I get comp.python. I think gmane.org shut down. Regards, Jim -- https://mail.python.org/mailman/listinfo/python-list
[issue41220] add optional make_key argument to lru_cache
Jim Jewett added the comment: Going back to Raymond's analysis, this is useful when at least some of the parameters either do not change the result, or are not hashable. At a minimum, you need to figure out which parameters those are, and whether to drop them or transform them. Is this already sufficiently rare or tricky that a subclass is justified, instead of trying to shoehorn things into a single key method? -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue41220> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41246] IOCP Proactor same socket overlapped callbacks
Jim Jewett added the comment: Looks good to me. I at first worried that the different function names were useful metadata that was getting lost -- but the names were already duplicated in several cases. *If* that is still a concern for the committer, then instead of repeating the code (as current production does), each section should just say newname=origname before registering the static method (as the patch does), and should bind a distinct name for each usage. -- nosy: +Jim.Jewett versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue41246> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41217] Obsolete note for default asyncio event loop on Windows
Jim Jewett added the comment: Looks good to me. -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue41217> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41212] Emoji Unicode failing in standard release of Python 3.8.3 / tkinter 8.6.8
Jim Jewett added the comment: @Ben Griffin -- Unicode has defined astral characters for a while, but they were explicitly intended for rare characters, with any living languages intended for the basic plane. It is only the most recent releases of unicode that have broken the "most people won't need this" expectation, so it wasn't unreasonable for languages targeting memory-constrained devices to make astral support at best a compile-time operation. I've seen a draft for an upcoming spec update of an old but still-supported language (extended Gerber, for photoplotting machines) that "handles" this simply by clarifying that their unicode support is limited to characters < 65K. Given that their use of unicode is essentially limited to comments, and there is plenty of hardware that can't be updated ... this is may well be correct. Python itself does the right thing, and tcl can't do the right thing anyhow without font support ... so this may be fixed in less time than it would take to replace Tk/Tcl. If you need a faster workaround, consider a private-use-area and private font. -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue41212> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39542] Cleanup object.h header
Jim Jewett added the comment: Raymond, did you replace the screenshot with a later one showing that things are fixed now? The timestamp suggests it went up at the same time as your comment, but what I see in the .png file is that the two are identical other than addresses. -- nosy: +Jim.Jewett ___ Python tracker <https://bugs.python.org/issue39542> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Does this dataframe look correct?
On 6/29/20 2:16 AM, Peter Otten wrote: Jim wrote: linux mint 19.3, python 3.6 I wrote a program to download stock info from yahoo using yfinance. I have been running it unchanged for the past 3 months, today it gave an error. When looping through a list of stocks the error is random, never the same position in the list. I wrote the following little test script to show the error: import yfinance as yf import pandas as pd day = '2020-06-25' aapl = yf.Ticker('AAPL') hist = aapl.history(start=day) print(hist) close = hist.loc[day]['Close'] I ran it 10 times 8 times I got a dataframe and 2 times I got the error shown below: (env36) jfb@jims-mint18 ~ $ /home/jfb/EVs/env36/bin/python3 /home/jfb/Dev/Python/test_yfinance.py OpenHigh Low CloseVolume Date 2020-06-25 360.70 365.00 357.57 364.84 34380600 2020-06-26 364.41 365.32 353.02 353.63 51270100 (env36) jfb@jims-mint18 ~ $ /home/jfb/EVs/env36/bin/python3 /home/jfb/Dev/Python/test_yfinance.py Traceback (most recent call last): File "/home/jfb/Dev/Python/test_yfinance.py", line 13, in hist = aapl.history(start=day) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/yfinance/base.py", line 155, in history data = data.json() File "/home/jfb/EVs/env36/lib/python3.6/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads return _default_decoder.decode(s) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) I don't know pandas that well. My only contact with it is when a module I am using depends on it. So does the dataframe look correct? The error complains of line 1, column 1. Just looking at the dataframe it looks like Date is on a different line from the rest of the headers or is that just the result of being printed in the terminal? On the yfinance github issues page there were a few people reporting this error. A couple of people reported a work around using try/except. It worked for some people and not others. It didn't work for me. I'd appreciate any advice you could give. My guess is that pandas is not the source of the problem. The error occurs when simplejson tries to parse an empty string: import simplejson simplejson.loads("") Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 488, in loads return _default_decoder.decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 389, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0) This probably means that yahoo returns an empty string instead of the expected JSON. If the error occurs only sporadically and you can identify the downloading code in the API source you can try and replace (pseudo-code) json_data = download_from_yahoo() df = dataframe_from_json(json_data) with while True: json_data = download_from_yahoo() if json_data: break time.sleep(1) # wait a moment, then retry download df = dataframe_from_json(json_data) Thanks, I have it working now by wrapping a for loop in a try/except. When I get a chance I will use yours and MRAB's suggestions to try to figure out just what caused the problem. Regards, Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: Does this dataframe look correct?
On 6/28/20 8:53 PM, MRAB wrote: On 2020-06-28 23:11, Jim wrote: linux mint 19.3, python 3.6 I wrote a program to download stock info from yahoo using yfinance. I have been running it unchanged for the past 3 months, today it gave an error. When looping through a list of stocks the error is random, never the same position in the list. I wrote the following little test script to show the error: import yfinance as yf import pandas as pd day = '2020-06-25' aapl = yf.Ticker('AAPL') hist = aapl.history(start=day) print(hist) close = hist.loc[day]['Close'] I ran it 10 times 8 times I got a dataframe and 2 times I got the error shown below: (env36) jfb@jims-mint18 ~ $ /home/jfb/EVs/env36/bin/python3 /home/jfb/Dev/Python/test_yfinance.py Open High Low Close Volume Date 2020-06-25 360.70 365.00 357.57 364.84 34380600 2020-06-26 364.41 365.32 353.02 353.63 51270100 (env36) jfb@jims-mint18 ~ $ /home/jfb/EVs/env36/bin/python3 /home/jfb/Dev/Python/test_yfinance.py Traceback (most recent call last): File "/home/jfb/Dev/Python/test_yfinance.py", line 13, in hist = aapl.history(start=day) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/yfinance/base.py", line 155, in history data = data.json() File "/home/jfb/EVs/env36/lib/python3.6/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads return _default_decoder.decode(s) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) I don't know pandas that well. My only contact with it is when a module I am using depends on it. So does the dataframe look correct? The error complains of line 1, column 1. Just looking at the dataframe it looks like Date is on a different line from the rest of the headers or is that just the result of being printed in the terminal? On the yfinance github issues page there were a few people reporting this error. A couple of people reported a work around using try/except. It worked for some people and not others. It didn't work for me. I'd appreciate any advice you could give. It's complaining about the JSON data that it's getting. What does that data look like when it complains? It might be that there's some kind of limit to how often you can get the data and it's trying to tell you that, but you're not expecting anything back except the data. You could add some temporary code at line 897 of "/home/jfb/EVs/env36/lib/python3.6/site-packages/requests/models.py" to save the data to a file just before the decoding. Remember to make a backup copy of any source file that you modify! I don't think it is a limit problem. It happened the first time I ran the script after a week of not using it. I am only geting info on 33 stocks and I know that people use this module to get info on 100's of stocks. Anyway I was wrong about the try/except not solving the problem. I made a mistake in the try/except and when I corrected it, like a dummy, I never saved the change before running it again. I will use your suggestions to see if I can figure out the root cause of the problem. as before today it ran for months with no errors. Sorry for taking up the lists time with my mistake and thanks for your help. Regards, Jim -- https://mail.python.org/mailman/listinfo/python-list
Does this dataframe look correct?
linux mint 19.3, python 3.6 I wrote a program to download stock info from yahoo using yfinance. I have been running it unchanged for the past 3 months, today it gave an error. When looping through a list of stocks the error is random, never the same position in the list. I wrote the following little test script to show the error: import yfinance as yf import pandas as pd day = '2020-06-25' aapl = yf.Ticker('AAPL') hist = aapl.history(start=day) print(hist) close = hist.loc[day]['Close'] I ran it 10 times 8 times I got a dataframe and 2 times I got the error shown below: (env36) jfb@jims-mint18 ~ $ /home/jfb/EVs/env36/bin/python3 /home/jfb/Dev/Python/test_yfinance.py OpenHigh Low CloseVolume Date 2020-06-25 360.70 365.00 357.57 364.84 34380600 2020-06-26 364.41 365.32 353.02 353.63 51270100 (env36) jfb@jims-mint18 ~ $ /home/jfb/EVs/env36/bin/python3 /home/jfb/Dev/Python/test_yfinance.py Traceback (most recent call last): File "/home/jfb/Dev/Python/test_yfinance.py", line 13, in hist = aapl.history(start=day) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/yfinance/base.py", line 155, in history data = data.json() File "/home/jfb/EVs/env36/lib/python3.6/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads return _default_decoder.decode(s) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/home/jfb/EVs/env36/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) I don't know pandas that well. My only contact with it is when a module I am using depends on it. So does the dataframe look correct? The error complains of line 1, column 1. Just looking at the dataframe it looks like Date is on a different line from the rest of the headers or is that just the result of being printed in the terminal? On the yfinance github issues page there were a few people reporting this error. A couple of people reported a work around using try/except. It worked for some people and not others. It didn't work for me. I'd appreciate any advice you could give. Thanks, Jim -- https://mail.python.org/mailman/listinfo/python-list
[issue40852] Dictionary created with dict.fromkeys have issues (all explained in the file)
New submission from Jim Fasarakis-Hilliard : This isn't an issue, `value` (that is, `{}` here) is shared among all keys. Since you've added a mutable value, when you mutate it this change is seen for all keys holding the value. This is documented in dict.fromkeys https://docs.python.org/3/library/stdtypes.html#dict.fromkeys -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker <https://bugs.python.org/issue40852> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40846] Misleading line in documentation
Jim Fasarakis-Hilliard added the comment: A simple substitution of 'types' with 'kind' should do it. This aligns with the terminology [1] used in the glossary. [1] https://docs.python.org/3/glossary.html#term-parameter -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker <https://bugs.python.org/issue40846> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Trouble with version 3.8
I had been using python 3.6 on two computers with windows 7 and windows 10. We bought a windows 10 machine and I installed python 3.8 on it. Many of my python apps failed with an error similar to this: File "C:\Python38\lib\os.py", line 818, in fsdecode filename = fspath(filename) # Does type-checking of `filename`.TypeError: expected str, bytes or os.PathLike object, not list I looked online and could not find any solutions to my problem. So, I uninstalled v3.8 and installed v3.6. Version 3.6 worked. Any advice on how to fix version 3.8 would be appreciated. -- https://mail.python.org/mailman/listinfo/python-list
[issue40838] inspect.getsourcefile documentation doesn't mention it can return None
Jim Fasarakis-Hilliard added the comment: For a more comprehensive list, we currently have for `get*` functions in `inspect`: `inspect.getdoc`: Returns `None` if the documentation string isn't present, either directly on the object or through it mro. This *isn't* documented. `inspect.getfile`: Explicitly seems to handle None cases. After peeking a bit in the `PyCode_*` interface, it doesn't seem to be possible to assign `None` to the `co_filename` so the returning the `object.co_filename` in the function appears to not be able to return `None`. `inspect.getmodule`: Returns None in a number of cases. This *isn't* documented. `inspect.getsourcefile`: Returns None if the filename indicates an extension module or when none of the ifs are matched. This *isn't* documented. Some (getmodulename, getcomments) do document this. Agreed that the rest of the cases where `None`s might be returned should be documented. -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker <https://bugs.python.org/issue40838> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17005] Add a topological sort algorithm
Jim Fasarakis-Hilliard added the comment: Another option, `graphlib`[1], does exist on PyPI but is not maintained and currently read-only by the author. Other flavors[2][3] of the same name also don't seem to have much adoption so they shouldn't confuse if a name like `graphlib` was chosen. [1] https://github.com/bruth/graphlib/ [2] https://github.com/MengLiuPurdue/graph_lib [3] https://github.com/EmileTrotignon/GraphLib -- ___ Python tracker <https://bugs.python.org/issue17005> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17005] Add a topological sort algorithm
Jim Fasarakis-Hilliard added the comment: The downside I see with any graph prefixed names is the fact that it implies a larger collection of graph operations. Add that to the fact that people might be more tempted to propose many graph related algorithms/utilities to a module with the same name. A more localized name solves that. -- ___ Python tracker <https://bugs.python.org/issue17005> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17005] Add a topological sort algorithm
Jim Fasarakis-Hilliard added the comment: It does seem out of place in functools, intensified by it's odd interjection among the other functools objects. Considering heapq and bisect exist as standalone modules, the idea that topological sorting could go in its own module wouldn't be without precedent. -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker <https://bugs.python.org/issue17005> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38938] Possible performance improvement for heapq.merge()
Change by Jim Fasarakis-Hilliard : -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker <https://bugs.python.org/issue38938> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1635741] Py_Finalize() doesn't clear all Python objects at exit
Change by Jim Fasarakis-Hilliard : -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker <https://bugs.python.org/issue1635741> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com