TypeError:参数“ dictionary”有多个值

时间:2018-09-15 19:21:22

标签: python python-3.x typeerror lda

我更早地阅读了另一个被问到有关此错误的问题。但是,我仍未弄错我在哪里。当我调用该函数时,我遇到了此错误。我是这个论坛的新手,希望能帮助您解决我的问题。这是我的代码

        private string MyDirectory()
   {
        return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
   }

当我通过使用以下代码在main中调用此函数时:

var dir = AppDomain.CurrentDomain.BaseDirectory;

我收到一条错误消息:

   private void btn_backup_db_Click(object sender, RoutedEventArgs e)
    {

        var ofd1 = new Microsoft.Win32.SaveFileDialog();
        ofd1.Filter = "Database Files (*.db)|*.db";
        ofd1.FileName = "database";
            // customize file dialog properties here

            if (ofd1.ShowDialog() == true)
            {

            var path = Path.GetFullPath(ofd1.FileName);
            var destinationCnx = "Data Source=" + path + "; Version=3;";
            using (var source = new SQLiteConnection("Data Source=database.db; Version=3;"))
            using (var destination = new SQLiteConnection(destinationCnx))
            {
                source.Open();
                destination.Open();
                source.BackupDatabase(destination, "main", "main", -1, null, 0);
            }
            }
        else
        {
            MessageBox.Show("Error");
        }
    }

1 个答案:

答案 0 :(得分:3)

TL; DR

更改

def compute_coherence_values(dictionary, corpus, documents, limit, start=2, step=3)

def compute_coherence_values(self, dictionary, corpus, documents, limit, start=2, step=3)


您忘记将self作为第一个参数传递,因此实例作为dictionary参数被传递,但是您也将dictionary作为显式关键字参数传递。

这种行为很容易重现:

class Foo:
   def bar(a):
       pass

Foo().bar(a='a')
TypeError: bar() got multiple values for argument 'a'