Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Thomas Passin via Python-list
On 5/29/2024 10:59 AM, MRAB via Python-list wrote: On 2024-05-29 15:32, Thomas Passin via Python-list wrote: On 5/29/2024 8:55 AM, Kevin M. Wilson wrote: Please recall, I said the format for the email failed to retain the proper indents. I'll attach a picture of the code! Purpose; to

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Grant Edwards via Python-list
On 2024-05-29, Mats Wichmann via Python-list wrote: > On 5/29/24 08:02, Grant Edwards via Python-list wrote: >> On 2024-05-29, Chris Angelico via Python-list wrote: >> >>> print(f"if block {name[index]=} {index=}") >> >> Holy cow! How did I not know about the f-string {=} thing? > > It's more

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread MRAB via Python-list
On 2024-05-29 15:32, Thomas Passin via Python-list wrote: On 5/29/2024 8:55 AM, Kevin M. Wilson wrote: Please recall, I said the format for the email failed to retain the proper indents. I'll attach a picture of the code! Purpose; to uppercase every other letter in a string. Thanks all, KMW

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Barry Scott via Python-list
> On 29 May 2024, at 05:38, Kevin M. Wilson via Python-list > wrote: > > The format in this email is not of my making, should someone know, how to do > this so that it's a readable script do tell! > KMW Your mail program may have a plain-text mode to compose messages in try using that.

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Thomas Passin via Python-list
On 5/29/2024 8:55 AM, Kevin M. Wilson wrote: Please recall, I said the format for the email failed to retain the proper indents. I'll attach a picture of the code! Purpose; to uppercase every other letter in a string. Thanks all, KMW Simpler is good, and readability is good. For a simple

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Mats Wichmann via Python-list
On 5/29/24 08:02, Grant Edwards via Python-list wrote: On 2024-05-29, Chris Angelico via Python-list wrote: print(f"if block {name[index]=} {index=}") Holy cow! How did I not know about the f-string {=} thing? It's more recent than f-strings in general, so it's not that hard to miss. --

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Grant Edwards via Python-list
On 2024-05-29, Chris Angelico via Python-list wrote: > print(f"if block {name[index]=} {index=}") Holy cow! How did I not know about the f-string {=} thing? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Formatted Output and Argument Parsing (was: Re: Flubbed it in the second interation through the string: range error... HOW?)

