Re: Python Error
Thanks. I updated the path and was able to launch python.exe for v3.8. I got rid of the other errors but now facing an error with 'pandas' although it is installed ok and the path correctly updated. C:\Users\mchak>pythonPython 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import pandas as pdTraceback (most recent call last): File "", line 1, in File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\__init__.py", line 22, in from pandas.compat.numpy import (ModuleNotFoundError: No module named 'pandas.compat.numpy'>>> - Mayukh On Tuesday, November 24, 2020, 09:27:00 PM GMT, Barry wrote: Two observations. Python.exe is not on your PATH. But that does not matter as you can use the py command instead And nymph may not be available for python 3.9 yet. Check on pypi to see if there is a build for 3.9. Maybe use 3.8 for the time being. Barry > On 24 Nov 2020, at 11:18, Mayukh Chakraborty via Python-list > wrote: > > Thanks - I am able to launch 'py' from the command prompt and it gives me > the python versions installed in my machine from python.org website. > However, when I am trying to execute a python program from command prompt, I > am getting the error below. I had reinstalled python packages (numpy, pandas) > but it didn't resolve the issue. Any help would be appreciated. > Original error was: No module named 'numpy.core._multiarray_umath' > > --- > C:\Users\mchak\Documents\Python>py ES.pyTraceback (most recent call last): > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 22, in from . import multiarray File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\multiarray.py", > line 12, in from . import overrides File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\overrides.py", > line 7, in from numpy.core._multiarray_umath import > (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' > During handling of the above exception, another exception occurred: > Traceback (most recent call last): File > "C:\Users\mchak\Documents\Python\ES.py", line 1, in import scipy > as sp File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scipy\__init__.py", > line 61, in from numpy import show_config as show_numpy_config > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\__init__.py", > line 140, in from . import core File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 48, in raise ImportError(msg)ImportError: > IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! > Importing the numpy C-extensions failed. This error can happen formany > reasons, often due to issues with your setup or how NumPy wasinstalled. > We have compiled some common reasons and troubleshooting tips at: > https://numpy.org/devdocs/user/troubleshooting-importerror.html > Please note and check the following: > * The Python version is: Python3.9 from >"C:\Users\mchak\AppData\Local\Programs\Python\Python39\python.exe" * The >NumPy version is: "1.19.4" > and make sure that they are the versions you expect.Please carefully study > the documentation linked above for further help. > Original error was: No module named 'numpy.core._multiarray_umath' > >> On Tuesday, November 24, 2020, 07:13:04 AM GMT, Gisle Vanem >> wrote: >> >> Barry Scott wrote: >> >> If you have python from python.org installed you should be able to list all >> the version you have installed >> with the command: >> >> py -0 > When was that '-0' feature added? > I have Python 3.6 from Python.org and here a > 'py.exe -0' gives: > Requested Python version (0) not installed > > But using 'py.exe -0' from Python 3.9 correctly > gives: > -3.6-32 * > -2.7-32 > > -- > --gv > -- > 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: Python Error
Two observations. Python.exe is not on your PATH. But that does not matter as you can use the py command instead And nymph may not be available for python 3.9 yet. Check on pypi to see if there is a build for 3.9. Maybe use 3.8 for the time being. Barry > On 24 Nov 2020, at 11:18, Mayukh Chakraborty via Python-list > wrote: > > Thanks - I am able to launch 'py' from the command prompt and it gives me > the python versions installed in my machine from python.org website. > However, when I am trying to execute a python program from command prompt, I > am getting the error below. I had reinstalled python packages (numpy, pandas) > but it didn't resolve the issue. Any help would be appreciated. > Original error was: No module named 'numpy.core._multiarray_umath' > > --- > C:\Users\mchak\Documents\Python>py ES.pyTraceback (most recent call last): > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 22, in from . import multiarray File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\multiarray.py", > line 12, in from . import overrides File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\overrides.py", > line 7, in from numpy.core._multiarray_umath import > (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' > During handling of the above exception, another exception occurred: > Traceback (most recent call last): File > "C:\Users\mchak\Documents\Python\ES.py", line 1, in import scipy > as sp File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scipy\__init__.py", > line 61, in from numpy import show_config as show_numpy_config > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\__init__.py", > line 140, in from . import core File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 48, in raise ImportError(msg)ImportError: > IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! > Importing the numpy C-extensions failed. This error can happen formany > reasons, often due to issues with your setup or how NumPy wasinstalled. > We have compiled some common reasons and troubleshooting tips at: > https://numpy.org/devdocs/user/troubleshooting-importerror.html > Please note and check the following: > * The Python version is: Python3.9 from > "C:\Users\mchak\AppData\Local\Programs\Python\Python39\python.exe" * The > NumPy version is: "1.19.4" > and make sure that they are the versions you expect.Please carefully study > the documentation linked above for further help. > Original error was: No module named 'numpy.core._multiarray_umath' > >>On Tuesday, November 24, 2020, 07:13:04 AM GMT, Gisle Vanem >> wrote: >> >> Barry Scott wrote: >> >> If you have python from python.org installed you should be able to list all >> the version you have installed >> with the command: >> >> py -0 > When was that '-0' feature added? > I have Python 3.6 from Python.org and here a > 'py.exe -0' gives: > Requested Python version (0) not installed > > But using 'py.exe -0' from Python 3.9 correctly > gives: > -3.6-32 * > -2.7-32 > > -- > --gv > -- > 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: Python Error
Thanks - I am able to launch 'py' from the command prompt and it gives me the python versions installed in my machine from python.org website. However, when I am trying to execute a python program from command prompt, I am getting the error below. I had reinstalled python packages (numpy, pandas) but it didn't resolve the issue. Any help would be appreciated. Original error was: No module named 'numpy.core._multiarray_umath' --- C:\Users\mchak\Documents\Python>py ES.pyTraceback (most recent call last): File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", line 22, in from . import multiarray File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\multiarray.py", line 12, in from . import overrides File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\overrides.py", line 7, in from numpy.core._multiarray_umath import (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\mchak\Documents\Python\ES.py", line 1, in import scipy as sp File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scipy\__init__.py", line 61, in from numpy import show_config as show_numpy_config File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\__init__.py", line 140, in from . import core File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", line 48, in raise ImportError(msg)ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen formany reasons, often due to issues with your setup or how NumPy wasinstalled. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "C:\Users\mchak\AppData\Local\Programs\Python\Python39\python.exe" * The NumPy version is: "1.19.4" and make sure that they are the versions you expect.Please carefully study the documentation linked above for further help. Original error was: No module named 'numpy.core._multiarray_umath' On Tuesday, November 24, 2020, 07:13:04 AM GMT, Gisle Vanem wrote: Barry Scott wrote: > If you have python from python.org installed you should be able to list all > the version you have installed > with the command: > > py -0 When was that '-0' feature added? I have Python 3.6 from Python.org and here a 'py.exe -0' gives: Requested Python version (0) not installed But using 'py.exe -0' from Python 3.9 correctly gives: -3.6-32 * -2.7-32 -- --gv -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error
Barry Scott wrote: If you have python from python.org installed you should be able to list all the version you have installed with the command: py -0 When was that '-0' feature added? I have Python 3.6 from Python.org and here a 'py.exe -0' gives: Requested Python version (0) not installed But using 'py.exe -0' from Python 3.9 correctly gives: -3.6-32 * -2.7-32 -- --gv -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error
Hi, I have solved the issue by updating the Environment variables, now I am able to launch 'py' from the command prompt. However, I can't launch 'python' from command prompt. I am also encountering an issue when I try to execute the 'python' command from command prompt. I had reinstalled the python packages (numpy, pandas, scipy etc) but I can't find a solution for this error. --- C:\Users\mchak\Documents\Python>py ES.pyTraceback (most recent call last): File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", line 22, in from . import multiarray File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\multiarray.py", line 12, in from . import overrides File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\overrides.py", line 7, in from numpy.core._multiarray_umath import (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\mchak\Documents\Python\ES.py", line 1, in import scipy as sp File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scipy\__init__.py", line 61, in from numpy import show_config as show_numpy_config File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\__init__.py", line 140, in from . import core File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", line 48, in raise ImportError(msg)ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen formany reasons, often due to issues with your setup or how NumPy wasinstalled. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "C:\Users\mchak\AppData\Local\Programs\Python\Python39\python.exe" * The NumPy version is: "1.19.4" and make sure that they are the versions you expect.Please carefully study the documentation linked above for further help. Original error was: No module named 'numpy.core._multiarray_umath' Regards,MayukhOn Monday, November 23, 2020, 08:17:06 PM GMT, Mayukh Chakraborty via Python-list wrote: Hi Terry, 1. The command py doesn't work. It gives me the error below : C:\Users\mchak>pyFatal Python error: init_sys_streams: can't initialize sys standard streamsPython runtime state: core initializedAttributeError: module 'io' has no attribute 'open' Current thread 0x8290 (most recent call first): 2. If I use py -0, I get two installed versions. However, if I try to uninstall from Control Panel, I see only 3.9 version C:\Users\mchak>py -0Installed Pythons found by py Launcher for Windows -3.9-64 * -3.8-64 3. I tried to uninstall v3.9 and reinstall but it didn't solve the issue. Regards,Mayukh On Monday, November 23, 2020, 06:34:43 PM GMT, Terry Reedy wrote: On 11/23/2020 9:10 AM, Mayukh Chakraborty via Python-list wrote: > Hi, > I had uninstalled and installed Python in Windows 10 but I am getting the > error below. Can you please help ? > C:\Users\mchak>python Fatal Python error: init_sys_streams: can't initialize sys standard streams Python runtime state: core initialized AttributeError: module 'io' has no attribute 'OpenWrapper' Current thread 0x9d44 (most recent call first): It is true that io has no OpenWrapper class. The question is What is trying to use that? What installer are you using? I would (re)download the one from python.org. -- Terry Jan Reedy -- 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: Python Error
Hi Terry, 1. The command py doesn't work. It gives me the error below : C:\Users\mchak>pyFatal Python error: init_sys_streams: can't initialize sys standard streamsPython runtime state: core initializedAttributeError: module 'io' has no attribute 'open' Current thread 0x8290 (most recent call first): 2. If I use py -0, I get two installed versions. However, if I try to uninstall from Control Panel, I see only 3.9 version C:\Users\mchak>py -0Installed Pythons found by py Launcher for Windows -3.9-64 * -3.8-64 3. I tried to uninstall v3.9 and reinstall but it didn't solve the issue. Regards,MayukhOn Monday, November 23, 2020, 06:34:43 PM GMT, Terry Reedy wrote: On 11/23/2020 9:10 AM, Mayukh Chakraborty via Python-list wrote: > Hi, > I had uninstalled and installed Python in Windows 10 but I am getting the > error below. Can you please help ? > C:\Users\mchak>python Fatal Python error: init_sys_streams: can't initialize sys standard streams Python runtime state: core initialized AttributeError: module 'io' has no attribute 'OpenWrapper' Current thread 0x9d44 (most recent call first): It is true that io has no OpenWrapper class. The question is What is trying to use that? What installer are you using? I would (re)download the one from python.org. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error
1. The command 'py' doesn't work. It gives me the error below : C:\Users\mchak>pyFatal Python error: init_sys_streams: can't initialize sys standard streamsPython runtime state: core initializedAttributeError: module 'io' has no attribute 'open' Current thread 0x8290 (most recent call first): 2. If I use py -0, I get two installed versions. However, if I try to uninstall from Control Panel, I see only 3.9 version C:\Users\mchak>py -0Installed Pythons found by py Launcher for Windows -3.9-64 * -3.8-64 3. I tried to uninstall v3.9 and reinstall but it didn't solve the issue. Regards,Mayukh On Monday, November 23, 2020, 06:17:00 PM GMT, Barry Scott wrote: > On 23 Nov 2020, at 14:10, Mayukh Chakraborty via Python-list > wrote: > > Hi, > I had uninstalled and installed Python in Windows 10 but I am getting the > error below. Can you please help ? > C:\Users\mchak>pythonFatal Python error: init_sys_streams: can't initialize > sys standard streamsPython runtime state: core initializedAttributeError: > module 'io' has no attribute 'OpenWrapper' > Current thread 0x9d44 (most recent call first): > Regards,Mayukh Which version of python are you installing and where did you download it from? Do you have more than one version of python installed? Does the command: py work? If you have python from python.org installed you should be able to list all the version you have installed with the command: py -0 That is zero not oh. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On 11/23/2020 9:10 AM, Mayukh Chakraborty via Python-list wrote: Hi, I had uninstalled and installed Python in Windows 10 but I am getting the error below. Can you please help ? C:\Users\mchak>python Fatal Python error: init_sys_streams: can't initialize sys standard streams Python runtime state: core initialized AttributeError: module 'io' has no attribute 'OpenWrapper' Current thread 0x9d44 (most recent call first): It is true that io has no OpenWrapper class. The question is What is trying to use that? What installer are you using? I would (re)download the one from python.org. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error
> On 23 Nov 2020, at 14:10, Mayukh Chakraborty via Python-list > wrote: > > Hi, > I had uninstalled and installed Python in Windows 10 but I am getting the > error below. Can you please help ? > C:\Users\mchak>pythonFatal Python error: init_sys_streams: can't initialize > sys standard streamsPython runtime state: core initializedAttributeError: > module 'io' has no attribute 'OpenWrapper' > Current thread 0x9d44 (most recent call first): > Regards,Mayukh Which version of python are you installing and where did you download it from? Do you have more than one version of python installed? Does the command: py work? If you have python from python.org installed you should be able to list all the version you have installed with the command: py -0 That is zero not oh. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Python error
On 2020-04-02 19:09, J Conrado wrote: Hi, I have the version of python installed: Python 3.7.6 and Python 3.8.1 If I type: python Python 3.7.6 (default, Jan 8 2020, 19:59:22) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy it is Ok, no error, but if I did: python3.8 Python 3.8.1 (default, Jan 31 2020, 15:49:05) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy' Please, I would like to know why in the python3.8 version I have this error. Thanks, It looks like you have the Anaconda distribution for Python 3.7 and the standard distribution for Python 3.8. The standard distribution comes with only the standard library. The Anaconda distribution comes with a lot of extra stuff, which includes numpy. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python error
Am 02.04.2020 um 20:09 schrieb J Conrado: > Hi, > > I have the version of python installed: > Python 3.7.6 and Python 3.8.1 > If I type: > python > Python 3.7.6 (default, Jan 8 2020, 19:59:22) > [GCC 7.3.0] :: Anaconda, Inc. on linux > Type "help", "copyright", "credits" or "license" for more information. import numpy > > it is Ok, no error, but if I did: > > python3.8 > > Python 3.8.1 (default, Jan 31 2020, 15:49:05) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux > Type "help", "copyright", "credits" or "license" for more information. import numpy > > Traceback (most recent call last): > File "", line 1, in > ModuleNotFoundError: No module named 'numpy' > > Please, > I would like to know why in the python3.8 version I have this error. Because you installed numpy only for 3.7.6. All Python installations have their own module paths, so you need to install numpy for 3.8.1 too. Do it with: python3.8 -m pip install numpy -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error Still Occured on sklearn
Thank you. Maisarah Binti Mohd Yusak Certified CPRE-FL & CTFL Software Tester, IT Team. AVL Infotech (Malaysia) Sdn. Bhd. L2-I-3, Enterprise - 4 , Technology Park Malaysia, Bukit Jalil, Kuala Lumpur, Malaysia -57000 Mobile: +6016 507 3051 Mail: mailto:maisa...@avlinfotech.net LinkedIn: https://my.linkedin.com/in/maimoyu Web: http://www.avlinfotech.net/ On Mon, 02 Dec 2019 17:30:24 +0800 Maisarah wrote Dear Admin, I have install and upgrade Cython as well. I have modified and repaired and even update the library but error is still occurred: C:\Windows\system32>pip install -U scikit-learn Collecting scikit-learn Using cached https://files.pythonhosted.org/packages/1e/ce/9d8c88e68af0a5b5c5d78d8d2b7bcadfd45e1d6afc863ccb9aee30765b06/scikit-learn-0.21.3.tar.gz Requirement already satisfied, skipping upgrade: numpy>=1.11.0 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.17.4) Requirement already satisfied, skipping upgrade: scipy>=0.17.0 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.3.3) Requirement already satisfied, skipping upgrade: joblib>=0.11 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (0.14.0) Installing collected packages: scikit-learn Running setup.py install for scikit-learn ... error ERROR: Command errored out with exit status 1: command: 'c:\users\user\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-caioz9bv\\scikit-learn\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-caioz9bv\\scikit-learn\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-o9y5q4bk\install-record.txt' --single-version-externally-managed --compile cwd: C:\Users\user\AppData\Local\Temp\pip-install-caioz9bv\scikit-learn\ Complete output (44 lines): Partial import of sklearn during the build process. No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils Traceback (most recent call last): File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver return self.find_available_vc_vers()[-1] IndexError: list index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "C:\Users\user\AppData\Local\Temp\pip-install-caioz9bv\scikit-learn\setup.py", line 290, in setup_package() File "C:\Users\user\AppData\Local\Temp\pip-install-caioz9bv\scikit-learn\setup.py", line 286, in setup_package setup(**metadata) File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\numpy\distutils\core.py", line 137, in setup config = configuration() File "C:\Users\user\AppData\Local\Temp\pip-install-caioz9bv\scikit-learn\setup.py", line 174, in configuration config.add_subpackage('sklearn') File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage config_list = self.get_subpackage(subpackage_name, subpackage_path, File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\numpy\distutils\misc_util.py", line 999, in get_subpackage config = self._get_configuration_from_setup_py( File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\numpy\distutils\misc_util.py", line 941, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "sklearn\setup.py", line 76, in configuration maybe_cythonize_extensions(top_path, config) File "C:\Users\user\AppData\Local\Temp\pip-install-caioz9bv\scikit-learn\sklearn\_build_utils\__init__.py", line 42, in maybe_cythonize_extensions with_openmp = check_openmp_support() File "C:\Users\user\AppData\Local\Temp\pip-install-caioz9bv\scikit-learn\sklearn\_build_utils\openmp_helpers.py", line 83, in check_openmp_support ccompiler.compile(['test_openmp.c'], output_dir='objects', File "c:\users\user\appdata\local\programs\python\python38\lib\distutils\_msvccompiler.py", line 360, in compile self.initialize() File "c:\users\user\appdata\local\programs\python\python38\lib\distutils\_msvccompiler.py", line 253, in initialize vc_env = _get_vc_env(plat_spec) File "c:\users\user\appdata\local\programs\python\python38\lib\site-pac
Re: Python Error
On 1/16/2017 12:32 AM, Girish Khasnis wrote: Hi, I am unable to install Python on my system. After installing Python I get the below error when I try to open Python. [image: Inline image 1] Copy and paste the error message. This is text only list. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
GBANE FETIGUE writes: > ... > I am running a python script to run some CURL commands, and return the > response which is the applicationId and the versionId. I was able to do it. > Now the versionId value supposed to be used on the second CURL as a value of > the applications key which is an array. but it doesn't work.I 'll post the > error after running the command as well as the script. It seems like I have > an error somewhere because the curl works manually if i run. > > ec2-user@ip-172-31-21-77 playbooks]$ python mmc-uploader.py > ... > Final response...HTTP Status 415 - class=" > line">type Status reportmessage > description The server refused this request because > the request entity is in a format not supported by the reque > sted resource for the requested method.Apache > Tomcat/8.0.26 What you see here is *not* a Python error message but an error message from the server you have contacted. It tells you: "The server refused this request because the request entity is in a format not supported by the requested resource for the requested method." This means, that in constructing your request you made some error - regarding the "format" (which may mean the "Content-Type") for the request "entity" (which may mean the request body). I would check the service description to find out about what "format" is expected and what the term "entity" means. Then I would check the "curl" documentation to find out how to meet those expectations. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
On Fri, Aug 5, 2016 at 5:36 AM, Terry Reedy wrote: > An example of the latter is when one writes code in Python to execute > 'other' code. (IDLE is one example. It both executes user statements and > evals user expressions.) One needs "except BaseException:" to isolate the > interpreter from exceptions raised in the interpreted code. (It would be > wrong for IDLE to stop because a user submitted code that raises, whether > intentionally or accidentally) A 'raise' that throws the exception into the > interpreter is likely the worst thing to do. This is a classic example of a "boundary location". Another extremely common example is a web server: if an exception bubbles out of a request handler function, the outer wrapper code should catch that, log it, and send a 500 back to the client. But none of this is what the OP is doing. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
On 8/4/2016 12:19 PM, MRAB wrote: In those rare occasions when you do write a bare except, A bare "except:" is never needed and in my opinion, and that of others, one should never write one (except possibly for experimentation). Be explicit and write "except BaseException:" or "except Exception:", whichever one is the actual intent. > you'd re-raise the exception afterwards: As a general rule, this is wrong, just as this rule is wrong for other exception blocks. try: ... except: print("'tis but a scratch!") raise This is right when one wants to do something *in addition to* the normal handling, such as log errors to a file, but is wrong when wants to do something *instead of* allowing the normal handling. An example of the latter is when one writes code in Python to execute 'other' code. (IDLE is one example. It both executes user statements and evals user expressions.) One needs "except BaseException:" to isolate the interpreter from exceptions raised in the interpreted code. (It would be wrong for IDLE to stop because a user submitted code that raises, whether intentionally or accidentally) A 'raise' that throws the exception into the interpreter is likely the worst thing to do. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
On Fri, Aug 5, 2016 at 2:09 AM, Igor Korot wrote: >> [1] There are exceptions to this rule, for experts. But if you need to ask >> what they are, you're not ready to know > > But even the experts will never write such a code - you never know what > happens > in a month. Server might throw some new exception, you may move on to > a different project, > etc, etc. ;-) Yes, in those situations you don't write a bare except :) As Steven said, there ARE legit uses; most of them fall under the description "boundary location". ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
On 2016-08-04 17:09, Igor Korot wrote: Steven, On Thu, Aug 4, 2016 at 11:56 AM, Steven D'Aprano wrote: On Fri, 5 Aug 2016 01:31 am, GBANE FETIGUE wrote: try: parsed_response = json.loads(response) deployid = parsed_response[u'id'] print "Your deployid is: " + deployid except: print 'Seems the named id already exists!' I'm not going to try to debug your code blindfolded with my hands tied behind my back. Get rid of those "try...except" blocks so that you can see what error is *actually* happening. As you have it now, an error happens, somewhere. You don't know where the error is, or what it is, but Python generates a nice exception showing all the detail you need to debug. But you catch that exception, throw it away, and then print a lie. It is **not true** that the named ID already exists. That is not what the error is, so why does your script tell a lie? The output from the server might give you a clue: "The server refused this request because the request entity is in a format not supported by the requested resource for the requested method." Never[1] use a bare "try...except". It is the worst thing you can do to a Python script, making it almost impossible to debug. https://realpython.com/blog/python/the-most-diabolical-python-antipattern/ Fix that problem first, get rid of the "try...except" and lying print messages, and then either the bug will be obvious, or we can debug further. [1] There are exceptions to this rule, for experts. But if you need to ask what they are, you're not ready to know But even the experts will never write such a code - you never know what happens in a month. Server might throw some new exception, you may move on to a different project, etc, etc. ;-) In those rare occasions when you do write a bare except, you'd re-raise the exception afterwards: try: ... except: print("'tis but a scratch!") raise Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
On 2016-08-04 16:31, GBANE FETIGUE wrote: Hi, I am running a python script to run some CURL commands, and return the response which is the applicationId and the versionId. I was able to do it. Now the versionId value supposed to be used on the second CURL as a value of the applications key which is an array. but it doesn't work.I 'll post the error after running the command as well as the script. It seems like I have an error somewhere because the curl works manually if i run. What do you put on the command line when you do it manually? ec2-user@ip-172-31-21-77 playbooks]$ python mmc-uploader.py % Total% Received % Xferd Average Speed TimeTime Time Current Dload Upload Total SpentLeft Speed 100 23180 119 100 2199496 9173 --:--:-- --:--:-- --:--:-- 9200 Your applicationId is: local$fc9277b0-a5b1-4602-8730-714ab7472744 Your versionId is: local$423da1c8-c4e1-47af-9395-57300f839670 % Total% Received % Xferd Average Speed TimeTime Time Current Dload Upload Total SpentLeft Speed 100 1259 100 1091 100 168 100k 15868 --:--:-- --:--:-- --:--:-- 106k Final responseApache Tomcat/8.0.26 - Error reportH1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;} HTTP Status 415 - type Status reportmessage description The server refused this request because the request entity is in a format not supported by the req ue sted resource for the requested method.Apache Tomcat/8.0.26 Seems the named id already exists! That's the script : from subprocess import check_output, STDOUT import json response = check_output(["curl", "--basic", "-u", "admin:admin", "-F", "file=@/var/lib/jenkins/workspace/Demo-Ci-cd-automation/playbooks/ms3-simple-hello-world-app-1.0.0-SNAPSHOT.zip", "-F", "name=ms3-simple-hello-world-app", "-F", "version=1.0.0", "--header", "\"Content-Type: multipart/form-data\"", "http://52.73.56.141:8080/mmc-console-3.6.2/api/repository";]) try: parsed_response = json.loads(response) print "Your applicationId is: " + parsed_response[u'applicationId'] version_id = parsed_response[u'versionId'] print "Your versionId is: " + version_id Don't use a bare except because it'll catch _ANY_ exception, including NameError, which could happen if you accidentally misspell a name. except: print 'Seems the named application already exists!' print 'Seems the named versionId already exists!' This look likes it passes curl some JSON wrapped in "'", so curl won't see something like this: {"key": "value"} (a dict), it'll see something like this: '{"key": "value"}' (a string delimited by '...') which isn't valid JSON. response = check_output(["curl", "--basic", "-u", "admin:admin", "-d", "'{\"name\" : \"ms3-simple-hello-world-app\" , \"servers\": [ \"local$d50bdc24-ff04-4327-9284-7bb708e21c25\" ], \"applications\": [ \"" + version_id + "\"]}'", "--header", "\'Content-Type: application/json\'", "http://52.73.56.141:8080/mmc-console-3.6.2/api/deployments";]) print 'Final response' + response try: parsed_response = json.loads(response) deployid = parsed_response[u'id'] print "Your deployid is: " + deployid Another bare except! except: print 'Seems the named id already exists!' 'check_output' and related functions/methods will do the quoting for you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
Steven, On Thu, Aug 4, 2016 at 11:56 AM, Steven D'Aprano wrote: > On Fri, 5 Aug 2016 01:31 am, GBANE FETIGUE wrote: > >> try: >> parsed_response = json.loads(response) >> deployid = parsed_response[u'id'] >> print "Your deployid is: " + deployid >> except: >> print 'Seems the named id already exists!' > > > I'm not going to try to debug your code blindfolded with my hands tied > behind my back. Get rid of those "try...except" blocks so that you can see > what error is *actually* happening. > > As you have it now, an error happens, somewhere. You don't know where the > error is, or what it is, but Python generates a nice exception showing all > the detail you need to debug. > > But you catch that exception, throw it away, and then print a lie. > > It is **not true** that the named ID already exists. That is not what the > error is, so why does your script tell a lie? > > The output from the server might give you a clue: > > "The server refused this request because the request entity is in a format > not supported by the requested resource for the requested method." > > > Never[1] use a bare "try...except". It is the worst thing you can do to a > Python script, making it almost impossible to debug. > > https://realpython.com/blog/python/the-most-diabolical-python-antipattern/ > > Fix that problem first, get rid of the "try...except" and lying print > messages, and then either the bug will be obvious, or we can debug further. > > > > > > > [1] There are exceptions to this rule, for experts. But if you need to ask > what they are, you're not ready to know But even the experts will never write such a code - you never know what happens in a month. Server might throw some new exception, you may move on to a different project, etc, etc. ;-) Thank you. > > > -- > Steve > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure > enough, things got worse. > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
On Fri, 5 Aug 2016 01:31 am, GBANE FETIGUE wrote: > try: > parsed_response = json.loads(response) > deployid = parsed_response[u'id'] > print "Your deployid is: " + deployid > except: > print 'Seems the named id already exists!' I'm not going to try to debug your code blindfolded with my hands tied behind my back. Get rid of those "try...except" blocks so that you can see what error is *actually* happening. As you have it now, an error happens, somewhere. You don't know where the error is, or what it is, but Python generates a nice exception showing all the detail you need to debug. But you catch that exception, throw it away, and then print a lie. It is **not true** that the named ID already exists. That is not what the error is, so why does your script tell a lie? The output from the server might give you a clue: "The server refused this request because the request entity is in a format not supported by the requested resource for the requested method." Never[1] use a bare "try...except". It is the worst thing you can do to a Python script, making it almost impossible to debug. https://realpython.com/blog/python/the-most-diabolical-python-antipattern/ Fix that problem first, get rid of the "try...except" and lying print messages, and then either the bug will be obvious, or we can debug further. [1] There are exceptions to this rule, for experts. But if you need to ask what they are, you're not ready to know. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error message
On Fri, Aug 5, 2016 at 1:31 AM, GBANE FETIGUE wrote: > try: > parsed_response = json.loads(response) > print "Your applicationId is: " + parsed_response[u'applicationId'] > version_id = parsed_response[u'versionId'] > print "Your versionId is: " + version_id > except: > print 'Seems the named application already exists!' > print 'Seems the named versionId already exists!' > This is a very bad idea. You're catching every possible exception and printing out the same message for all of them. And then continuing blithely on. Instead, catch ONLY the exceptions you really expect to be seeing (I'm guessing KeyError here). If anything else goes wrong, let the exception bubble up. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: python error
On 11/3/2015 8:07 AM, Ruud van Rooijen wrote: my code: from tkinter import * window = Tk() label = Label(window, text="miniproject A1") label.pack() window.mainloop() given error: C:\Users\Ruud\Python35\Scripts\python.exe Based on the below, python.exe should be in C:\Users\Ruud\AppData\Local\Programs\Python\Python35-32 _tkinter should then be in C:\Users\Ruud\AppData\Local\Programs\Python\Python35-32\DLLs If you moved it, that is your problem. If you have two python installations, with a second one in C:\Users\Ruud\Python35, then python.exe should be in that directory, NOT scripts. C:/Users/Ruud/PycharmProjects/School/project.py I know essentially nothing about PyCharm, even if it is compatible with tkinter. Traceback (most recent call last): File "C:/Users/Ruud/PycharmProjects/School/project.py", line 3, in window = Tk() File "C:\Users\Ruud\AppData\Local\Programs\Python\Python35-32\Lib\tkinter\__init__.py", line 1867, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: Can't find a usable init.tcl in the following directories: C:/Users/Ruud/AppData/Local/Programs/Python/Python35-32/lib/tcl8.6 C:/Users/Ruud/Python35/lib/tcl8.6 C:/Users/Ruud/lib/tcl8.6 C:/Users/Ruud/Python35/library C:/Users/Ruud/library C:/Users/Ruud/tcl8.6.4/library C:/Users/tcl8.6.4/library With a screwed up installation, or pair of installations, it looks 'everyplace' but the right place. This probably means that Tcl wasn't installed properly. i have repaired python several times and i can't find an answer online... please help python.exe in scripts is not properly installed. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error: ImportError: No module named ''folder_name’ at Command Prompt
On 7/11/2015 11:15 AM, Ernest Bonat, Ph.D. wrote: Hi All, I’m doing a CSV data analysis in Python using Eclipse IDE/PyDev. I have organized my project using the standard MVC architecture. In Eclipse IDE everything is working properly. When I run my main.py file it at Command Prompt I got an error: ImportError: No module named 'folder_name'. It’s like the location path of the ‘'folder_name’ was not found. Do I need to update my main.py file to run it at the Command Prompt? 'import module' searches directories on sys.path for a file or directory named 'module'. sys.path starts with '.', which represents the 'current' directory. If you start with the directory containing main.py as current directory and 'folder-name' is in the same directory, the import should work. Otherwise ??? EclipseIDE probably modifies the current dir and/or path to make things work. For any more help, post the OS and locations of main.py, folder_name, and python. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 29 May 2013 00:44, "Dennis Lee Bieber" wrote: > > On Tue, 28 May 2013 17:15:51 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > > > > Can we internationalize English instead of localizing Python? > > > > Not-entirely-joking-ly yours, > > > All that is required is to get Python declared a valid air traffic > control communication (all international air traffic control uses > English) > > Totally-joking-I-suspect > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ > with import mangoes as cargo: allow() -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 28 May 2013 09:22, "Chris Angelico" wrote: > > On Tue, May 28, 2013 at 6:10 PM, Fábio Santos wrote: > > Just to clarify, I am suggesting to have the unchanged messages in > > tracebacks, but having some methods in the exception to get the exception > > and message localised. Just like repr() and str() are directed at different > > audiences (the programmer vs. The user), so is a traceback vs a message box. > > There's no particular reason for that to be a method on the exception, > then. You're just asking to localize a text string, and I think that > functionality already exists someplace :) Yes :) what we don't have is a translation string for every exception that Python could raise. Or at least some of them. > > OpenERP for example shows stack traces to the user. It could show a shorter > > message in the user's language. > > Sounds like an OpenERP feature request, then. No, it's just something that OpenERP would obviously do if it had a library to, or language support :) this could be the One Obvious Way To Do It for displaying error messages in localised applications. That said, I'm going to think about this and maybe write a library for localising exceptions and a portuguese translation pack. PS. FWIW I'm rather stubborn sometimes. Sorry if I bothered you in any way. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
28.05.13 11:17, Chris Angelico написав(ла): On Tue, May 28, 2013 at 6:10 PM, Fábio Santos wrote: Just to clarify, I am suggesting to have the unchanged messages in tracebacks, but having some methods in the exception to get the exception and message localised. Just like repr() and str() are directed at different audiences (the programmer vs. The user), so is a traceback vs a message box. There's no particular reason for that to be a method on the exception, then. You're just asking to localize a text string, and I think that functionality already exists someplace :) It will be very helpful in case of KeyError for example. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On Tue, 28 May 2013 17:15:51 +1000, Chris Angelico wrote: > Can we internationalize English instead of localizing Python? We have. English is the primary international language for programmers. (For which I am profoundly grateful.) Japanese is also a pretty important language, but mostly in Japan. And China would like Chinese to be, in fact there is even a version of Python localised to Chinese: http://www.chinesepython.org/ I have no objection to people creating their own, localised, implementation or fork of Python, in which case good luck to them but they're on their own. But I don't think that exceptions should otherwise be localised. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On Tue, May 28, 2013 at 6:10 PM, Fábio Santos wrote: > Just to clarify, I am suggesting to have the unchanged messages in > tracebacks, but having some methods in the exception to get the exception > and message localised. Just like repr() and str() are directed at different > audiences (the programmer vs. The user), so is a traceback vs a message box. There's no particular reason for that to be a method on the exception, then. You're just asking to localize a text string, and I think that functionality already exists someplace :) > OpenERP for example shows stack traces to the user. It could show a shorter > message in the user's language. Sounds like an OpenERP feature request, then. > On 28 May 2013 08:19, "Chris Angelico" wrote: >> Can we internationalize English instead of localizing Python? >> > > That is worse than saying, "why don't we all just code in python?". Or c. Or > java. Or JavaScript. > > Let's not get into that. I prefer len() to new > LengthCalculatorFactoryBuilder().createLengthCalculatorFactory().createLengthCalculator().calculateLengthOf(). > And a good old Python list or JavaScript array to a collection of segfaults. Yeah, like I said, that wasn't a serious suggestion :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 28 May 2013 08:19, "Chris Angelico" wrote: > > On Tue, May 28, 2013 at 4:57 PM, Fábio Santos wrote: > > > > On 28 May 2013 05:17, "Vito De Tullio" wrote: > >> I really hope really far... have you never tried to google a localized > >> error > >> message? :\ > > > > Never. I don't even try. > > Same happens when someone pastes an error onto a mailing list like > this. Unless there's some easily-identifiable token (maybe the > exception type doesn't get localized, though that has its own > consequences) by which everyone world-over can recognize the > exception, this would be a major nuisance. Just to clarify, I am suggesting to have the unchanged messages in tracebacks, but having some methods in the exception to get the exception and message localised. Just like repr() and str() are directed at different audiences (the programmer vs. The user), so is a traceback vs a message box. In English, we could "translate" the exception name (which is limited as a python name). EG. RuntimeError -> Runtime error. Of course, this is not a big deal, but it would let us show the error message to the user, together with the exception. It would be much harder to search for an error or ask for help if it was a message written by some random developer. OpenERP for example shows stack traces to the user. It could show a shorter message in the user's language. > Also, once the interpreter > core and a few parts of the stdlib get localized, this would add a > barrier to entry for new modules... not sure this is a good thing. I think that would be a job for a per-language team as opposed to someone implementing a bug fix or pushing a PEP? Even that would only be necessary for the exceptions a module raises. > Can we internationalize English instead of localizing Python? > That is worse than saying, "why don't we all just code in python?". Or c. Or java. Or JavaScript. Let's not get into that. I prefer len() to new LengthCalculatorFactoryBuilder().createLengthCalculatorFactory().createLengthCalculator().calculateLengthOf(). And a good old Python list or JavaScript array to a collection of segfaults. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On Tue, May 28, 2013 at 4:57 PM, Fábio Santos wrote: > > On 28 May 2013 05:17, "Vito De Tullio" wrote: >> I really hope really far... have you never tried to google a localized >> error >> message? :\ > > Never. I don't even try. Same happens when someone pastes an error onto a mailing list like this. Unless there's some easily-identifiable token (maybe the exception type doesn't get localized, though that has its own consequences) by which everyone world-over can recognize the exception, this would be a major nuisance. Also, once the interpreter core and a few parts of the stdlib get localized, this would add a barrier to entry for new modules... not sure this is a good thing. Can we internationalize English instead of localizing Python? Not-entirely-joking-ly yours, ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 28 May 2013 05:17, "Vito De Tullio" wrote: > > Fábio Santos wrote: > > >> > > Speaking of PEPs and exceptions. When do we get localized exceptions? > >> > > >> > What do you mean by "localized exceptions"? > >> > > >> > Please, tell me it's *NOT* a proposal to send the exception message in > >> > the > >> > locale language! > >> It is. I think I read it mentioned in python-dev or this list. > > > > Here is what I read. > > > > http://mail.python.org/pipermail/python-dev/2013-April/125364.html > > > > It wasn't only about exceptions after all. And it seems like something > > that will only happen far into the future. > > I really hope really far... have you never tried to google a localized error > message? :\ > > -- > By ZeD > Never. I don't even try. I still think this is a good idea. Not for debugging though. For UI (and error logs if your requirements include writing them in the user language), it could simplify all the user-facing-unexpected-error-reporting into an except hook, or a try..except high up in your call stack. It would be a pretty big step towards RAD. But it had to be made optional somehow. Maybe using errno and existing exception messages together with gettext? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
Fábio Santos wrote: >> > > Speaking of PEPs and exceptions. When do we get localized exceptions? >> > >> > What do you mean by "localized exceptions"? >> > >> > Please, tell me it's *NOT* a proposal to send the exception message in >> > the >> > locale language! >> It is. I think I read it mentioned in python-dev or this list. > > Here is what I read. > > http://mail.python.org/pipermail/python-dev/2013-April/125364.html > > It wasn't only about exceptions after all. And it seems like something > that will only happen far into the future. I really hope really far... have you never tried to google a localized error message? :\ -- By ZeD -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27 May 2013 19:36, "Fábio Santos" wrote: > > > On 27 May 2013 19:23, "Vito De Tullio" wrote: > > > > Fábio Santos wrote: > > > > >> This should make life easier for us > > > http://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy > > > > > > Speaking of PEPs and exceptions. When do we get localized exceptions? > > > > What do you mean by "localized exceptions"? > > > > Please, tell me it's *NOT* a proposal to send the exception message in the > > locale language! > > > > -- > > By ZeD > > > > -- > > http://mail.python.org/mailman/listinfo/python-list > > It is. I think I read it mentioned in python-dev or this list. Here is what I read. http://mail.python.org/pipermail/python-dev/2013-April/125364.html It wasn't only about exceptions after all. And it seems like something that will only happen far into the future. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27 May 2013 19:23, "Vito De Tullio" wrote: > > Fábio Santos wrote: > > >> This should make life easier for us > > http://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy > > > > Speaking of PEPs and exceptions. When do we get localized exceptions? > > What do you mean by "localized exceptions"? > > Please, tell me it's *NOT* a proposal to send the exception message in the > locale language! > > -- > By ZeD > > -- > http://mail.python.org/mailman/listinfo/python-list It is. I think I read it mentioned in python-dev or this list. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
Fábio Santos wrote: >> This should make life easier for us > http://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy > > Speaking of PEPs and exceptions. When do we get localized exceptions? What do you mean by "localized exceptions"? Please, tell me it's *NOT* a proposal to send the exception message in the locale language! -- By ZeD -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 5/27/2013 12:54 PM, Carlos Nepomuceno wrote: I think PEP 3151 is a step ahead! That's almost exactly what I was looking for. Why did it take so long to have that implemented? Since this PEP involved changing existing features, rather than adding something mew, it probably took moe time and discussion to get consensus on details of the change. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27/05/2013 17:54, Carlos Nepomuceno wrote: I think PEP 3151 is a step ahead! That's almost exactly what I was looking for. Why did it take so long to have that implemented? Lack of volunteers. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
RE: Python error codes and messages location
Thanks so much guys! I'm not planning to prepare for every possible situation, but I certainly am responsible to handle most common errors. So it's really important to know what a function/method returns when called. Exception handling may take lots of code, but I'm used to it. It's much better to have a graceful shutdown than a data/time loss. ;) I think PEP 3151 is a step ahead! That's almost exactly what I was looking for. Why did it take so long to have that implemented? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On Mon, May 27, 2013 at 2:11 PM, Steven D'Aprano wrote: > On Mon, 27 May 2013 13:46:50 +0100, Fábio Santos wrote: > >> Speaking of PEPs and exceptions. When do we get localized exceptions? > > > We're waiting for you to volunteer. When can you start? I'd love to work on that but my C is too shabby to say the least. -- Fábio Santos -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On Mon, 27 May 2013 13:46:50 +0100, Fábio Santos wrote: > Speaking of PEPs and exceptions. When do we get localized exceptions? We're waiting for you to volunteer. When can you start? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27 May 2013 12:41, "Mark Lawrence" wrote: > This should make life easier for us http://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy Speaking of PEPs and exceptions. When do we get localized exceptions? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27/05/2013 07:11, Cameron Simpson wrote: BTW, I recommend importing "errno" and using symbolic names. It makes things much more readable, and accomodates the situation where the symbols map to different numbers on different platforms. And have a catch-all. For example: Cheers, This should make life easier for us http://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On Mon, May 27, 2013 at 4:11 PM, Cameron Simpson wrote: > On 27May2013 04:49, Carlos Nepomuceno wrote: > | That's bad! I'd like to check all the IOError codes that may be > | raised by a function/method but the information isn't there. > > No, you really don't. Heh. I concur. Opening a file can generate roughly forty-two million different errors. Here's a smattering that you might not be expecting: * The path points somewhere that's not currently mounted * The path represents a device that is not properly working * It's over a network and the server at the far end is down * It's over a network and the server sends back maliciously crafted data * It's over a network and the server sends back an incorrect error code * You tried to open something that doesn't exist, and your disk quota is used up * The system has run out of handles * You're trying to create something in the root directory of a FAT volume that already has too many root directory entries And plenty more besides. Those are just a few that I could come up with off the top of my head. Just catch whatever makes sense (IOError maybe), and don't sweat the details. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On 27May2013 04:49, Carlos Nepomuceno wrote: | > From: steve+comp.lang.pyt...@pearwood.info | > On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: | >> Where can I find all error codes and messages that Python throws (actual | >> codes and messages from exceptions raised by stdlib)? | > | > There is no list. It is subject to change from version to version, | > including point releases. [...] | > "Read the source code." [...] | | That's bad! I'd like to check all the IOError codes that may be | raised by a function/method but the information isn't there. No, you really don't. There are particular, expected, errors you know what to do with and can proceed in the face of. And there will often be errors you _don't_ know what to do with. With the latter, what is your program going to do? You often can't proceed, so all you can do is log the error and cancel, cleaning up as you back out. In that circumstance, how will knowing the name of the error help? You've logged it, and hopefully the exception message is sufficient. | Take open() for example[1]. It only says it raises an IOError exception. | | I've had to try "open('','r')" to discover that Errno 22 is the one "IOError: [Errno 22] invalid mode ('r') or filename: ''" It is vague because that is an OS level error, and errno 22 is EINVAL. For example, MacOSX says (in "man 2 intro"): 22 EINVAL Invalid argument. Some invalid argument was supplied. (For example, specifying an undefined signal to a signal or kill func‐ tion). It happens that above, the filename '' is invalid. But so what? That call is _never_ going to work because the arguments are invalid. So you response will be the same, programmatically, as with many other errors: log and abort. | Will I only be able to get all error codes reading the source code of open()? Nope. Well, not directly. Python open call's the OS' open. If that succeeds, Python does some more housekeeping and hands you a "file" python object. But if the OS open fails, Python reports the OS error. From the Python source you will see that the OS open is called. So you must then go to the OS docuemntation for further information. | Is there a way to simulate the errors instead of actually causing | them? I mean not raising an instance of IOError that I create (like | "raise IOError(666,'Hell happens')"), but one with the actual | contents 'args = (errno, strerr)' that open() would raise? | | Something like: | | f=open('filename','r') | for x in range(25): | try: | f.raise_errno(x) | except IOError, e: | if e.errno == 1: | treat_err1() | continue | elif e.errno == 2: | treat_err2() | continue Well, maybe this (untested): for x in range(25): try: exc = OSError(os.strerror(x)) exc.errno = x raise exc except IOError, e: if e.errno == 1: treat_err1() continue elif e.errno == 2: treat_err2() continue BTW, I recommend importing "errno" and using symbolic names. It makes things much more readable, and accomodates the situation where the symbols map to different numbers on different platforms. And have a catch-all. For example: import errno ... try: f = open(filename, .) except OSError, e: if e.errno == errno.EPERM: ... Operation not permitted ... elif e.errno == errno.ENOENT: ... No such file or directory ... else: # surprise! # log message, let the exception get out # callers can catch things in turn logging.error("open(%s) fails: %s" % (filename, e)) raise | >> I've already found the module 'errno' and got a dictionary | >> (errno.errorcode) and some system error messages | >> (os.strerror(errno.ENAMETOOLONG)) but there's more I couldn't find. | > | > These are the standard C operating system and file system error codes, | > not Python exceptions. | | Yes, the docs say it's from "linux/include/errno.h". On Linux, yes. In general, on any UNIX system the command "man 2 intro" lists the errors that system calls like open may return. And "man 2 open" should list the particular errors that open can return. _On that platform_. The platform variation is a major reason why you should not hope to enumerate all the errors; the other reason is that you can't treat every error individually in a fine grained fashion without making your code hard to read and maintain: the core logic of the program is hidden behind a forest of tiny little special cases. Your code will be clearer if you handle the errors that are expected and that permit the program to proceed sensible. Other errors should elicit a log message of course, but if you can't proceed with the task at hand you can almost certainly only abort and try to tidy up while doing so. Cheers, -- Processes are like potatoes.
Re: Python error codes and messages location
On 27May2013 00:53, Steven D'Aprano wrote: | On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: | > Where can I find all error codes and messages that Python throws (actual | > codes and messages from exceptions raised by stdlib)? | | There is no list. It is subject to change from version to version, | including point releases. And better still, it is platform specific too. [...] | > I've already found the module 'errno' and got a dictionary | > (errno.errorcode) and some system error messages | > (os.strerror(errno.ENAMETOOLONG)) but there's more I couldn't find. | | These are the standard C operating system and file system error codes, | not Python exceptions. And the poster boy example for platform dependence. Besides, knowing the exact errors that may occur is not the Python Way, it is the Java Way. Run it. if it goes bang, handle the errors you expect and understand. If you get something else, go bang for real because you _don't_ know what should happen, and proceeding is probably insane. Cheers, -- Cameron Simpson Motorcycles are like peanuts... who can stop at just one? - Zebee Johnstone aus.motorcycles Poser Permit #1 -- http://mail.python.org/mailman/listinfo/python-list
RE: Python error codes and messages location
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: Python error codes and messages location > Date: Mon, 27 May 2013 00:53:41 + > To: python-list@python.org > > On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: > >> Where can I find all error codes and messages that Python throws (actual >> codes and messages from exceptions raised by stdlib)? > > There is no list. It is subject to change from version to version, > including point releases. > > Many functions and methods document which exceptions they can be expected > to raise, or at least the *usual* exceptions, but many more do not. And > the error messages themselves are implementation details and are subject > to change without notice, even if the exception type is a documented part > of the API. > > You can see a full list of built-in exception types in the docs: > > http://docs.python.org/3/library/exceptions.html > > but of course since they are classes, they can be subclassed, and in > principle a function that raises (say) ValueError might sometimes raise a > subclass of ValueError without documenting it. > > So the actual answer to your question is: > > "Read the source code." > > > Sorry :-( That's bad! I'd like to check all the IOError codes that may be raised by a function/method but the information isn't there. Take open() for example[1]. It only says it raises an IOError exception. I've had to try "open('','r')" to discover that Errno 22 is the one "IOError: [Errno 22] invalid mode ('r') or filename: ''" Will I only be able to get all error codes reading the source code of open()? Is there a way to simulate the errors instead of actually causing them? I mean not raising an instance of IOError that I create (like "raise IOError(666,'Hell happens')"), but one with the actual contents 'args = (errno, strerr)' that open() would raise? Something like: f=open('filename','r') for x in range(25): try: f.raise_errno(x) except IOError, e: if e.errno == 1: treat_err1() continue elif e.errno == 2: treat_err2() continue ... [1] http://docs.python.org/2/library/functions.html#open >> I've already found the module 'errno' and got a dictionary >> (errno.errorcode) and some system error messages >> (os.strerror(errno.ENAMETOOLONG)) but there's more I couldn't find. > > These are the standard C operating system and file system error codes, > not Python exceptions. Yes, the docs say it's from "linux/include/errno.h". -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error codes and messages location
On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: > Where can I find all error codes and messages that Python throws (actual > codes and messages from exceptions raised by stdlib)? There is no list. It is subject to change from version to version, including point releases. Many functions and methods document which exceptions they can be expected to raise, or at least the *usual* exceptions, but many more do not. And the error messages themselves are implementation details and are subject to change without notice, even if the exception type is a documented part of the API. You can see a full list of built-in exception types in the docs: http://docs.python.org/3/library/exceptions.html but of course since they are classes, they can be subclassed, and in principle a function that raises (say) ValueError might sometimes raise a subclass of ValueError without documenting it. So the actual answer to your question is: "Read the source code." Sorry :-( > I've already found the module 'errno' and got a dictionary > (errno.errorcode) and some system error messages > (os.strerror(errno.ENAMETOOLONG)) but there's more I couldn't find. These are the standard C operating system and file system error codes, not Python exceptions. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
Jürgen A. Erhard wrote: > Peter's right, but instead of a print before the line, put a > try/except around it, like > >try: > set1 = set(list1) >except TypeError: > print list1 > raise > > This way, only the *actual* error triggers any output. With a general > print before, you can get a lot of unnecessary output. > > Grits, J > Or even better: try: set1 = set(list1) except TypeError: print list1 import pdb; pdb.set_trace() raise Then the error will print the value of list1 and drop you into the debugger so you can examine what's going on in more detail. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On Mon, Jul 30, 2012 at 12:36 AM, wrote: > If this kind of problems happen, --rare but in my 6 yrs Python experience > happened sometimes--then I take a new window, rewrite or copy the earlier > code module by module, give a new method name--believe it or not--- works. If that solves your problem, it may be that you inadvertently shadowed a built-in - maybe you assigned to "set" or "list" or something. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote: > Dear Group, > > > > I was trying to convert the list to a set, with the following code: > > > > set1=set(list1) > > > > the code was running fine, but all on a sudden started to give the following > error, > > > > set1=set(list1) > > TypeError: unhashable type: 'list' > > > > please let me know how may I resolve. > > > > And sometimes some good running program gives error all on a sudden with no > parameter changed, how may I debug it? > > > > Thanking You in Advance, > > > > Regards, > > Subhabrata Banerjee. Dear Group, Thank you for your kind time and reply. True as Steven pointed the error should be specific. I tested. Put comment mark before the set assignment, printed the list as Peter suggested, taken the print of the list, but no it is not my problem, as you suggested what is contained in the list, I am taking out the values and then assigning blank list and appending the processed values in the list. If this kind of problems happen, --rare but in my 6 yrs Python experience happened sometimes--then I take a new window, rewrite or copy the earlier code module by module, give a new method name--believe it or not--- works. Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On 7/29/2012 5:30 AM subhabangal...@gmail.com said... On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote: Dear Group, I was trying to convert the list to a set, with the following code: set1=set(list1) Thanks for the answer. But my list does not contain another list that is the issue. Intriguing. Thinking what to do. Now you need to identify the type of the object that is causing python to misreport the unhashable type causing the error as the error you're getting says list and you say there isn't one. So, now we have a python bug. >>> set ([1,2,3]) set([1, 2, 3]) >>> set ([1,2,[]]) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list' >>> set ([1,2,{}]) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'dict' > the code was running fine, but all on a sudden started to give the following error, > > > > set1=set(list1) > > TypeError: unhashable type: 'list' Try adding the following: for ii in list1: try: set([ii]) except: print "this causes an error type (val): %s (%s)" (type(ii),ii) Either it's a python bug or there really is a list in there. Emile -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On Sunday, July 29, 2012 7:53:59 PM UTC+5:30, Roy Smith wrote: > In article <81818a9c-60d3-48da-9345-0c0dfd5b2...@googlegroups.com>, > > subhabangal...@gmail.com wrote: > > > > > set1=set(list1) > > > > > > the code was running fine, but all on a sudden started to give the > > following > > > error, > > > > > > set1=set(list1) > > > TypeError: unhashable type: 'list' > > > > First, make sure you understand what the error means. All the elements > > of a set must be hashable. Lists are not hashable because they are > > mutable. So, what the error is telling you is that some element of > > list1 is itself a list, and therefore not hashable, and thus the set > > can't be created. > > > > I would start by printing list1. If the list is long (or contains > > deeply nested structures), just doing "print list1" may result in > > something that is difficult to read. In that case, try using pprint > > (see the pprint module) to get a nicer display. > > > > If it's still not obvious, pull out the bigger guns. Try something like: > > > > for item in list1: > >try: > > hash(item) > >except TypeError: > > print "This one can't be hashed: %s" % item > > > > > And sometimes some good running program gives error all on a sudden with no > > > parameter changed > > > > Well, *something* changed. Assuming nothing truly bizarre like a stray > > Higgs Boson flipping a bit in your computer's memory, what you need to > > do is figure out what that is. Did you change your code in any way > > (having everything under version control helps here)? If not the code, > > then what changed about the input? > > > > If you're sure that both the code and the input are unchanged, that > > leaves something in the environment. Did your python interpreter get > > upgraded to a newer version? Or your operating system? PYTHONPATH? > > > > Depending on what your program is doing, it could be something time > > based. A different time zone, perhaps? Did daylight savings time just > > go into or out of effect where you are? Does it only fail on Sunday? Hi Roy, Sorry I overlooked your answer. It fails generally on Sunday. True. How you got it? I recently downloaded Python2.7 64 bit -while I am working on Python3.2.1 64 bit Windows 7 SP1. Regards, Subhabrata Banerjee. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On Sun, Jul 29, 2012 at 01:08:57PM +0200, Peter Otten wrote: > subhabangal...@gmail.com wrote: > > > Dear Group, > > > > I was trying to convert the list to a set, with the following code: > > > > set1=set(list1) > > > > the code was running fine, but all on a sudden started to give the > > following error, > > > > set1=set(list1) > > TypeError: unhashable type: 'list' > > > > Add a print statement before the offending line: > > print list1 > set1 = set(list1) > > You will see that list1 contains another list, e. g. this works... > Peter's right, but instead of a print before the line, put a try/except around it, like try: set1 = set(list1) except TypeError: print list1 raise This way, only the *actual* error triggers any output. With a general print before, you can get a lot of unnecessary output. Grits, J -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
In article <81818a9c-60d3-48da-9345-0c0dfd5b2...@googlegroups.com>, subhabangal...@gmail.com wrote: > set1=set(list1) > > the code was running fine, but all on a sudden started to give the following > error, > > set1=set(list1) > TypeError: unhashable type: 'list' First, make sure you understand what the error means. All the elements of a set must be hashable. Lists are not hashable because they are mutable. So, what the error is telling you is that some element of list1 is itself a list, and therefore not hashable, and thus the set can't be created. I would start by printing list1. If the list is long (or contains deeply nested structures), just doing "print list1" may result in something that is difficult to read. In that case, try using pprint (see the pprint module) to get a nicer display. If it's still not obvious, pull out the bigger guns. Try something like: for item in list1: try: hash(item) except TypeError: print "This one can't be hashed: %s" % item > And sometimes some good running program gives error all on a sudden with no > parameter changed Well, *something* changed. Assuming nothing truly bizarre like a stray Higgs Boson flipping a bit in your computer's memory, what you need to do is figure out what that is. Did you change your code in any way (having everything under version control helps here)? If not the code, then what changed about the input? If you're sure that both the code and the input are unchanged, that leaves something in the environment. Did your python interpreter get upgraded to a newer version? Or your operating system? PYTHONPATH? Depending on what your program is doing, it could be something time based. A different time zone, perhaps? Did daylight savings time just go into or out of effect where you are? Does it only fail on Sunday? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On Sun, 29 Jul 2012 05:30:15 -0700, subhabangalore wrote: > Dear Peter, > Thanks for the answer. But my list does not contain another list that is > the issue. Intriguing. That is not what the error message says. You said that this line of code: set1=set(list1) gives this error: TypeError: unhashable type: 'list' Almost certainly, either you are mistaken about the line of code which gives the error, or you are mistaken about the error, or you are mistaken that your list does not contain any lists. > Thinking what to do. Exactly what Peter suggested: print the list before you try to convert it to a set, and see what it actually contains. It will also help you to read this page and try to follow its advice: http://sscce.org/ -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On 29/07/2012 13:30, subhabangal...@gmail.com wrote: On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote: Dear Group, I was trying to convert the list to a set, with the following code: set1=set(list1) Dear Peter, Thanks for the answer. But my list does not contain another list that is the issue. Intriguing. Thinking what to do. Regards, Subhabrata. Can you loop round the list and print each entry and its type, that should give you some clues? the code was running fine, but all on a sudden started to give the following error, set1=set(list1) TypeError: unhashable type: 'list' please let me know how may I resolve. And sometimes some good running program gives error all on a sudden with no parameter changed, how may I debug it? Thanking You in Advance, Regards, Subhabrata Banerjee. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
Hi, Have you tried printing the list which is passed onto the set. The items in the list passed should be hashable and possibly there are objects which are not hashable. On Sun, Jul 29, 2012 at 2:30 PM, wrote: > On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote: > > Dear Group, > > > > > > > > I was trying to convert the list to a set, with the following code: > > > > > > > > set1=set(list1) > > > > > > > Dear Peter, > Thanks for the answer. But my list does not contain another list that is > the issue. Intriguing. Thinking what to do. > Regards, > Subhabrata. > > the code was running fine, but all on a sudden started to give the > following error, > > > > > > > > set1=set(list1) > > > > TypeError: unhashable type: 'list' > > > > > > > > please let me know how may I resolve. > > > > > > > > And sometimes some good running program gives error all on a sudden with > no parameter changed, how may I debug it? > > > > > > > > Thanking You in Advance, > > > > > > > > Regards, > > > > Subhabrata Banerjee. > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On 07/29/2012 02:30 PM, subhabangal...@gmail.com wrote: > Thanks for the answer. But my list does not contain another list that is the > issue. Intriguing. Thinking what to do. What does your list contain? Can you reproduce the issue in a few self-contained lines of code that you can show us, that we can test ourselves? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote: > Dear Group, > > > > I was trying to convert the list to a set, with the following code: > > > > set1=set(list1) > > > Dear Peter, Thanks for the answer. But my list does not contain another list that is the issue. Intriguing. Thinking what to do. Regards, Subhabrata. > the code was running fine, but all on a sudden started to give the following > error, > > > > set1=set(list1) > > TypeError: unhashable type: 'list' > > > > please let me know how may I resolve. > > > > And sometimes some good running program gives error all on a sudden with no > parameter changed, how may I debug it? > > > > Thanking You in Advance, > > > > Regards, > > Subhabrata Banerjee. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error
subhabangal...@gmail.com wrote: > Dear Group, > > I was trying to convert the list to a set, with the following code: > > set1=set(list1) > > the code was running fine, but all on a sudden started to give the > following error, > > set1=set(list1) > TypeError: unhashable type: 'list' > > please let me know how may I resolve. > > And sometimes some good running program gives error all on a sudden with > no parameter changed, how may I debug it? Add a print statement before the offending line: print list1 set1 = set(list1) You will see that list1 contains another list, e. g. this works... >>> list1 = ["alpha", "beta"] >>> >>> >>> set(list1) >>> >>> set(['alpha', 'beta']) ...while this doesn't: >>> list1 = ["alpha", ["beta"]] >>> >>> >>> set(list1) >>> >>> Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list' -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
On Jul 13, 5:19 pm, John Gordon wrote: > In <0730c5fb-3b65-45ce-9cc5-69d639f48...@g2g2000vbl.googlegroups.com> > Adeoluwa Odein writes: > > > if you define the function in the execute() method, it works (as seen > > on the page). But this is a stored procedure already residing on the > > DB. A function/procedure outside of a package, actually works, but > > then you lose access to private data; which is while I used a package. > > Did you try changing RS22 from a procedure to a function inside the > package? > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" The same problem, if done inside a package. I just left it outside a package, and it works. -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
On Jul 13, 5:19 pm, John Gordon wrote: > In <0730c5fb-3b65-45ce-9cc5-69d639f48...@g2g2000vbl.googlegroups.com> > Adeoluwa Odein writes: > > > if you define the function in the execute() method, it works (as seen > > on the page). But this is a stored procedure already residing on the > > DB. A function/procedure outside of a package, actually works, but > > then you lose access to private data; which is while I used a package. > > Did you try changing RS22 from a procedure to a function inside the > package? > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" Correction, the previous actually works, and still gives me access to private data. So I will most likely use it. Basically, just call a function, outside a package. It resolves this entire dilemma. Implementing similar program in Perl DBI, works without any problem. Python/Jython seem quite difficult to work with Store Procedures, in my opinion. Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
In <0730c5fb-3b65-45ce-9cc5-69d639f48...@g2g2000vbl.googlegroups.com> Adeoluwa Odein writes: > if you define the function in the execute() method, it works (as seen > on the page). But this is a stored procedure already residing on the > DB. A function/procedure outside of a package, actually works, but > then you lose access to private data; which is while I used a package. Did you try changing RS22 from a procedure to a function inside the package? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
On 7/13/2011 4:33 PM, Adeoluwa Odein wrote: The same error. The sample were found on the following site --I copied exactly what is written there: 1. http://www.jython.org/archive/21/docs/zxjdbc.html The jython-users mailing list might be a better place to ask your question. Most people here are CPython users. http://sourceforge.net/mail/?group_id=12867 -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
On Jul 13, 5:02 pm, John Gordon wrote: > In <86b9e6f2-e18e-41b9-92a2-86ea8d7b4...@f35g2000vbr.googlegroups.com> > Adeoluwa Odein writes: > > > The same error. The sample were found on the following site --I copied > > exactly what is written there: > > 1.http://www.jython.org/archive/21/docs/zxjdbc.html > if you define the function in the execute() method, it works (as seen on the page). But this is a stored procedure already residing on the DB. A function/procedure outside of a package, actually works, but then you lose access to private data; which is while I used a package. > Ah, I see. You're supposed to call c.fetchall() afterwards to retrieve > the OUT parameter. > > Also, the example page defines the called object as a function, not a > procedure. Maybe that's the problem? Try defining RS22 as a function > and see if that helps. > > You might also try defining it outside of a package, as that is how the > example code does it. > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
In <86b9e6f2-e18e-41b9-92a2-86ea8d7b4...@f35g2000vbr.googlegroups.com> Adeoluwa Odein writes: > The same error. The sample were found on the following site --I copied > exactly what is written there: > 1. http://www.jython.org/archive/21/docs/zxjdbc.html Ah, I see. You're supposed to call c.fetchall() afterwards to retrieve the OUT parameter. Also, the example page defines the called object as a function, not a procedure. Maybe that's the problem? Try defining RS22 as a function and see if that helps. You might also try defining it outside of a package, as that is how the example code does it. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
On Jul 13, 4:09 pm, John Gordon wrote: > > It's taking an OUT parameter.. I'm just following the examples as > > documented by zxJDBC. How can I fix it? > > I suspect the example you're looking at was for a procedure which has no > arguments, so in that case it would make sense to pass an empty parameter > list. > > I haven't worked with OUT parameters so I don't know if this will work, > but try it and see what happens: > > my_string = "" > p = [my_string] > c.callproc('c2_pkg.RS22', p); > print p > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" The same error. The sample were found on the following site --I copied exactly what is written there: 1. http://www.jython.org/archive/21/docs/zxjdbc.html -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
> It's taking an OUT parameter.. I'm just following the examples as > documented by zxJDBC. How can I fix it? I suspect the example you're looking at was for a procedure which has no arguments, so in that case it would make sense to pass an empty parameter list. I haven't worked with OUT parameters so I don't know if this will work, but try it and see what happens: my_string = "" p = [my_string] c.callproc('c2_pkg.RS22', p); print p -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
On Jul 13, 2:26 pm, John Gordon wrote: > In > Adeoluwa Odein writes: > > > The actual jython/python call is: > > p =3D [None] > > c.callproc('c2_pkg.RS22', p); > > I used a placeholder initially; now that you have the SQL code, there > > it is. It essentially invokes the stored procedure, and it should > > return the OUT variable p, with some value. It doesn't have to be a > > cursor fetch; even a minor text assignment. > > That procedure is defined as taking one parameter, but you're passing > an empty parameter list. Why? > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" I'm new to jython... -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
On Jul 13, 2:26 pm, John Gordon wrote: > In > Adeoluwa Odein writes: > > > The actual jython/python call is: It's taking an OUT parameter.. I'm just following the examples as documented by zxJDBC. How can I fix it? > > p =3D [None] > > c.callproc('c2_pkg.RS22', p); > > I used a placeholder initially; now that you have the SQL code, there > > it is. It essentially invokes the stored procedure, and it should > > return the OUT variable p, with some value. It doesn't have to be a > > cursor fetch; even a minor text assignment. > > That procedure is defined as taking one parameter, but you're passing > an empty parameter list. Why? > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
In Adeoluwa Odein writes: > The actual jython/python call is: > p =3D [None] > c.callproc('c2_pkg.RS22', p); > I used a placeholder initially; now that you have the SQL code, there > it is. It essentially invokes the stored procedure, and it should > return the OUT variable p, with some value. It doesn't have to be a > cursor fetch; even a minor text assignment. That procedure is defined as taking one parameter, but you're passing an empty parameter list. Why? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
The actual jython/python call is: p = [None] c.callproc('c2_pkg.RS22', p); I used a placeholder initially; now that you have the SQL code, there it is. It essentially invokes the stored procedure, and it should return the OUT variable p, with some value. It doesn't have to be a cursor fetch; even a minor text assignment. On Jul 13, 2:10 pm, John Gordon wrote: > In <9e937261-d05d-477a-90d2-a690e85e1...@h17g2000yqn.googlegroups.com> > Adeoluwa Odein writes: > > > Thanks, your assistance will be greatly appreciated on the right way > > forward. See the Stored Procedure Below -very simple: > > I don't see a procedure named "pkg1_returns", which is the prodecure > called by your code. Where is this procedure? > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
In <9e937261-d05d-477a-90d2-a690e85e1...@h17g2000yqn.googlegroups.com> Adeoluwa Odein writes: > Thanks, your assistance will be greatly appreciated on the right way > forward. See the Stored Procedure Below -very simple: I don't see a procedure named "pkg1_returns", which is the prodecure called by your code. Where is this procedure? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
Thanks, your assistance will be greatly appreciated on the right way forward. See the Stored Procedure Below -very simple: create or replace package c2_pkg as procedure openc; procedure closec; procedure RS22(v out varchar); end; / create or replace package body c2_pkg as v_first_time boolean := TRUE; v_cursor number; cursor srvr_cur is select distinct b.mid from SVR a,VAR b where a.mid = b.mid; procedure openc as begin if not srvr_cur%ISOPEN then open srvr_cur; end if; end openc; procedure closec as begin close srvr_cur; end closec; procedure RS22(v out varchar2) as -- Server varchar2(64); begin Server := NULL; fetch srvr_cur into Server; v := Server; end RS22; end; / On Jul 13, 1:40 pm, John Gordon wrote: > In <01efb6ac-deaa-4bdb-8b2d-b603bddde...@n5g2000yqh.googlegroups.com> > Adeoluwa Odein writes: > > > Hello > > I am using the zxJDBC package with jython (similar to python), and I > > am having "python error PLS-00306: wrong number or types of arguments" > > error when using the "callproc()" method to execute a stored > > procedure. > > The Oracle stored procedure takes a single OUT varchar2 parameter. My > > code is as follows: > > p = [None] > > c.callproc('pkg1_returns', p); > > If the procedure takes a varchar2 parameter, why are you passing [None]? > > It might help if you posted the method signature of the Oracle stored > procedure you're trying to call. > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: python error PLS-00306: wrong number or types of arguments in
In <01efb6ac-deaa-4bdb-8b2d-b603bddde...@n5g2000yqh.googlegroups.com> Adeoluwa Odein writes: > Hello > I am using the zxJDBC package with jython (similar to python), and I > am having "python error PLS-00306: wrong number or types of arguments" > error when using the "callproc()" method to execute a stored > procedure. > The Oracle stored procedure takes a single OUT varchar2 parameter. My > code is as follows: > p = [None] > c.callproc('pkg1_returns', p); If the procedure takes a varchar2 parameter, why are you passing [None]? It might help if you posted the method signature of the Oracle stored procedure you're trying to call. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
En Wed, 08 Jul 2009 06:35:54 -0300, Dave Angel escribió: Gabriel Genellina wrote: Jul 2009 09:55:13 -0300, Dave Angel escribió: Gabriel Genellina wrote: En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 escribió: When I try to run the command as outlined in the book "simple_markup2.py < test_input.txt > test_output.html i get the following error every time. IOError: [Errno 9] Bad file descriptor I think the error depends on the specific OS version/service pack. But at least on XP this appears to fix it: http://support.microsoft.com/kb/321788/en-us Thanks for the link. Looking at that one, it indicates that Windows 2000 fixed it in SP4, and XP fixed it in Sp1. But I'm already running XP SP3, so I wonder if it's something new. I'm using XP SP3 too. Before applying the registry fix, stdout and stderr were working fine, but not stdin. After making the registry change, stdin works too. I didn't notice the issue with stdin until now (I don't use stdin very often) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
I'm running XP SP3. The program now works great from either of the directories, as long as include 'python' before it. As far as looking at the error with stack trace, I really don't know enough yet to know how to do that. I'm running the file from command line, because I'm not sure how to run it referencing other files from idle. Lot to learn. Once again, thanks a ton for all of the help. Matt On Wed, Jul 8, 2009 at 2:35 AM, Dave Angel wrote: > > > Gabriel Genellina wrote: > >> En Tue, 07 >> Jul 2009 09:55:13 -0300, Dave Angel escribió: >> >>> Gabriel Genellina wrote: >>> En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 escribió: >>> >> When I try to run the command as outlined in > the book "simple_markup2.py < test_input.txt > test_output.html i get > the > following error every time. > > IOError: [Errno 9] Bad file descriptor > That's a Windows problem. When you execute the script as itself (either as you do in the command line, or by double-clicking on it), it doesn't have valid standard handles. You have to invoke Python explicitely: python simple_markup2.py < test_input.txt > test_output.html (you may need to specify the full path to python.exe, or add the directory where Python is installed to your system PATH). I use stdout this way all the time, with no problem (python 2.6, >>> Windows XP). But as you point out, stdin redirection doesn't seem to work >>> using the file associations. I do get a different error though. When I look >>> at sys.stdin, it shows an open file, with handle of zero, as expected. But >>> when I do a raw_input(), it gets: >>> EOFError: EOF when reading a line >>> >> >> I think the error depends on the specific OS version/service pack. But at >> least on XP this appears to fix it: >> >> http://support.microsoft.com/kb/321788/en-us >> >> Thanks for the link. Looking at that one, it indicates that Windows 2000 > fixed it in SP4, and XP fixed it in Sp1. But I'm already running XP SP3, so > I wonder if it's something new. > > Matt, what OS version are you running, and exactly what is happening when > the error occurs? (you should be able to figure that out from the stack > trace) > > > DaveA > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
Gabriel Genellina wrote: En Tue, 07 Jul 2009 09:55:13 -0300, Dave Angel escribió: Gabriel Genellina wrote: En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 escribió: When I try to run the command as outlined in the book "simple_markup2.py < test_input.txt > test_output.html i get the following error every time. IOError: [Errno 9] Bad file descriptor That's a Windows problem. When you execute the script as itself (either as you do in the command line, or by double-clicking on it), it doesn't have valid standard handles. You have to invoke Python explicitely: python simple_markup2.py < test_input.txt > test_output.html (you may need to specify the full path to python.exe, or add the directory where Python is installed to your system PATH). I use stdout this way all the time, with no problem (python 2.6, Windows XP). But as you point out, stdin redirection doesn't seem to work using the file associations. I do get a different error though. When I look at sys.stdin, it shows an open file, with handle of zero, as expected. But when I do a raw_input(), it gets: EOFError: EOF when reading a line I think the error depends on the specific OS version/service pack. But at least on XP this appears to fix it: http://support.microsoft.com/kb/321788/en-us Thanks for the link. Looking at that one, it indicates that Windows 2000 fixed it in SP4, and XP fixed it in Sp1. But I'm already running XP SP3, so I wonder if it's something new. Matt, what OS version are you running, and exactly what is happening when the error occurs? (you should be able to figure that out from the stack trace) DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
En Tue, 07 Jul 2009 09:55:13 -0300, Dave Angel escribió: Gabriel Genellina wrote: En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 escribió: When I try to run the command as outlined in the book "simple_markup2.py < test_input.txt > test_output.html i get the following error every time. IOError: [Errno 9] Bad file descriptor That's a Windows problem. When you execute the script as itself (either as you do in the command line, or by double-clicking on it), it doesn't have valid standard handles. You have to invoke Python explicitely: python simple_markup2.py < test_input.txt > test_output.html (you may need to specify the full path to python.exe, or add the directory where Python is installed to your system PATH). I use stdout this way all the time, with no problem (python 2.6, Windows XP). But as you point out, stdin redirection doesn't seem to work using the file associations. I do get a different error though. When I look at sys.stdin, it shows an open file, with handle of zero, as expected. But when I do a raw_input(), it gets: EOFError: EOF when reading a line I think the error depends on the specific OS version/service pack. But at least on XP this appears to fix it: http://support.microsoft.com/kb/321788/en-us -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
Matthew Edmondson wrote: Thanks a ton for the help. At first adding the path didn't work, but after restarting my computer, ran like a champ :) Hopefully I can get decent with this language one day! All you needed was to restart the DOS-box (Command Prompt), after you did the control-panel thing. Those changes don't affect currently running processes. . By the way, those "standalone executables" could very well be python scripts. Except for input redirection, all my single-file scripts work fine stored there. And if you add .py and .pyw to the PATHEXT environment variable, you can run them without extension, so they're pretty much interchangeable with .exe files. So I have a script called digest.py, and I run it from a directory I want to analyze, by just typing digest . -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
matt0177 wrote: Adding the python before the command line didn't work at first, but upon moving the files to the c:\python25 it worked like a champ. Thank you both for the help. Very frustrating to run into stuff like this when you're first trying to learn a knew language, it really throws off your momentum! I'm glad you got things working. But you really shouldn't need to add your own files to the installation directory. What you need is straightforward, but the details are Windows specific The following is all at the command prompt, not inside Python. You have a PATH environment variable, with various directories on it. Type it out using the PATH command. Pick a location on it, and add a batch file we'll write below. It's also possible to add a new directory to the PATH, using the control panel. Normally, the first thing I do on a new machine is add two directories to the PATH, perhaps c:\bin and c:\bat. The former is for the simple one-file utilities you accumulate over the years, and the latter is for batch files. If you want to pursue this, let me know, and I'll give details. Now that you've picked a location for your batch file, let's create it, calling it Python25.bat You could just call it Python.bat, but this way, you can have more than one Python installed, and choose between them. The contents of Python25.bat are a single line: @c:\python25\python.exe %* The leading @ says we don't wan the line echoed to the screen. If you're unsure of yourself, you can leave it off till everything works well, then add it in. The %* says to copy all the arguments you pass the batch file into the executable. Once this batch file is stored in your PATH, you can just type something like: python25 myscript.py arg1 arg2 or, to run the interpreter itself, python25 DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
Adding the python before the command line didn't work at first, but upon moving the files to the c:\python25 it worked like a champ. Thank you both for the help. Very frustrating to run into stuff like this when you're first trying to learn a knew language, it really throws off your momentum! -- View this message in context: http://www.nabble.com/Python-Error-from-Apress-book-tp24364269p24374988.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
Gabriel Genellina wrote: En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 escribió: When I try to run the command as outlined in the book "simple_markup2.py < test_input.txt > test_output.html i get the following error every time. IOError: [Errno 9] Bad file descriptor That's a Windows problem. When you execute the script as itself (either as you do in the command line, or by double-clicking on it), it doesn't have valid standard handles. You have to invoke Python explicitely: python simple_markup2.py < test_input.txt > test_output.html (you may need to specify the full path to python.exe, or add the directory where Python is installed to your system PATH). I use stdout this way all the time, with no problem (python 2.6, Windows XP). But as you point out, stdin redirection doesn't seem to work using the file associations. I do get a different error though. When I look at sys.stdin, it shows an open file, with handle of zero, as expected. But when I do a raw_input(), it gets: EOFError: EOF when reading a line -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error from Apress book
En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 escribió: When I try to run the command as outlined in the book "simple_markup2.py < test_input.txt > test_output.html i get the following error every time. IOError: [Errno 9] Bad file descriptor That's a Windows problem. When you execute the script as itself (either as you do in the command line, or by double-clicking on it), it doesn't have valid standard handles. You have to invoke Python explicitely: python simple_markup2.py < test_input.txt > test_output.html (you may need to specify the full path to python.exe, or add the directory where Python is installed to your system PATH). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error on Mac
Clover wrote: > When trying to do some things on my Mac (starting Lyx, compiling Latex > via TextMate) I get this error: > > python: execv: > /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: > > No such file or directory > > I (and people on Lyx and TextMate lists) are at a complete loss as to > why this is happening. I didn't (at least intentionally) fiddle with > Python setup. > > Thanks! what is the output of 'which python' - this should show what python executable is running: [EMAIL PROTECTED] jloden]$ which python /Library/Frameworks/Python.framework/Versions/Current/bin/python You should then check the output of ls -l agains the value of the above: [EMAIL PROTECTED] jloden]$ ls -l /Library/Frameworks/Python.framework/Versions/Current/bin/python lrwxr-xr-x 1 root admin 9 Jul 14 01:53 /Library/Frameworks/Python.framework/Versions/Current/bin/python -> python2.5 That will show what the executable is actually linked to. Other thoughts would be to check if the /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python directory exists, or even if /Library/Frameworks/Python.framework/Versions/2.5/ exists. Perhaps you are trying to execute Python 2.5 but don't actually have it installed? -Jay -- http://mail.python.org/mailman/listinfo/python-list
Re: Python error on Mac
On Aug 26, 12:58 pm, Clover <[EMAIL PROTECTED]> wrote: > When trying to do some things on my Mac (starting Lyx, compiling Latex > via TextMate) I get this error: > > python: execv: > /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: > No such file or directory > > I (and people on Lyx and TextMate lists) are at a complete loss as to > why this is happening. I didn't (at least intentionally) fiddle with > Python setup. The default operating system supplied version of Python on recent versions of MacOS X is 2.3.5. Unless you have specifically installed 2.5, it will not exist. So, if those applications have it hardwired to use Python 2.5 they will not work. Graham -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error :(
On Mar 27, 8:19 am, "Legend" <[EMAIL PROTECTED]> wrote: > I wasn't able to run a Python script. But then later I was able to run > it through the Shell. I was experimenting with cron jobs and set up > the python execution in as a cron. The first time it ran, It was fine > but then after that, it started giving me some errors. Now when I try > to run the script directly, I get the following error: > > Traceback (most recent call last): > File "", line 1, in ? > File "userbot.py", line 637, in ? > con = connect() > File "userbot.py", line 607, in connect > con.requestRoster() > File "user.py", line 531, in requestRoster > self.SendAndWaitForResponse(rost_iq) > File "user.py", line 326, in SendAndWaitForResponse > return self.waitForResponse(ID) > File "user.py", line 300, in waitForResponse > self.process(1) > File "xmlstream.py", line 459, in process > if not len(self.read()): # length of 0 means disconnect > File "xmlstream.py", line 398, in read > data_in=data_in+self._sslObj.read(BLOCK_SIZE).decode('utf-8') > socket.sslerror: (6, 'TLS/SSL connection has been closed') > > Any help please? I'll hazard a guess: Are you opening the socket explicitly when you run this script? If not, be sure to do so. And when you are finished doing whatever it is you're doing, be sure to close it as well. You may need to put in some kind of logic to check if the socket is still open if you are transferring large files. Mike -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error :(
Legend napisał(a): > I wasn't able to run a Python script. But then later I was able to run > it through the Shell. I was experimenting with cron jobs and set up > the python execution in as a cron. The first time it ran, It was fine > but then after that, it started giving me some errors. Now when I try > to run the script directly, I get the following error: > > > > Traceback (most recent call last): > File "", line 1, in ? > File "userbot.py", line 637, in ? > con = connect() > File "userbot.py", line 607, in connect > con.requestRoster() > File "user.py", line 531, in requestRoster > self.SendAndWaitForResponse(rost_iq) > File "user.py", line 326, in SendAndWaitForResponse > return self.waitForResponse(ID) > File "user.py", line 300, in waitForResponse > self.process(1) > File "xmlstream.py", line 459, in process > if not len(self.read()): # length of 0 means disconnect > File "xmlstream.py", line 398, in read > data_in=data_in+self._sslObj.read(BLOCK_SIZE).decode('utf-8') > socket.sslerror: (6, 'TLS/SSL connection has been closed') > > > Any help please? Yes. -- Jarek Zgoda "We read Knuth so you don't have to." -- http://mail.python.org/mailman/listinfo/python-list
Re: python Error: IndentationError: expected an indented block
Please don't post HTML message bodies to a public forum. Antonios Katsikadamos <[EMAIL PROTECTED]> writes: > hi all. I am using python 2.4. I have to run an older python code > and when i run it i get the following message > IndentationError: expected an indented block. > 1)what does this mean? It's self-explanatory. There's an error in the indentation; Python was expecting an indented block, but didn't get one. > 2)how can i overcome this problem Fix the indentation. As you probably know, in Python, indentation is syntactically significant information to both the programmer and to the interpreter. If that information is lost, Python can't know what was meant, and refuses to guess. Probably something has mangled the white-space in the program file. Either fix it manually, or go back to a more canonical form of the file and see if it's been altered. -- \ "I have a large seashell collection, which I keep scattered on | `\the beaches all over the world. Maybe you've seen it." -- | _o__)Steven Wright | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: python Error: IndentationError: expected an indented block
Antonios Katsikadamos пишет: > hi all. I am using python 2.4. I have to run an older python code and when i > run it i get the following message > > IndentationError: expected an indented block. > > 1)what does this mean? http://www.python.org/doc/2.4.3/ref/indentation.html > 2)how can i overcome this problem By syntax fixing > > > Thanks for any advice. > > kind regards, > > Antonios > > - > Sponsored Link > > Free Uniden 5.8GHz Phone System with Packet8 Internet Phone Service > -- http://mail.python.org/mailman/listinfo/python-list