Re: setup.py + cython == chicken and the egg problem
On Wed, Aug 17, 2022 at 3:05 PM Dan Stromberg wrote: > I commented out those too lines, but I'm still getting errors. They seem >> to stem from: >> $ "/home/dstromberg/venv/pyx-treap-testing/bin/python3", >> ["/home/dstromberg/venv/pyx-treap-testing/bin/python3", >> "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py", >> "install", "--ignore-installed", "--no-user", "--prefix", >> "/tmp/pip-build-env-9_ivrsb6/overlay", "--no-warn-script-location", >> "--no-binary", ":none:", "--only-binary", ":none:", "-i", " >> https://test.pypi.org/simple/;, "--", "setuptools >= 44.1.1", "wheel", >> "Cython"] >> "/home/dstromberg/venv/pyx-treap-testing/bin/python3" >> "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py" >> "install" "--ignore-installed" "--no-user" "--prefix" >> "/tmp/pip-build-env-9_ivrsb6/overlay" "--no-warn-script-location" >> "--no-binary" ":none:" "--only-binary" ":none:" "-i" " >> https://test.pypi.org/simple/; "--" "setuptools >= 44.1.1" "wheel" >> "Cython" >> Looking in indexes: https://test.pypi.org/simple/ >> ERROR: Could not find a version that satisfies the requirement >> setuptools>=44.1.1 (from versions: none) >> ERROR: No matching distribution found for setuptools>=44.1.1 >> >> I copied that out of an strace. >> >> That's likely related to my pyproject.toml: >> $ cat pyproject.toml >> below cmd output started 2022 Wed Aug 17 01:57:09 PM PDT >> [build-system] >> requires = ["setuptools >= 44.1.1", "wheel", "Cython"] >> build-backend = "setuptools.build_meta" >> >> Any other suggestions folks? >> > > I don't know why, but if I delete the --ignore-installed option, I don't > get the error: > $ "/home/dstromberg/venv/pyx-treap-testing/bin/python3" > "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py" > "install" "--ignore-installed" "--prefix" > "/tmp/pip-build-env-9_ivrsb6/overlay" "-i" "https://test.pypi.org/simple/; > "--" "setuptools>=44.1.1" > below cmd output started 2022 Wed Aug 17 02:56:24 PM PDT > Looking in indexes: https://test.pypi.org/simple/ > ERROR: Could not find a version that satisfies the requirement > setuptools>=44.1.1 (from versions: none) > ERROR: No matching distribution found for setuptools>=44.1.1 > (setuptools-investigation) above cmd output done2022 Wed Aug 17 > 02:56:24 PM PDT > dstromberg@tp-mini-c:~ x86_64-pc-linux-gnu 2995 > > $ "/home/dstromberg/venv/pyx-treap-testing/bin/python3" > "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py" > "install" "--prefix" "/tmp/pip-build-env-9_ivrsb6/overlay" "-i" " > https://test.pypi.org/simple/; "--" "setuptools>=44.1.1" > below cmd output started 2022 Wed Aug 17 02:56:35 PM PDT > Looking in indexes: https://test.pypi.org/simple/ > Requirement already satisfied: setuptools>=44.1.1 in > ./venv/pyx-treap-testing/lib/python3.9/site-packages (63.4.1) > > If I search for foo on pypi and testpypi, shouldn't I get foo before > foo-bar and bar-foo? > > Because if I search for setuptools on pypi, I get setuptools as my first > hit, but on testpypi, I don't see setuptools anywhere in the first page. > That's perhaps significant if the search ordering is working as described > above. > > ? > IOW, maybe testpypi doesn't have setuptools. Indeed, it doesn't appear to. Publishing and installing from the real pypi seems to be working. Thanks folks. -- https://mail.python.org/mailman/listinfo/python-list
Re: Fwd: install
On 18/08/2022 08.54, Sherea Washington wrote: > -- Forwarded message - > From: Sherea Washington > Date: Wed, Aug 17, 2022 at 4:41 PM > Subject: install > To: > > > Hi > > I'm trying to install this. I have used all of these options below, but I > can't anywhere. it keeps looping back to this when I click on the download. > Please help. cell 843-364-2212 > > [image: image.png] Welcome to the list. Sadly, no graphics are allowed. The cell number does not appear to include an international code. Please review the documentation: 4. Using Python on Windows https://docs.python.org/3/using/windows.html and advise if that does not solve the problem. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list
Fwd: install
-- Forwarded message - From: Sherea Washington Date: Wed, Aug 17, 2022 at 4:41 PM Subject: install To: Hi I'm trying to install this. I have used all of these options below, but I can't anywhere. it keeps looping back to this when I click on the download. Please help. cell 843-364-2212 [image: image.png] -- https://mail.python.org/mailman/listinfo/python-list
Re: setup.py + cython == chicken and the egg problem
On Wed, Aug 17, 2022 at 1:58 PM Dan Stromberg wrote: > On Wed, Aug 17, 2022 at 10:20 AM Christian Gollwitzer > wrote: > >> Am 16.08.22 um 23:03 schrieb Dan Stromberg: >> > I'm attempting to package up a python package that uses Cython. >> > >> > Rather than build binaries for everything under the sun, I've been >> focusing >> > on including the .pyx file and running cython on it at install time. >> This >> > requires a C compiler, but I'm OK with that. >> > >> > However, when I try to install the package from test.pypi.org, I get: >> > $ python3 -m pip install -i https://test.pypi.org/simple/ pyx-treap >> > below cmd output started 2022 Tue Aug 16 01:55:16 PM PDT >> > Looking in indexes: https://test.pypi.org/simple/ >> > Collecting pyx-treap >> >Downloading >> > >> https://test-files.pythonhosted.org/packages/3a/41/af5360934adccfc086a39e1f720323895144b53454ff6dacc0f06267db55/pyx_treap-2.0.15.tar.gz >> > (125 kB) >> > >> > >> >> >> > 125.9/125.9 kB 1.9 MB/s eta 0:00:00 >> >Installing build dependencies ... error >> >error: subprocess-exited-with-error >> > >> >×? pip subprocess to install build dependencies did not run >> successfully. >> >?? exit code: 1 >> >> [3 lines of output] >> >Looking in indexes: https://test.pypi.org/simple/ >> >ERROR: Could not find a version that satisfies the requirement >> > setuptools (from versions: none) >> >ERROR: No matching distribution found for setuptools >> >[end of output] >> > >> >note: This error originates from a subprocess, and is likely not a >> > problem with pip. >> > error: subprocess-exited-with-error >> >> >> I looked at your code and I think you are trying too hard. As far as I >> understand, you need Cython to be installed before the build process >> begins. Your entry in pyproject.toml should take care of that. >> But you also have these lines in your setup.py >> >> subprocess.check_call('%s -m pip install cython' % (sys.executable, ), >> shell=True) >> subprocess.check_call('%s -m cython pyx_treap.pyx' % (sys.executable, ), >> shell=True) >> >> The first one calls out to pip while pip is already running, I'm not >> sure that this will work, but judging from the error message it is >> looking for the requirements also from test.pypi. Maybe this is the >> reason that it fails (the error message says that it can't find >> setuptools). So jut delete this line and it might already work >> >> The second line, which compiles the Cython code, also runs *at every >> invocation of setup.py*, even if you'd do just >> >> python3 setup.py --help >> >> It may still work, but the correct way to do it is to create a build >> extension for setuptools. In my project you can see this here: >> >> https://github.com/j-from-b/CDEF/blob/main/setup.py#L88 >> >> OTOH, I would be surprised if Cython did not have this already, indeed >> you imported cythonize from Cython.Build. So maybe just deleting these >> two lines and it might work? >> > > I commented out those too lines, but I'm still getting errors. They seem > to stem from: > $ "/home/dstromberg/venv/pyx-treap-testing/bin/python3", > ["/home/dstromberg/venv/pyx-treap-testing/bin/python3", > "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py", > "install", "--ignore-installed", "--no-user", "--prefix", > "/tmp/pip-build-env-9_ivrsb6/overlay", "--no-warn-script-location", > "--no-binary", ":none:", "--only-binary", ":none:", "-i", " > https://test.pypi.org/simple/;, "--", "setuptools >= 44.1.1", "wheel", > "Cython"] > "/home/dstromberg/venv/pyx-treap-testing/bin/python3" > "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py" > "install" "--ignore-installed" "--no-user" "--prefix" > "/tmp/pip-build-env-9_ivrsb6/overlay" "--no-warn-script-location" > "--no-binary" ":none:" "--only-binary" ":none:" "-i" " > https://test.pypi.org/simple/; "--" "setuptools >= 44.1.1" "wheel" > "Cython" > Looking in indexes: https://test.pypi.org/simple/ > ERROR: Could not find a version that satisfies the requirement > setuptools>=44.1.1 (from versions: none) > ERROR: No matching distribution found for setuptools>=44.1.1 > > I copied that out of an strace. > > That's likely related to my pyproject.toml: > $ cat pyproject.toml > below cmd output started 2022 Wed Aug 17 01:57:09 PM PDT > [build-system] > requires = ["setuptools >= 44.1.1", "wheel", "Cython"] > build-backend = "setuptools.build_meta" > > Any other suggestions folks? > I don't know why, but if I delete the --ignore-installed option, I don't get the error: $ "/home/dstromberg/venv/pyx-treap-testing/bin/python3" "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py" "install" "--ignore-installed" "--prefix" "/tmp/pip-build-env-9_ivrsb6/overlay" "-i" "https://test.pypi.org/simple/; "--"
Re: Problem using cx_Freeze
On 2022-08-17 12:09:14 -0600, David at Booomer wrote: > Executable( > > "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py", > > "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py", > "separete.py","speak.py", > ) [...] > I am/was worried about the trailing ‘,' after ',"speak.py”,’ <- but > deleting it or moving it after the ] didn’t help. This has nothing to do with your problem but: Python allows a trailing comma in any comma-separated list of values. It will just be ignored. This is really common in modern programming languages (read: programming languages younger than 30 years or so), because it makes it much more convenient to extend/shorten/reorder a list. Otherwise you alway have to remember add or remove a comma in the right place. (Some people (especially SQL programmers for some reason) resorted to put the comma at the start of each line to get around this, which is really ugly.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature -- https://mail.python.org/mailman/listinfo/python-list
Re: UTF-8 and latin1
On 18/08/2022 03.33, Stefan Ram wrote: > Tobiah writes: >> I get data from various sources; client emails, spreadsheets, and >> data from web applications. I find that I can do >> some_string.decode('latin1') > > Strings have no "decode" method. ("bytes" objects do.) > >> to get unicode that I can use with xlsxwriter, >> or put in the header of a web page to display >> European characters correctly. > > |You should always use the UTF-8 character encoding. (Remember > |that this means you also need to save your content as UTF-8.) > World Wide Web Consortium (W3C) (2014) > >> am using data from the wild. It's frustrating that I have to play >> a guessing game to figure out how to use incoming text. I'm just wondering > > You can let Python guess the encoding of a file. > > def encoding_of( name ): > path = pathlib.Path( name ) > for encoding in( "utf_8", "cp1252", "latin_1" ): > try: > with path.open( encoding=encoding, errors="strict" )as file: > text = file.read() > return encoding > except UnicodeDecodeError: > pass > return None > >> if there are any thoughts. What if we just globally decided to use utf-8? >> Could that ever happen? > > That decisions has been made long ago. Unfortunately, much of our data was collected long before then - and as we've discovered, the OP is still living in Python 2 times. What about if the path "name" (above) is not in utf-8? eg the OP's Montréal in Latin1, as Montréal.txt or Montréal.rpt -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: setup.py + cython == chicken and the egg problem
On Wed, Aug 17, 2022 at 10:20 AM Christian Gollwitzer wrote: > Am 16.08.22 um 23:03 schrieb Dan Stromberg: > > I'm attempting to package up a python package that uses Cython. > > > > Rather than build binaries for everything under the sun, I've been > focusing > > on including the .pyx file and running cython on it at install time. > This > > requires a C compiler, but I'm OK with that. > > > > However, when I try to install the package from test.pypi.org, I get: > > $ python3 -m pip install -i https://test.pypi.org/simple/ pyx-treap > > below cmd output started 2022 Tue Aug 16 01:55:16 PM PDT > > Looking in indexes: https://test.pypi.org/simple/ > > Collecting pyx-treap > >Downloading > > > https://test-files.pythonhosted.org/packages/3a/41/af5360934adccfc086a39e1f720323895144b53454ff6dacc0f06267db55/pyx_treap-2.0.15.tar.gz > > (125 kB) > > > > > > > > 125.9/125.9 kB 1.9 MB/s eta 0:00:00 > >Installing build dependencies ... error > >error: subprocess-exited-with-error > > > >×? pip subprocess to install build dependencies did not run > successfully. > >?? exit code: 1 > >> [3 lines of output] > >Looking in indexes: https://test.pypi.org/simple/ > >ERROR: Could not find a version that satisfies the requirement > > setuptools (from versions: none) > >ERROR: No matching distribution found for setuptools > >[end of output] > > > >note: This error originates from a subprocess, and is likely not a > > problem with pip. > > error: subprocess-exited-with-error > > > I looked at your code and I think you are trying too hard. As far as I > understand, you need Cython to be installed before the build process > begins. Your entry in pyproject.toml should take care of that. > But you also have these lines in your setup.py > > subprocess.check_call('%s -m pip install cython' % (sys.executable, ), > shell=True) > subprocess.check_call('%s -m cython pyx_treap.pyx' % (sys.executable, ), > shell=True) > > The first one calls out to pip while pip is already running, I'm not > sure that this will work, but judging from the error message it is > looking for the requirements also from test.pypi. Maybe this is the > reason that it fails (the error message says that it can't find > setuptools). So jut delete this line and it might already work > > The second line, which compiles the Cython code, also runs *at every > invocation of setup.py*, even if you'd do just > > python3 setup.py --help > > It may still work, but the correct way to do it is to create a build > extension for setuptools. In my project you can see this here: > > https://github.com/j-from-b/CDEF/blob/main/setup.py#L88 > > OTOH, I would be surprised if Cython did not have this already, indeed > you imported cythonize from Cython.Build. So maybe just deleting these > two lines and it might work? > I commented out those too lines, but I'm still getting errors. They seem to stem from: $ "/home/dstromberg/venv/pyx-treap-testing/bin/python3", ["/home/dstromberg/venv/pyx-treap-testing/bin/python3", "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py", "install", "--ignore-installed", "--no-user", "--prefix", "/tmp/pip-build-env-9_ivrsb6/overlay", "--no-warn-script-location", "--no-binary", ":none:", "--only-binary", ":none:", "-i", " https://test.pypi.org/simple/;, "--", "setuptools >= 44.1.1", "wheel", "Cython"] "/home/dstromberg/venv/pyx-treap-testing/bin/python3" "/home/dstromberg/venv/pyx-treap-testing/lib/python3.9/site-packages/pip/__pip-runner__.py" "install" "--ignore-installed" "--no-user" "--prefix" "/tmp/pip-build-env-9_ivrsb6/overlay" "--no-warn-script-location" "--no-binary" ":none:" "--only-binary" ":none:" "-i" " https://test.pypi.org/simple/; "--" "setuptools >= 44.1.1" "wheel" "Cython" Looking in indexes: https://test.pypi.org/simple/ ERROR: Could not find a version that satisfies the requirement setuptools>=44.1.1 (from versions: none) ERROR: No matching distribution found for setuptools>=44.1.1 I copied that out of an strace. That's likely related to my pyproject.toml: $ cat pyproject.toml below cmd output started 2022 Wed Aug 17 01:57:09 PM PDT [build-system] requires = ["setuptools >= 44.1.1", "wheel", "Cython"] build-backend = "setuptools.build_meta" Any other suggestions folks? -- https://mail.python.org/mailman/listinfo/python-list
Re: UTF-8 and latin1
> On 17 Aug 2022, at 18:30, Jon Ribbens via Python-list > wrote: > > On 2022-08-17, Tobiah wrote: >> I get data from various sources; client emails, spreadsheets, and >> data from web applications. I find that I can do >> some_string.decode('latin1') >> to get unicode that I can use with xlsxwriter, >> or put in the header of a web page to display >> European characters correctly. But normally UTF-8 is recommended as >> the encoding to use today. latin1 works correctly more often when I >> am using data from the wild. It's frustrating that I have to play >> a guessing game to figure out how to use incoming text. I'm just wondering >> if there are any thoughts. What if we just globally decided to use utf-8? >> Could that ever happen? > > That has already been decided, as much as it ever can be. UTF-8 is > essentially always the correct encoding to use on output, and almost > always the correct encoding to assume on input absent any explicit > indication of another encoding. (e.g. the HTML "standard" says that > all HTML files must be UTF-8.) > > If you are finding that your specific sources are often encoded with > latin-1 instead then you could always try something like: > >try: >text = data.decode('utf-8') >except UnicodeDecodeError: >text = data.decode('latin-1') > > (I think latin-1 text will almost always fail to be decoded as utf-8, > so this would work fairly reliably assuming those are the only two > encodings you see.) Only if a reserved byte is used in the string. It will often work in either. For web pages it cannot be assumed that markup saying it’s utf-8 is correct. Many pages are I fact cp1252. Usually you find out because of a smart quote that is 0xa0 is cp1252 and illegal in utf-8. Barry > > Or you could use something fancy like https://pypi.org/project/chardet/ > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem using cx_Freeze
On Wed, 17 Aug 2022 12:09:14 -0600, David at Booomer declaimed the following: >executables=[ >Executable( > > "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py", > > "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py", >"separete.py","speak.py", >) >] >) > You are defining a list "executables" with only ONE member... (and is that really how you spelled "separate"). >Searching for ‘__init__(' in the 13 *.py files returned five lines in two >files (algorithm.py and prjui.py). As mentioned searching for this error only >produced mention of adding self which is in these lines already. Previously I >had search for __init__() which returned no lines due to the closing ). > You are still searching the wrong place... The __init__() that is complaining is the one in cx_Freeze.Executable(). >I had visited the page you provided >(https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable) > but didn’t noticed the 11 plus self as 12 arguments. Really? Please count (reformatted from cut): """ argument name description #1 script the name of the file containing the script which is to be frozen #2 init_script the name of the initialization script that will be executed before the actual script is executed; this script is used to set up the environment for the executable; if a name is given without an absolute path the names of files in the initscripts subdirectory of the cx_Freeze package is searched #3 basethe name of the base executable; if a name is given without an absolute path the names of files in the bases subdirectory of the cx_Freeze package is searched #4 target_name the name of the target executable; the default value is the name of the script; the extension is optional (automatically added on Windows); support for names with version; if specified a pathname, raise an error. #5 iconname of icon which should be included in the executable itself on Windows or placed in the target directory for other platforms (ignored in Microsoft Store Python app) #6 manifestname of manifest which should be included in the executable itself (Windows only - ignored by Python app from Microsoft Store) #7 uac-admin creates a manifest for an application that will request elevation (Windows only - ignored by Python app from Microsoft Store) #8 shortcut_name the name to give a shortcut for the executable when included in an MSI package (Windows only). #9 shortcut_dirthe directory in which to place the shortcut when being installed by an MSI package; see the MSI Shortcut table documentation for more information on what values can be placed here (Windows only). #10 copyright the copyright value to include in the version resource associated with executable (Windows only). #11 trademarks the trademarks value to include in the version resource associated with the executable (Windows only). """ You are passing 13 .py file names. There are only two arguments that really want file names: script, and init_script. Most of the other arguments are either optional or Windows specific (#6-11). I suspect you need to pass JUST main.py or Maiui.py (based on casing) -- which ever is really the file you'd invoke to start the program running. I'd hope the freeze system then scans (recursively) that file to find anything imported, and include those in the final product. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: UTF-8 and latin1
That has already been decided, as much as it ever can be. UTF-8 is essentially always the correct encoding to use on output, and almost always the correct encoding to assume on input absent any explicit indication of another encoding. (e.g. the HTML "standard" says that all HTML files must be UTF-8.) I got an email from a client with blast text that was in French with stuff like: Montréal, Quebéc. latin1 did the trick. Also, whenever I get a spreadsheet from a client and save as .csv, or take browser data through PHP, it always seems to work with latin1, but not UTF-8. -- https://mail.python.org/mailman/listinfo/python-list
Re: UTF-8 and latin1
On 8/17/22 08:33, Stefan Ram wrote: Tobiah writes: I get data from various sources; client emails, spreadsheets, and data from web applications. I find that I can do some_string.decode('latin1') Strings have no "decode" method. ("bytes" objects do.) I'm using 2.7. Maybe that's why. Toby -- https://mail.python.org/mailman/listinfo/python-list
Re: not able to use python
Those people keep me on my toes every time I look at such a message :-/. On Wed, Aug 17, 2022 at 12:35:28PM -0500, Igor Korot wrote: Hi, On Wed, Aug 17, 2022 at 12:20 PM i am unable to use python wrote: AND I"M UNABLE TO SEE ANYTHING IN YOUR MESSAGE... THANK YOU. Sent from [1]Mail for Windows References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list -- Daniel Ciprus .:|:.:|:. CONSULTING ENGINEER.CUSTOMER DELIVERY Cisco Systems Inc. dcip...@cisco.com tel: +1-703-484-0205 mob: +1-540-223-7098 [ curl -L http://git.io/unix ] signature.asc Description: PGP signature -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem using cx_Freeze
Hi Dennis Thank you for your reply. I’m am trying to get LaTex-to-Speech (https://github.com/SGanesh19/LaTeX-to-Speech) to run as an accessibility aid, converting equations into speech. I haven’t used cx_Freeze before so stumbling somewhat. The error returned is File "/Users/duser/Documents/Win_ShareFolder/LaTeX-to-Speech-master/setup.py", line 9, in Executable( TypeError: __init__() takes from 2 to 12 positional arguments but 14 were given The setup.py file is currently import cx_Freeze # from cx_Freeze import * from cx_Freeze import setup, Executable setup( name="Latex2Speech", options = {'build_exe':{'packages':['gtts','pyglet','PyQt4']}}, executables=[ Executable( "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py", "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py", "separete.py","speak.py", ) ] ) I am/was worried about the trailing ‘,' after ',"speak.py”,’ <- but deleting it or moving it after the ] didn’t help. Adding base = None also didn’t help. Searching for ‘__init__(' in the 13 *.py files returned five lines in two files (algorithm.py and prjui.py). As mentioned searching for this error only produced mention of adding self which is in these lines already. Previously I had search for __init__() which returned no lines due to the closing ). I had visited the page you provided (https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable) but didn’t noticed the 11 plus self as 12 arguments. Thanks again for any suggestions. David > From: Dennis Lee Bieber > Subject: Re: Problem using cx_Freeze > Date: August 15, 2022 at 8:18:54 PM MDT > To: python-list@python.org > > > On Mon, 15 Aug 2022 18:00:48 -0600, David at Booomer > declaimed the following: > > >> However I now get an error >> >> init() takes from 2 to 12 positional arguments but 14 were given >> >> I found a couple instances of init in two .py files that were part of the >> whole. >> >> One .py file >> def __init__(self): >> > > Please cut the TEXT of the console where the errors are displayed > -- don't paraphrase! > > init() is NOT the same as __init__() > > WHAT "One .py file"? This is a meaningless bit of information. > > The most likely __init__() involved is the one where > cx_Freeze.Executable is instantiated. > https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable > shows 11 parameters (and "self" would make the 12th). > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: setup.py + cython == chicken and the egg problem
Dan Stromberg wrote at 2022-8-16 14:03 -0700: > ... >I'm attempting to package up a python package that uses Cython. > ... > Installing build dependencies ... error > error: subprocess-exited-with-error > > ×? pip subprocess to install build dependencies did not run successfully. > ?? exit code: 1 > > [3 lines of output] > Looking in indexes: https://test.pypi.org/simple/ > ERROR: Could not find a version that satisfies the requirement >setuptools (from versions: none) > ERROR: No matching distribution found for setuptools The message tells you that there is a `setuptools` problem. I would start to locate all `setuptools` requirement locations. I am using `cython` for the package `dm.xmlsec.binding`. I have not observed nor heard of a problem similar to yours (but I have never tried `test.pypi.org`). -- https://mail.python.org/mailman/listinfo/python-list
Re: not able to use python
Hi, On Wed, Aug 17, 2022 at 12:20 PM i am unable to use python wrote: > > AND I"M UNABLE TO SEE ANYTHING IN YOUR MESSAGE... THANK YOU. > > > >Sent from [1]Mail for Windows > > > > References > >Visible links >1. https://go.microsoft.com/fwlink/?LinkId=550986 > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
UTF-8 and latin1
I get data from various sources; client emails, spreadsheets, and data from web applications. I find that I can do some_string.decode('latin1') to get unicode that I can use with xlsxwriter, or put in the header of a web page to display European characters correctly. But normally UTF-8 is recommended as the encoding to use today. latin1 works correctly more often when I am using data from the wild. It's frustrating that I have to play a guessing game to figure out how to use incoming text. I'm just wondering if there are any thoughts. What if we just globally decided to use utf-8? Could that ever happen? -- https://mail.python.org/mailman/listinfo/python-list
[Python-announce] Checking conditions with the easycheck package
We all know that the assert statement should not be used in production code. Instead, you can use assertion-like functions from the easycheck package. Consider the following example. You have a function that fits a statistical model that requires sample size (n) to be at least 20. So, >>> assert n >= 20 would not enable the function to continue if the condition is violated. But it's the assert statement, which should not be used that way. Here's where easycheck shines: >>> easycheck.check_if(n >= 20) is the easiest solution. It would throw AttributeError without a message. But we can improve this a lot; for example: >>> class TooSmallSampleSizeError(Exception): ... >>> easycheck.check_if(n >=20, handle_with=TooSmallSampleSizeError, message=f"Sample size of {n} is too small for the model to run") You can also issue warnings with easycheck: >>> class TooSmallSampleSizeWarning(Warning): ... >>> easycheck.check_if(n >=20, TooSmallSampleSizeWarning, f"Sample of {n} can be too small") If n is smaller than 20, you will see the following warning: "TooSmallSampleSizeWarning: Sample of 10 is too small" The easycheck package offers functions dedicated to - checking general conditions (like above) - checking an object's type - checking path(s) - checking an object's length - comparing floating-point numbers - checking function arguments - combining several conditions Most of them have aliases dedicated to unit testing. The package's advantages are the readability of the code, and the ease of using the package's functions. You can install easycheck from PyPi (pip install easycheck). You can find easycheck on GitHub: https://github.com/nyggus/easycheck/. If you like it, consider leaving a star. Contributions are also welcome! Enjoy easycheck-ing, Marcin ___ Python-announce-list mailing list -- python-announce-list@python.org To unsubscribe send an email to python-announce-list-le...@python.org https://mail.python.org/mailman3/lists/python-announce-list.python.org/ Member address: arch...@mail-archive.com
Re: UTF-8 and latin1
On 2022-08-17, Tobiah wrote: > I get data from various sources; client emails, spreadsheets, and > data from web applications. I find that I can do some_string.decode('latin1') > to get unicode that I can use with xlsxwriter, > or put in the header of a web page to display > European characters correctly. But normally UTF-8 is recommended as > the encoding to use today. latin1 works correctly more often when I > am using data from the wild. It's frustrating that I have to play > a guessing game to figure out how to use incoming text. I'm just wondering > if there are any thoughts. What if we just globally decided to use utf-8? > Could that ever happen? That has already been decided, as much as it ever can be. UTF-8 is essentially always the correct encoding to use on output, and almost always the correct encoding to assume on input absent any explicit indication of another encoding. (e.g. the HTML "standard" says that all HTML files must be UTF-8.) If you are finding that your specific sources are often encoded with latin-1 instead then you could always try something like: try: text = data.decode('utf-8') except UnicodeDecodeError: text = data.decode('latin-1') (I think latin-1 text will almost always fail to be decoded as utf-8, so this would work fairly reliably assuming those are the only two encodings you see.) Or you could use something fancy like https://pypi.org/project/chardet/ -- https://mail.python.org/mailman/listinfo/python-list
Getting an Error TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
sudo pip install pyro4 Collecting pyro4 Downloading https://files.pythonhosted.org/packages/70/e3/8c4e0d24b46fbf02e6b2dc2da5d18f0c73cfd343a1fb01ae64c788c20e56/Pyro4-4.82-py2.py3-none-any.whl (89kB) 100% || 92kB 7.3MB/s Collecting selectors34; python_version < "3.4" (from pyro4) Downloading https://files.pythonhosted.org/packages/13/25/4f4fa70ab23ad6263fe59cedf9dcd3ef71aa7f99c556c5e4c6435829e22d/selectors34-1.2-py2.py3-none-any.whl Collecting serpent<1.30,>=1.27; python_version < "3.2" (from pyro4) Exception: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run wb.build(autobuilding=True) File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build self.requirement_set.prepare_files(self.finder) File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file finder, self.upgrade, require_hashes) File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link self.link = finder.find_requirement(self, upgrade) File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement all_candidates = self.find_all_candidates(req.name) File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates for page in self._get_pages(url_locations, project_name): File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages page = self._get_page(location) File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page return HTMLPage.get_page(link, session=self.session) File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page "Cache-Control": "max-age=600", File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 492, in get return self.request('GET', url, **kwargs) File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request return super(PipSession, self).request(method, url, *args, **kwargs) File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in request resp = self.send(prep, **send_kwargs) File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 588, in send r = adapter.send(request, **kwargs) File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send resp = super(CacheControlAdapter, self).send(request, **kw) File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send timeout=timeout File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 238, in increment total -= 1 TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' You are using pip version 8.1.1, however version 22.2.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. I tried removing pip and reinstalling it again. still facing same issue. -- https://mail.python.org/mailman/listinfo/python-list
Re: setup.py + cython == chicken and the egg problem
Am 16.08.22 um 23:03 schrieb Dan Stromberg: I'm attempting to package up a python package that uses Cython. Rather than build binaries for everything under the sun, I've been focusing on including the .pyx file and running cython on it at install time. This requires a C compiler, but I'm OK with that. However, when I try to install the package from test.pypi.org, I get: $ python3 -m pip install -i https://test.pypi.org/simple/ pyx-treap below cmd output started 2022 Tue Aug 16 01:55:16 PM PDT Looking in indexes: https://test.pypi.org/simple/ Collecting pyx-treap Downloading https://test-files.pythonhosted.org/packages/3a/41/af5360934adccfc086a39e1f720323895144b53454ff6dacc0f06267db55/pyx_treap-2.0.15.tar.gz (125 kB) 125.9/125.9 kB 1.9 MB/s eta 0:00:00 Installing build dependencies ... error error: subprocess-exited-with-error ×? pip subprocess to install build dependencies did not run successfully. ?? exit code: 1 > [3 lines of output] Looking in indexes: https://test.pypi.org/simple/ ERROR: Could not find a version that satisfies the requirement setuptools (from versions: none) ERROR: No matching distribution found for setuptools [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error I looked at your code and I think you are trying too hard. As far as I understand, you need Cython to be installed before the build process begins. Your entry in pyproject.toml should take care of that. But you also have these lines in your setup.py subprocess.check_call('%s -m pip install cython' % (sys.executable, ), shell=True) subprocess.check_call('%s -m cython pyx_treap.pyx' % (sys.executable, ), shell=True) The first one calls out to pip while pip is already running, I'm not sure that this will work, but judging from the error message it is looking for the requirements also from test.pypi. Maybe this is the reason that it fails (the error message says that it can't find setuptools). So jut delete this line and it might already work The second line, which compiles the Cython code, also runs *at every invocation of setup.py*, even if you'd do just python3 setup.py --help It may still work, but the correct way to do it is to create a build extension for setuptools. In my project you can see this here: https://github.com/j-from-b/CDEF/blob/main/setup.py#L88 OTOH, I would be surprised if Cython did not have this already, indeed you imported cythonize from Cython.Build. So maybe just deleting these two lines and it might work? Christian -- https://mail.python.org/mailman/listinfo/python-list
not able to use python
Sent from [1]Mail for Windows References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 -- https://mail.python.org/mailman/listinfo/python-list