2024-05-29 Thread Chris Angelico via Python-list
On Wed, 29 May 2024 at 23:06, Dan Sommers via Python-list wrote: > (For the history-impaired, getopt existed long before Python and will > likely exist long after it, but getopt's "replacement" optparse lasted > only from 2003 until 2011.) Depends on your definition of "lasted". It's not getting

Formatted Output and Argument Parsing (was: Re: Flubbed it in the second interation through the string: range error... HOW?)

2024-05-29 Thread Dan Sommers via Python-list
On 2024-05-29 at 17:14:51 +1000, Chris Angelico via Python-list wrote: > I wouldn't replace str.format() everywhere, nor would I replace > percent encoding everywhere - but in this case, I think Thomas is > correct. Not because it's 2024 (f-strings were brought in back in > 2015, so they're

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Thomas Passin via Python-list
On 5/29/2024 3:14 AM, Chris Angelico via Python-list wrote: On Wed, 29 May 2024 at 16:03, Cameron Simpson via Python-list wrote: By which Thomas means stuff like this: print(f'if block {name[index]} and index {index}') Notice the leading "f'". Personally I wouldn't even go that far,

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread MRAB via Python-list
}, letter is {}'.format(index, name))            # print('letter to lower = {}'.format(name[index]))            # print('Already lowercase do noting: name = {}'.format(name[index]))        index += 1        # index = name.upper()     return name myfunc('capitalism') Erro

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Chris Angelico via Python-list
On Wed, 29 May 2024 at 16:03, Cameron Simpson via Python-list wrote: > By which Thomas means stuff like this: > > print(f'if block {name[index]} and index {index}') > > Notice the leading "f'". Personally I wouldn't even go that far, just: > > print('if block', name[index], 'and index',

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Cameron Simpson via Python-list
On 29May2024 01:14, Thomas Passin wrote: Also, it's 2024 ... time to start using f-strings (because they are more readable than str.format()) By which Thomas means stuff like this: print(f'if block {name[index]} and index {index}') Notice the leading "f'". Personally I wouldn't even go

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-28 Thread Thomas Passin via Python-list
se do noting: name = {}'.format(name[index]))        index += 1        # index = name.upper()     return name myfunc('capitalism') Error message:                        Not making sense, index is 1, letter s/b 'a'letter to upper = c, index 0! if block C and index 0 1 Start: elseif block, inde

Fw: Flubbed it in the second interation through the string: range error... HOW?

2024-05-28 Thread Kevin M. Wilson via Python-list
: Flubbed it in the second interation through the string: range error... HOW? The following is my effort to understand how to process a string, letter, by letter: def myfunc(name):        index = 0    howmax = len(name)    # while (index <= howmax):    while (index < howmax):        if (index % 2 == 0): 

Flubbed it in the second interation through the string: range error... HOW?

2024-05-28 Thread Kevin M. Wilson via Python-list
to lower = {}'.format(name[index]))            # print('Already lowercase do noting: name = {}'.format(name[index]))        index += 1        # index = name.upper()             return name         myfunc('capitalism') Error message:                        Not making sense, index is 1, l

Can't trap paramiko runtime trace-back error

2024-05-22 Thread Vinode Singh Ujlain via Python-list
When running the code below , I get error as enumerated below. Why am I not able to trap this paramiko runtime traceback in try-except block ? Exception (client): Error reading SSH protocol banner Traceback (most recent call last):   File "/home/uzi/.local/lib/python3.8/site-packages/par

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-04-04 Thread Jacob Kruger via Python-list
I think I have seen this error being discussed before… A web search for pyinstaller and that error leads to people discussing why it happens it looks like. Barry -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-04-03 Thread Jacob Kruger via Python-list
ce is versatile..." On 2024/03/31 14:51, Barry wrote: On 31 Mar 2024, at 13:24, Jacob Kruger via Python-list wrote: pkg_resources.DistributionNotFound: The 'altgraph' distribution was not found and is required by the application I think I have seen this error being discussed b

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-04-02 Thread Barry via Python-list
ote: >>> >>> pkg_resources.DistributionNotFound: The 'altgraph' distribution was not >>> found and is required by the application >> I think I have seen this error being discussed before… >> >> A web search for pyinstaller and that error leads to people discussing why >> it happens it looks like. >> >> Barry >> >> > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-04-01 Thread Jacob Kruger via Python-list
'altgraph' distribution was not found and is required by the application I think I have seen this error being discussed before… A web search for pyinstaller and that error leads to people discussing why it happens it looks like. Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-03-31 Thread Barry via Python-list
> On 31 Mar 2024, at 13:24, Jacob Kruger via Python-list > wrote: > > pkg_resources.DistributionNotFound: The 'altgraph' distribution was not found > and is required by the application I think I have seen this error being discussed before… A web search for pyinstaller and t

Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-03-31 Thread Jacob Kruger via Python-list
This started happening this past week, and, while it's worked fine in the past, the moment I try to launch the pyinstaller process at all, to generate compiled output, or even if just launch it with no command line options, I receive the following error message

Re: Error in Module

2024-03-11 Thread Sanskar Mukeshbhai Joshi via Python-list
Thank you for the information. On Mon, Mar 11, 2024, 22:36 wrote: > Sanskar Mukeshbhai Joshi wrote at 2024-3-10 18:08 +: > >I had made my project in BCA in Python. When I had complete my project > and run the program, at that time I got the error in runnig my project.

Re: Error in Module

2024-03-11 Thread Dieter Maurer via Python-list
Sanskar Mukeshbhai Joshi wrote at 2024-3-10 18:08 +: >I had made my project in BCA in Python. When I had complete my project and run >the program, at that time I got the error in runnig my project. The error was >ModuleNotFoundError: No module named 'flask'. `flask` is

Re: Error in Module

2024-03-11 Thread Alan Gauld via Python-list
On 10/03/2024 18:08, Sanskar Mukeshbhai Joshi via Python-list wrote: > I had made my project in BCA in Python. When I had complete my > project and run the program, at that time I got the error in > runnig my project. The error was ModuleNotFoundError: No module named 'flask'. Flask i

Error in Module

2024-03-11 Thread Sanskar Mukeshbhai Joshi via Python-list
Respected Sir/Ma'am I had made my project in BCA in Python. When I had complete my project and run the program, at that time I got the error in runnig my project. The error was ModuleNotFoundError: No module named 'flask'. I request you to check this problem and resolve it or guide me to solve

Matplotlib warning [error?] message

2024-02-19 Thread Leif Svalgaard via Python-list
now I get: File e:\getmodpot.py:40 fig,ax = initPlot() File E:\mystuff.py:272 in initPlot fig,ax = plt.subplots(figsize=(xs,ys)) File ~\anaconda3\Lib\site-packages\matplotlib\pyplot.py:1501 in subplots fig = figure(**fig_kw) File

Re: Matplotlib warning [error?] message

2024-02-19 Thread Zahraa Fadhil via Python-list
On Sunday, February 18, 2024 at 10:48:29 PM UTC+3, Leif Svalgaard wrote: > The latest[?] version of Matplotlib cannot show a figure. I get the > annoying error message: "Matplotlib is currently using agg, which is a > non-GUI backend, so cannot show the figure" > I'm us

Matplotlib warning [error?] message

2024-02-18 Thread Leif Svalgaard via Python-list
The latest[?] version of Matplotlib cannot show a figure. I get the annoying error message: "Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure" I'm using Spyder python 3.11 on Windows 11. What to do? -- Leif Svalgaard l...@leif.org

Re: Error pd.set_option('display.width', 10000)

2024-02-03 Thread MRAB via Python-list
On 2024-02-03 23:02, gelukt gelukt via Python-list wrote: Dear, While running a code, I get the error below: What does this error mean? How can I fix this error? C:\Users\brech\Desktop\Crypto\venv\Scripts\python.exe "C:/Users/brech/Desktop/Crypto/Project/aaa Arbitrage.py" Trace

Error pd.set_option('display.width', 10000)

2024-02-03 Thread gelukt gelukt via Python-list
Dear, While running a code, I get the error below: What does this error mean? How can I fix this error? C:\Users\brech\Desktop\Crypto\venv\Scripts\python.exe "C:/Users/brech/Desktop/Crypto/Project/aaa Arbitrage.py" Traceback (most recent call last): File "C:\Users\brech\Desktop

Re: PyInstaller value error: Invalid Windows resource specifier

2023-10-30 Thread MRAB via Python-list
On 2023-10-30 19:19, McDermott Family via Python-list wrote: Hello, I am trying to create a one file executable with pyinstaller 6.1.0 and auto-py-to-exe 2.41.0 using Python version 3.10.9 in a virtual environment. Some points before the output of pinstaller is shown. My resource .py file is

Re: error of opening Python

2023-09-29 Thread anthony.flury via Python-list
This isn't an error. This is just a normal Python Header message announcing that you are using Python 3.11.3 The rest is just information from the build system : The build Id, the date/time the build was made, and the version of the compiler. There is nothing to fix. -- Original

Re: error of opening Python

2023-09-27 Thread Greg Ewing via Python-list
On 27/09/23 3:30 pm, Chris Roy-Smith wrote: surely running a 64 bit version of python in a 23mbit version of windows will cause significant problems! 23 millibits? I don't think you'd be able to run much at all with that few bits! :-) -- Greg --

