Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WING PYTHON IDE HELP!!!!
#1
I keep getting this error on Wing Python IDE.

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ëH‹5H\000H‹ÖL‹Fÿ @\000H‹ØH‹Ñ\000H‹HH‰ 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.


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)
 
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.
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.
Reply
#2
The error occurred while running this line, which we don't see in the above code.
wind_data = read_wind_records(wind_filename)
Is the filename correct? What are the signature and documentation of read_wind_records() ?
Reply
#3
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 interp.py] Traceback (most recent call last): File "C:\Users\under\OneDrive\Documents\COSC131\interp.py", line 180, in <module> 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\interp.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ëH‹5H\000H‹ÖL‹Fÿ @\000H‹ØH‹Ñ\000H‹HH‰ 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'
Sorry this is it as a stand alone function.

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 

	
# 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)
Reply
#4
(Jun-02-2023, 05:05 AM)nma236 Wrote: Sorry this is it as a stand alone function.

I'm a 'Wing' user and I've run the posted code. There are no issues that I can see:

Output:
[0.0000 0.0000 0.0900 0.1000 0.1250 0.3000 0.3200 0.4075 0.3220 0.3000 0.1600 0.1000 0.0000]
Gribouillis likes this post
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply
#5
(Jun-02-2023, 06:39 AM)rob101 Wrote:
(Jun-02-2023, 05:05 AM)nma236 Wrote: Sorry this is it as a stand alone function.

I'm a 'Wing' user and I've run the posted code. There are no issues that I can see:

Output:
[0.0000 0.0000 0.0900 0.1000 0.1250 0.3000 0.3200 0.4075 0.3220 0.3000 0.1600 0.1000 0.0000]

Thats what im sayin, but I cant get my wing to run it, ill try again tomorrow and see if I can figure out why it doesnt like to run it. Might be one of my saved files or something.
Reply
#6
(Jun-02-2023, 11:00 AM)nma236 Wrote: ... but I cant get my wing to run it

Odd. You can rest assured that it's not a Wing issue: maybe check the Wing environment settings and make sure that it's all setup correctly.
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020