Getting Attribute error when Running code

I have run the below code to fetch the real time current of an storage device and store it to an notepad .Please find the below code:

import time
import joulescope

# Function to measure current using Joulescope
def measure_current(js, duration=180):
    """Measure current for a specified duration and return the highest value."""
    highest_current = 0
    start_time = time.time()
    
    # Configure the Joulescope for continuous sampling
    js.start()
    try:
        while time.time() - start_time < duration:
            data = js.read(duration=0.1)
            current = data['signals']['current']['value'].mean()
            if current > highest_current:
                highest_current = current
            time.sleep(0.1)  # Adjust the sampling rate as needed
    finally:
        js.stop()

    return highest_current

# Function to store data in a notepad
def store_data(file_path, data):
    with open(file_path, 'w') as file:
        file.write(data)

def main():
    # Scan and connect to the Joulescope device
    devices = joulescope.scan()
    if len(devices) == 0:
        print("No Joulescope devices found")
        return
    js = joulescope.Joulescope()
    js.open(devices[0])

    # Assume VccQ pin is connected properly

    # Run a command or test case in Tera Term
    # Assuming Tera Term command is executed outside of this script

    # Measure the current for 3 minutes (180 seconds)
    highest_current = measure_current(js, duration=180)

    # Format the data to be stored
    data = f"Highest VccQ current: {highest_current} A\n"

    # Store the data in a notepad file
    store_data('current_measurement.txt', data)

    # Close the Joulescope
    js.close()

if __name__ == "__main__":
    main()

Getting below error:
js = joulescope.Joulescope()
Attribute error : module ‘joulescope has no attribute‘Joulescope’
and also found some the modules are missing like scan_for_devices,Joulescope,
Tried all possible ways ,but I am unable to resolve .Please suggest me an code where I can fetch the real time current data and store it an excel.

Hi @saiteja, and welcome to the Joulescope forum.

I am not entirely sure what you are trying to do. It looks like the code you provided is confusing the joulescope package and the pyjoulescope_driver package. You can use the pyjoulescope_driver package directly if you want. The joulescope package uses the pyjoulescope_driver package as its backend.

Does this work for you?

python -m pyjoulescope_driver statistics --duration 3m > current_measurement.csv

See the statistics entry point in pyjoulescope_driver for the source code.

This will store 3 minutes of data at 2 Hz to the CSV file, which you can then load in Excel.

For an example of how to use the joulescope package, see the statistics.py example.