Re: error of opening Python

2023-09-26 Thread MRAB via Python-list
On 2023-09-27 03:30, Chris Roy-Smith via Python-list wrote: On 26/9/23 22:27, Abdelkhelk ashref salay eabakh via Python-list wrote: Dear Python team, This is my not first time using Python, I tried to launch Python and it showed I'm no expert but "Python 3.11.3 (tags/v3.11.3:f3909b8,

Re: error of opening Python

2023-09-26 Thread Chris Roy-Smith via Python-list
On 26/9/23 22:27, Abdelkhelk ashref salay eabakh via Python-list wrote: Dear Python team, This is my not first time using Python, I tried to launch Python and it showed I'm no expert but "Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win

Re: error of opening Python

2023-09-26 Thread Michael F. Stemper via Python-list
copyright", "credits" or "license" for more information." I don't know what this meant and how to fix this. Could you please help me? What error did you encounter? Aside from the lack of line breaks, it looks quite similar to what I get when I start up python: Python

error of opening Python

2023-09-26 Thread Abdelkhelk ashref salay eabakh via Python-list
Dear Python team, This is my not first time using Python, I tried to launch Python and it showed "Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information." I don't know what this meant

Re: f-string error message

2023-08-30 Thread Random832 via Python-list
On Sun, Aug 27, 2023, at 17:19, Rob Cliffe via Python-list wrote: > I understand that this is an error: I'm telling the f-string to expect > an integer when in fact I'm giving it a Decimal. > And indeed f"{x:3}" gives ' 42' whether x is an int or a Decimal. &g

