Jun-02-2023, 04:18 AM
(This post was last modified: Jun-02-2023, 04:40 AM by Gribouillis.)
I keep getting this error on Wing Python IDE.
This is the code I am trying to run.
It runs and works perfectly, just not in Wing. I am really stuck as to what is wrong.
I have tried updating numpy installation, resetting the shell many times, chatGPT, nothing seems to help.
Error:Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
Type "help", "copyright", "credits" or "license" for more information.
[evaluate assignment2.py]
Traceback (most recent call last):
File "C:\Users\under\OneDrive\Documents\COSC131\assignment2.py", line 180, in <module>
wind_data = read_wind_records(wind_filename)
builtins.TypeError: _interp_dispatcher() missing 1 required positional argument: 'fp'
During handling of the above exception, another exception was raised:
Traceback (most recent call last):
File "C:\Users\under\OneDrive\Documents\COSC131\assignment2.py", line 1, in <module>
# Used internally for debug sandbox under external interpreter
File "c:\users\under\appdata\roaming\python\python311\site-packages\numpy\__init__.py", line 152, in <module>
from . import random
File "c:\users\under\appdata\roaming\python\python311\site-packages\numpy\random\__init__.py", line 180, in <module>
from . import _pickle
File "c:\users\under\appdata\roaming\python\python311\site-packages\numpy\random\_pickle.py", line 1, in <module>
from .mtrand import RandomState
File "c:\users\under\appdata\roaming\python\python311\site-packages\numpy\random\mtrand.cp311-win_amd64.pyd", line 1, in init numpy.random.mtrand
MZ\000\000\000\000\000\000\000ÿÿ\000\000¸\000\000\000\000\000\000\000@\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000º\000´ Í!¸LÍ!This program cannot be run in DOS mode.
File "c:\users\under\appdata\roaming\python\python311\site-packages\numpy\random\bit_generator.cp311-win_amd64.pyd", line 38, in init numpy.random.bit_generator
ä@\000H%g\000LÆH ÿ>\000ëH5H\000HÖLFÿ@\000HØHÑ\000HHH
File "c:\users\under\appdata\local\programs\python\python311\lib\secrets.py", line 2, in <module>
print (np.interp([0, 1, 2], [0, 1, 2]))
File "<__array_function__ internals>", line 198, in interp
builtins.TypeError: interp() missing 1 required positional argument: 'fp'
This is the code I am trying to run.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import numpy as np def interpolated_efficiencies(turbine_data, speed_readings): """takes numpy array of turbine data and speed readings and returns list of effeciencies""" turbine_data = turbine_data[turbine_data[:, 0 ].argsort()] speeds = turbine_data[:, 0 ] efficiencies = turbine_data[:, 1 ] interpolated = np.interp(speed_readings, speeds, efficiencies, left = 0 , right = 0 ) return interpolated The input code is this: # simple example turbine_data = np.array([[ 2 , 0 ], [ 3 , 0.1 ], [ 4 , 0.2 ], [ 5 , 0.4 ], [ 6 , 0.41 ], [ 7 , 0.3 ], [ 8 , 0.1 ]]) speed_readings = np.array([ 1 , 2 , 2.9 , 3 , 3.25 , 4.5 , 4.6 , 5.75 , 6.8 , 7 , 7.7 , 8 , 9 ]) efficiencies = interpolated_efficiencies(turbine_data, speed_readings) np.set_printoptions(precision = 4 , floatmode = 'fixed' , suppress = True , linewidth = 8 ) print (efficiencies) |
I have tried updating numpy installation, resetting the shell many times, chatGPT, nothing seems to help.
Gribouillis write Jun-02-2023, 04:40 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.