TypeError:__init __()接受1个位置参数,但在python中给出了2个

时间:2019-12-30 09:21:11

标签: python

我正在使用Python进行强化学习,以制造自动驾驶汽车。并在我的环境文件中发生错误:

<script src="_framework/blazor.server.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key={{put-your-api-key}}&v=3"></script>
<script>
    function initialize() {
        var latlng = new google.maps.LatLng(40.716948, -74.003563);
        var options = {
            zoom: 14, center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById
            ("map"), options);
    }   
</script>

以下是CarEnv类的代码:

@page "/MapTest"
@inject IJSRuntime JSRuntime

<h1>Display Google Map</h1>
<div id="map" style="height:500px;width:100%;">
</div>

@code{

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            await JSRuntime.InvokeVoidAsync("initialize", null);
            StateHasChanged();
        }

    }
}

CarMotor类的以下代码:

File "/home/ubilab/xiaor-drive/autodrive/car_env.py", line 31, in __init__
self.motor = CarMotor(CAR_INSTANCE)
TypeError: __init__() takes 1 positional argument but 2 were given

如您所见,我已经阅读了所有常见的错误,并添加了

CAR_INSTANCE = 'xiaor'

class CarEnv:

    def __init__(self, args, outputDir):
        super(CarEnv, self).__init__()
        self.outputDir = outputDir

        if CAR_INSTANCE == 'hjduino':  # hjduino car has camera upside down, 2 is flip method
            self.camera = CarCamera(2)
        else:
            self.camera = CarCamera()
        self.motor = CarMotor(CAR_INSTANCE)
        self.sensor = CarSensor(CAR_INSTANCE)
        self.step_frames = args.frame

但仍然是相同的错误。

谢谢您的回答!

0 个答案:

没有答案
相关问题