f-string error message

2023-08-30 Thread Rob Cliffe via Python-list
I am currently using Python 3.11.4. First I want to say: f-strings are great!  I use them all the time, mostly but by no means exclusively for debug messages.  And in 3.12 they will get even better. And the improved error messages in Python (since 3.9) are great too!  Keep up the good work

Re: Where is the error?

2023-08-07 Thread Michael Agbenike via Python-list
When i try to open a python script it either says theres no ctk module or no pip On Sun, Aug 6, 2023, 3:51 PM Peter J. Holzer via Python-list < python-list@python.org> wrote: > Mostly, error messages got a lot better in Python 3.10, but this one had > me scratching my head for a

Re: Where is the error?

2023-08-07 Thread Cameron Simpson via Python-list
On 07Aug2023 08:02, Barry wrote: On 7 Aug 2023, at 05:28, Cameron Simpson via Python-list wrote: Used to use a Pascal compiler once which was uncannily good at suggesting where you'd missing a semicolon. Was that on DEC VMS? It was a goal at DEC for its compilers to do this well. No, a

Re: Where is the error?

2023-08-07 Thread Barry via Python-list
> On 7 Aug 2023, at 05:28, Cameron Simpson via Python-list > wrote: > > Used to use a Pascal compiler once which was uncannily good at suggesting > where you'd missing a semicolon. Was that on DEC VMS? It was a goal at DEC for its compilers to do this well. They could output the errors in

Re: Where is the error?

2023-08-06 Thread Cameron Simpson via Python-list
On 06Aug2023 22:41, Peter J. Holzer wrote: Mostly, error messages got a lot better in Python 3.10, but this one had me scratching my head for a few minutes. Consider this useless and faulty script: r = { "x&quo

Re: Where is the error?

2023-08-06 Thread dn via Python-list
On 07/08/2023 08.41, Peter J. Holzer via Python-list wrote: Mostly, error messages got a lot better in Python 3.10, but this one had me scratching my head for a few minutes. ... The error message is now a lot better, of course, but the fact that it points at the expression *before* the error

Where is the error?

2023-08-06 Thread Peter J. Holzer via Python-list
Mostly, error messages got a lot better in Python 3.10, but this one had me scratching my head for a few minutes. Consider this useless and faulty script: r = { "x": (1 + 2 + 3) "y": (4 + 5 + 6)

Re: Module error

2023-05-27 Thread Thomas Passin
On 5/26/2023 8:30 PM, giuseppacef...@gmail.com wrote: I have reinstalled python which reinstalls pip. I have added the path:'C:\sers\Giuseppa\AppData\Local\Packages\PythonSoftwareFoundation.Pytho n.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts and still get the error below

Re: Module error

2023-05-26 Thread MRAB
On 2023-05-27 01:30, giuseppacef...@gmail.com wrote: I have reinstalled python which reinstalls pip. I have added the path:'C:\sers\Giuseppa\AppData\Local\Packages\PythonSoftwareFoundation.Pytho n.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts and still get the error below

FW: Module error

2023-05-26 Thread giuseppacefalu
: giuseppacef...@gmail.com Sent: Friday, May 26, 2023 8:31 PM To: python-list@python.org Subject: Module error I have reinstalled python which reinstalls pip. I have added the path:'C:\sers\Giuseppa\AppData\Local\Packages\PythonSoftwareFoundation.Pytho n.3.11_qbz5n2kfra8p0\LocalCache\local-packages

FW: Module error

2023-05-26 Thread giuseppacefalu
Dir(s) 378,485,805,056 bytes free From: giuseppacef...@gmail.com Sent: Friday, May 26, 2023 8:31 PM To: python-list@python.org Subject: Module error I have reinstalled python which reinstalls pip. I have added the path:'C:\sers\Giuseppa\AppData\Local\Packages\PythonSoftwareFoundation.Pytho

Module error

2023-05-26 Thread giuseppacefalu
I have reinstalled python which reinstalls pip. I have added the path:'C:\sers\Giuseppa\AppData\Local\Packages\PythonSoftwareFoundation.Pytho n.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts and still get the error below. Could you help me with this please? Traceback (most

Re: Error installing packages or upgrading pip

2023-05-20 Thread Mats Wichmann
lly quick try shows several hits, including some StackOverflow articles. There's no way for us to judge if any of those scenarios actually would apply to your case, so suggesting you take a look first. the error I get when I try to upgrade or install a package for example pip install requests I

Error installing packages or upgrading pip

2023-05-18 Thread Test Only
Hi there, I hope you are in a great health I am having a problem with python even though I uninstall and reinstall it again multiple times the error I get when I try to upgrade or install a package for example pip install requests I get this error which I could not find a solution for pip

Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry
= PyUnicode_AsEncodedString(str_value, "utf-8", "Error ~"); const char *strErrValue = PyBytes_AS_STRING(pyExcValueStr); //where   strErrValue   = "ImportError('Error: Reinit is forbidden')" ... } What we imported is a Python file which import some pyd librari

Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Jason Qian via Python-list
Hi Barry, void handleError(const char* msg) { ... PyErr_Fetch(, , ); PyErr_NormalizeException(, , ); PyObject* str_value = PyObject_Repr(pyExcValue); PyObject* pyExcValueStr = PyUnicode_AsEncodedString(str_value, "utf-8", "Error ~"); const char **strErrValue* = PyBytes_AS_

Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry
> On 17 May 2023, at 20:35, Jason Qian via Python-list > wrote: > >  Hi, > > I Need some of your help. > > I have the following C code to import *Import python.* It works 99% of > the time, but sometimes receives "*ImportError('Error: Reinit is &g

Help on ImportError('Error: Reinit is forbidden')

2023-05-17 Thread Jason Qian via Python-list
Hi, I Need some of your help. I have the following C code to import *Import python.* It works 99% of the time, but sometimes receives "*ImportError('Error: Reinit is forbidden')*". error. **We run multiple instances of the app parallelly. *** Python version(3.7.0 (v3.7.0:

Re: Pip Error

2023-05-17 Thread Thomas Passin
On 5/17/2023 10:54 AM, Aysu Mammadli wrote: I encountered an error while attempting to install pip using the terminal. The exact error message I received is: "An error occurred during configuration: option use-feature: invalid choice: '2020-resolver' (choose from 'fast-deps', 'trust

Re: Pip Error

2023-05-17 Thread Barry
> On 17 May 2023, at 17:26, Aysu Mammadli wrote: > > I encountered an error while attempting to install pip using the terminal. > The exact error message I received is: > > "An error occurred during configuration: option use-feature: invalid > choice: '2020-resolve

Pip Error

2023-05-17 Thread Aysu Mammadli
I encountered an error while attempting to install pip using the terminal. The exact error message I received is: "An error occurred during configuration: option use-feature: invalid choice: '2020-resolver' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')&q

Re: Python-pickle error

2023-05-09 Thread Tony Flury via Python-list
open('file.pkl', 'rb') as file: number=pickle.load(file) my_unpickeled_object=pickle.loads(my_pickeld_object) print("this is my unpickeled object",{my_unpickeled_object},) but now i get error Traceback (most recent call last): File "C:\Users\lukwi\Desktop\python\tester2.py", li

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Phu Sam
3 at 04:55:41 PM, Chris Green wrote: > > > > > I'm sure I'm missing something obvious here but I can't see an > elegant > > > > > way to do this. I want to create a directory, but if it exists > it's > > > > > not an error and the code sh

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Angelico
be I only say this because it has happened to me too many times but > before ignoring the error in the 'except' branch, I would make sure that > if the name exists it is a folder and not a file. > That's a fair consideration, although the other way to handle that is to allow other operation

Re: How to 'ignore' an error in Python?

2023-04-29 Thread jak
Stefan Ram ha scritto: jak writes: Maybe I only say this because it has happened to me too many times but before ignoring the error in the 'except' branch, I would make sure that if the name exists it is a folder and not a file. If the name exists and it is a file's name

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Angelico
t I can't see an elegant > > > > way to do this. I want to create a directory, but if it exists it's > > > > not an error and the code should just continue. > > > > > > > > So, I have:- > > > > > > > > for dirnam

Re: How to 'ignore' an error in Python?

2023-04-29 Thread jak
Chris Angelico ha scritto: Using mkdirs when you only want to make one is inviting problems of being subtly wrong, where it creates too many levels of directory. Personally, I would just do: Maybe I only say this because it has happened to me too many times but before ignoring the error

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Green
Kushal Kumaran wrote: > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > I'm sure I'm missing something obvious here but I can't see an elegant > > way to do this. I want to create a directory, but if it exists it's > > not an error and the code should just co

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Green
directory, but if it exists it's > > > not an error and the code should just continue. > > > > > > So, I have:- > > > > > > for dirname in listofdirs: > > > try: > > > os.mkdir(dirname) > > >

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Greg Ewing via Python-list
On 30/04/23 2:43 am, jak wrote: Maybe I expressed myself badly but I didn't mean to propose alternatives to the EAFP way but just to evaluate the possibility that it is not a folder. If it's not a folder, you'll find out when the next thing you try to do to it fails. You could check for it

RE: How to 'ignore' an error in Python?

2023-04-29 Thread avi.e.gross
require a loss of simplicity. -Original Message- From: Python-list On Behalf Of Kushal Kumaran Sent: Saturday, April 29, 2023 12:19 AM To: python-list@python.org Subject: Re: How to 'ignore' an error in Python? On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > I'm sure

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Chris Angelico
On Sat, 29 Apr 2023 at 14:27, Kushal Kumaran wrote: > > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > I'm sure I'm missing something obvious here but I can't see an elegant > > way to do this. I want to create a directory, but if it exists it's > > not an e

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Kushal Kumaran
On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > I'm sure I'm missing something obvious here but I can't see an elegant > way to do this. I want to create a directory, but if it exists it's > not an error and the code should just continue. > > So, I have:- >

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Cameron Simpson
On 28Apr2023 10:39, Mats Wichmann wrote: For this specific case, you can use os.makedirs: os.makedirs(dirname, exist_ok=True) I'm not a great fan of makedirs because it will make all the missing components, not just the final one. So as an example, if you've got a NAS mounted backup area at

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Cameron Simpson
On 28Apr2023 16:55, Chris Green wrote: for dirname in listofdirs: try: os.mkdir(dirname) except FileExistsError: # so what can I do here that says 'carry on regardless' except: # handle any other error, which is really an error

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Mats Wichmann
On 4/28/23 11:05, MRAB wrote: On 2023-04-28 16:55, Chris Green wrote: I'm sure I'm missing something obvious here but I can't see an elegant way to do this.  I want to create a directory, but if it exists it's not an error and the code should just continue. So, I have:- for dirname

Re: How to 'ignore' an error in Python?

2023-04-28 Thread MRAB
On 2023-04-28 16:55, Chris Green wrote: I'm sure I'm missing something obvious here but I can't see an elegant way to do this. I want to create a directory, but if it exists it's not an error and the code should just continue. So, I have:- for dirname in listofdirs: try

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Mats Wichmann
On 4/28/23 09:55, Chris Green wrote: I'm sure I'm missing something obvious here but I can't see an elegant way to do this. I want to create a directory, but if it exists it's not an error and the code should just continue. So, I have:- for dirname in listofdirs: try

How to 'ignore' an error in Python?

2023-04-28 Thread Chris Green
I'm sure I'm missing something obvious here but I can't see an elegant way to do this. I want to create a directory, but if it exists it's not an error and the code should just continue. So, I have:- for dirname in listofdirs: try: os.mkdir(dirname) except

Re: Python-pickle error

2023-04-19 Thread Thomas Passin
') as file: number=pickle.load(file) my_unpickeled_object=pickle.loads(my_pickeld_object) print("this is my unpickeled object",{my_unpickeled_object},) but now i get error Traceback (most recent call last): File "C:\Users\lukwi\Desktop\python\tester2.py", line 5, in

Python-pickle error

2023-04-19 Thread charles wiewiora
.load(file) my_unpickeled_object=pickle.loads(my_pickeld_object) print("this is my unpickeled object",{my_unpickeled_object},) but now i get error Traceback (most recent call last): File "C:\Users\lukwi\Desktop\python\tester2.py", line 5, in with open('file.pkl', 'rb') as file: FileNotFoun

pip upgrade error

2023-04-17 Thread 羅 中勇
When I using pip list, it tells me there is a new release of pip is available, but I got these error messages when I upgrading pip. I don’t know what happened it is. PS C:\Users\USER> pip --version pip pip 23.0.1 from C:\Users\USER\AppData\Roaming\Python\Python310\site-packages\pip (pyt

Re: Python 2.7 range Function provokes a Memory Error

2023-03-06 Thread Chris Angelico
On Tue, 7 Mar 2023 at 16:53, Stephen Tucker wrote: > > Hi again, > > I tried xrange, but I got an error telling me that my integer was too big > for a C long. > > Clearly, xrange in Py2 is not capable of dealing with Python (that is, > possibly very long) integers. Th

Re: Python 2.7 range Function provokes a Memory Error

2023-03-06 Thread Stephen Tucker
Hi again, I tried xrange, but I got an error telling me that my integer was too big for a C long. Clearly, xrange in Py2 is not capable of dealing with Python (that is, possibly very long) integers. I am raising this because, (a) IF xrange in Py3 is a simple "port" from Py2, the

Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread Jon Ribbens via Python-list
On 2023-03-02, Stephen Tucker wrote: > The range function in Python 2.7 (and yes, I know that it is now > superseded), provokes a Memory Error when asked to deiliver a very long > list of values. > > I assume that this is because the function produces a list which it then >

Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread Chris Angelico
On Thu, 2 Mar 2023 at 22:27, Stephen Tucker wrote: > > Hi, > > The range function in Python 2.7 (and yes, I know that it is now > superseded), provokes a Memory Error when asked to deiliver a very long > list of values. > > I assume that this is because the functi

Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread 2QdxY4RzWzUUiLuE
On 2023-03-02 at 11:25:49 +, Stephen Tucker wrote: > The range function in Python 2.7 (and yes, I know that it is now > superseded), provokes a Memory Error when asked to deiliver a very long > list of values. > > I assume that this is because the function produc

Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread Stephen Tucker
Hi, The range function in Python 2.7 (and yes, I know that it is now superseded), provokes a Memory Error when asked to deiliver a very long list of values. I assume that this is because the function produces a list which it then iterates through. 1. Does the range function in Python 3.x

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Weatherby,Gerard
of Peter J. Holzer Date: Saturday, February 25, 2023 at 5:21 PM To: python-list@python.org Subject: Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ? On 2023-02-25 21:58:18 +, Weatherby,Gerard wrote: > I only use asserts for things I know to be true. Yeah, tha

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Peter J. Holzer
On 2023-02-25 21:58:18 +, Weatherby,Gerard wrote: > I only use asserts for things I know to be true. Yeah, that's what assers are for. Or rather for things that you *think* are true. > In other words, a failing assert means I have a hole in my program > logic. Yes, if you include your

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Weatherby,Gerard
, February 25, 2023 at 9:22 AM To: python-list@python.org Subject: Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ? On 2023-02-25 09:10:06 -0500, Thomas Passin wrote: > On 2/25/2023 1:13 AM, Peter J. Holzer wrote: > > On 2023-02-24 18:19:52 -0500, Thomas Pas

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Peter J. Holzer
On 2023-02-25 09:10:06 -0500, Thomas Passin wrote: > On 2/25/2023 1:13 AM, Peter J. Holzer wrote: > > On 2023-02-24 18:19:52 -0500, Thomas Passin wrote: > > > Sometimes you can use a second parameter to assert if you know what kind > > > of > > > error to

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Thomas Passin
appropriate. Curiously, this does not even occur during an assert exception - despite the value/relationship being the whole point of using the command! x = 1 assert x == 2 AssertionError (and that's it) Sometimes you can use a second parameter to assert if you know what kind of error

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
t x == 2 > > > > > > > > AssertionError (and that's it) > > Sometimes you can use a second parameter to assert if you know what kind of > error to expect: > > >>> a = [1,2,3] > >>> b = [4,5] > >>> assert len(a) == len(b), f'len

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Thomas Passin
/relationship being the whole point of using the command! x = 1 assert x == 2 AssertionError (and that's it) Sometimes you can use a second parameter to assert if you know what kind of error to expect: >>> a = [1,2,3] >>> b = [4,5] >>> assert len(a) == len(b)

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
On 2023-02-25 08:47:00 +1300, dn via Python-list wrote: > That said, have observed coders 'graduating' from other languages, making > wider use of assert - assumed to be more data (value) sanity-checks than > typing, but ... > > Do you use assert frequently? Not very often, but I do use it.

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread dn via Python-list
plaining that Python does not work the way it 'should'. In turn, gives rise to the impression that expounding the advantages of TDD, and thus anticipating such unit and integration error-possibilities, might be considered an insult or unhelpful. (sigh!) Personally, I struggled a bit to adapt from

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: > In some ways, providing this information seems appropriate. Curiously, this > does not even occur during an assert exception - despite the > value/relationship being the whole point of using the command! > > x = 1 > assert x == 2 >

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
On 2023-02-23 20:32:26 -0700, Michael Torrie wrote: > On 2/23/23 01:08, Hen Hanna wrote: > > Python VM is seeing an "int" object (123) (and telling me that) > > ... so it should be easy to print that "int" object What does > > Python VMknow ? and when does it know it ? > It knows

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
r: can only concatenate str (not "int") to str > > > > > > Why doesn't Python (error msg) do the obvious thing and tell me > > WHAT the actual (offending, arg) values are ? > > > > In many cases, it'd help to know what string the var A had , when t

  1   2   3   4   5   6   7   8   9   10   >