prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Profiler error when no filename is passed to it
  Hello!
  
  * Spyder Version: Git version (4dev)
  * Python Version: 3.5
  * Operating system: Arch Linux
  
  When I click on Run > Profile , It produces this error:
  `Traceback (most recent call last):
    File "/usr/lib/python3.5/site-packages/spyder_profiler/profiler.py", line 138, in run_profiler
      self.analyze(self.main.editor.get_current_filename())
    File "/usr/lib/python3.5/site-packages/spyder_profiler/profiler.py", line 155, in analyze
      pythonpath=pythonpath)
  TypeError: analyze() got multiple values for argument 'wdir'`
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `spyder_profiler/profiler.py`
  Content:
  ```
  1 # -*- coding:utf-8 -*-
  2 #
  3 # Copyright © Spyder Project Contributors
  4 # based on p_pylint.py by Pierre Raybaut
  5 #
  6 # Licensed under the terms of the MIT License
  7 # (see spyder/__init__.py for details)
  8 
  9 """Profiler Plugin."""
  10 
  11 # Standard library imports
  12 import os.path as osp
  13 
  14 # Third party imports
  15 from qtpy.QtCore import Qt
  16 from qtpy.QtWidgets import QGroupBox, QLabel, QVBoxLayout
  17 
  18 # Local imports
  19 from spyder.config.base import get_translation
  20 from spyder.api.plugins import SpyderPluginWidget
  21 from spyder.api.preferences import PluginConfigPage
  22 from spyder.plugins.runconfig import get_run_configuration
  23 from spyder.utils import icon_manager as ima
  24 from spyder.utils.qthelpers import create_action
  25 from .widgets.profilergui import (ProfilerWidget, is_profiler_installed)
  26 
  27 
  28 _ = get_translation("profiler", "spyder_profiler")
  29 
  30 
  31 class ProfilerConfigPage(PluginConfigPage):
  32     def setup_page(self):
  33         results_group = QGroupBox(_("Results"))
  34         results_label1 = QLabel(_("Profiler plugin results "
  35                                   "(the output of python's profile/cProfile)\n"
  36                                   "are stored here:"))
  37         results_label1.setWordWrap(True)
  38 
  39         # Warning: do not try to regroup the following QLabel contents with
  40         # widgets above -- this string was isolated here in a single QLabel
  41         # on purpose: to fix Issue 863
  42         results_label2 = QLabel(ProfilerWidget.DATAPATH)
  43 
  44         results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)
  45         results_label2.setWordWrap(True)
  46 
  47         results_layout = QVBoxLayout()
  48         results_layout.addWidget(results_label1)
  49         results_layout.addWidget(results_label2)
  50         results_group.setLayout(results_layout)
  51 
  52         vlayout = QVBoxLayout()
  53         vlayout.addWidget(results_group)
  54         vlayout.addStretch(1)
  55         self.setLayout(vlayout)
  56 
  57 
  58 class Profiler(SpyderPluginWidget):
  59     """Profiler (after python's profile and pstats)."""
  60 
  61     CONF_SECTION = 'profiler'
  62     CONFIGWIDGET_CLASS = ProfilerConfigPage
  63 
  64     def __init__(self, parent=None):
  65         SpyderPluginWidget.__init__(self, parent)
  66 
  67         max_entries = self.get_option('max_entries', 50)
  68         self.profiler = ProfilerWidget(self, max_entries)
  69 
  70         layout = QVBoxLayout()
  71         layout.addWidget(self.profiler)
  72         self.setLayout(layout)
  73 
  74         # Initialize plugin
  75         self.initialize_plugin()
  76         
  77     #------ SpyderPluginWidget API ---------------------------------------------    
  78     def get_plugin_title(self):
  79         """Return widget title"""
  80         return _("Profiler")
  81 
  82     def get_plugin_icon(self):
  83         """Return widget icon"""
  84         path = osp.join(self.PLUGIN_PATH, self.IMG_PATH)
  85         return ima.icon('profiler', icon_path=path)
  86 
  87     def get_focus_widget(self):
  88         """
  89         Return the widget to give focus to when
  90         this plugin's dockwidget is raised on top-level
  91         """
  92         return self.profiler.datatree
  93     
  94     def get_plugin_actions(self):
  95         """Return a list of actions related to plugin"""
  96         return []
  97 
  98     def on_first_registration(self):
  99         """Action to be performed on first plugin registration"""
  100         self.main.tabify_plugins(self.main.help, self)
  101         self.dockwidget.hide()
  102 
  103     def register_plugin(self):
  104         """Register plugin in Spyder's main window"""
  105         self.profiler.datatree.sig_edit_goto.connect(self.main.editor.load)
  106         self.profiler.redirect_stdio.connect(
  107             self.main.redirect_internalshell_stdio)
  108         self.main.add_dockwidget(self)
  109 
  110         profiler_act = create_action(self, _("Profile"),
  111                                      icon=self.get_plugin_icon(),
  112                                      triggered=self.run_profiler)
  113         profiler_act.setEnabled(is_profiler_installed())
  114         self.register_shortcut(profiler_act, context="Profiler",
  115                                name="Run profiler")
  116         
  117         self.main.run_menu_actions += [profiler_act]
  118         self.main.editor.pythonfile_dependent_actions += [profiler_act]
  119 
  120     def refresh_plugin(self):
  121         """Refresh profiler widget"""
  122         #self.remove_obsolete_items()  # FIXME: not implemented yet
  123         
  124     def closing_plugin(self, cancelable=False):
  125         """Perform actions before parent main window is closed"""
  126         return True
  127             
  128     def apply_plugin_settings(self, options):
  129         """Apply configuration file's plugin settings"""
  130         # The history depth option will be applied at 
  131         # next Spyder startup, which is soon enough
  132         pass
  133         
  134     #------ Public API ---------------------------------------------------------        
  135     def run_profiler(self):
  136         """Run profiler"""
  137         if self.main.editor.save():
  138             self.analyze(self.main.editor.get_current_filename())
  139 
  140     def analyze(self, filename):
  141         """Reimplement analyze method"""
  142         if self.dockwidget and not self.ismaximized:
  143             self.dockwidget.setVisible(True)
  144             self.dockwidget.setFocus()
  145             self.dockwidget.raise_()
  146         pythonpath = self.main.get_spyder_pythonpath()
  147         runconf = get_run_configuration(filename)
  148         wdir, args = None, []
  149         if runconf is not None:
  150             if runconf.wdir_enabled:
  151                 wdir = runconf.wdir
  152             if runconf.args_enabled:
  153                 args = runconf.args
  154         self.profiler.analyze(self, filename, wdir=wdir, args=args,
  155                               pythonpath=pythonpath)
  156
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/spyder_profiler/profiler.py b/spyder_profiler/profiler.py
  --- a/spyder_profiler/profiler.py
  +++ b/spyder_profiler/profiler.py
  @@ -151,5 +151,5 @@
                   wdir = runconf.wdir
               if runconf.args_enabled:
                   args = runconf.args
  -        self.profiler.analyze(self, filename, wdir=wdir, args=args,
  +        self.profiler.analyze(filename, wdir=wdir, args=args,
                                 pythonpath=pythonpath)
  
verification_info: {"golden_diff": "diff --git a/spyder_profiler/profiler.py b/spyder_profiler/profiler.py\n--- a/spyder_profiler/profiler.py\n+++ b/spyder_profiler/profiler.py\n@@ -151,5 +151,5 @@\n                 wdir = runconf.wdir\n             if runconf.args_enabled:\n                 args = runconf.args\n-        self.profiler.analyze(self, filename, wdir=wdir, args=args,\n+        self.profiler.analyze(filename, wdir=wdir, args=args,\n                               pythonpath=pythonpath)\n", "issue": "Profiler error when no filename is passed to it\nHello!\r\n\r\n* Spyder Version: Git version (4dev)\r\n* Python Version: 3.5\r\n* Operating system: Arch Linux\r\n\r\nWhen I click on Run > Profile , It produces this error:\r\n`Traceback (most recent call last):\r\n  File \"/usr/lib/python3.5/site-packages/spyder_profiler/profiler.py\", line 138, in run_profiler\r\n    self.analyze(self.main.editor.get_current_filename())\r\n  File \"/usr/lib/python3.5/site-packages/spyder_profiler/profiler.py\", line 155, in analyze\r\n    pythonpath=pythonpath)\r\nTypeError: analyze() got multiple values for argument 'wdir'`\r\n\r\n\n", "before_files": [{"content": "# -*- coding:utf-8 -*-\n#\n# Copyright \u00a9 Spyder Project Contributors\n# based on p_pylint.py by Pierre Raybaut\n#\n# Licensed under the terms of the MIT License\n# (see spyder/__init__.py for details)\n\n\"\"\"Profiler Plugin.\"\"\"\n\n# Standard library imports\nimport os.path as osp\n\n# Third party imports\nfrom qtpy.QtCore import Qt\nfrom qtpy.QtWidgets import QGroupBox, QLabel, QVBoxLayout\n\n# Local imports\nfrom spyder.config.base import get_translation\nfrom spyder.api.plugins import SpyderPluginWidget\nfrom spyder.api.preferences import PluginConfigPage\nfrom spyder.plugins.runconfig import get_run_configuration\nfrom spyder.utils import icon_manager as ima\nfrom spyder.utils.qthelpers import create_action\nfrom .widgets.profilergui import (ProfilerWidget, is_profiler_installed)\n\n\n_ = get_translation(\"profiler\", \"spyder_profiler\")\n\n\nclass ProfilerConfigPage(PluginConfigPage):\n    def setup_page(self):\n        results_group = QGroupBox(_(\"Results\"))\n        results_label1 = QLabel(_(\"Profiler plugin results \"\n                                  \"(the output of python's profile/cProfile)\\n\"\n                                  \"are stored here:\"))\n        results_label1.setWordWrap(True)\n\n        # Warning: do not try to regroup the following QLabel contents with\n        # widgets above -- this string was isolated here in a single QLabel\n        # on purpose: to fix Issue 863\n        results_label2 = QLabel(ProfilerWidget.DATAPATH)\n\n        results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)\n        results_label2.setWordWrap(True)\n\n        results_layout = QVBoxLayout()\n        results_layout.addWidget(results_label1)\n        results_layout.addWidget(results_label2)\n        results_group.setLayout(results_layout)\n\n        vlayout = QVBoxLayout()\n        vlayout.addWidget(results_group)\n        vlayout.addStretch(1)\n        self.setLayout(vlayout)\n\n\nclass Profiler(SpyderPluginWidget):\n    \"\"\"Profiler (after python's profile and pstats).\"\"\"\n\n    CONF_SECTION = 'profiler'\n    CONFIGWIDGET_CLASS = ProfilerConfigPage\n\n    def __init__(self, parent=None):\n        SpyderPluginWidget.__init__(self, parent)\n\n        max_entries = self.get_option('max_entries', 50)\n        self.profiler = ProfilerWidget(self, max_entries)\n\n        layout = QVBoxLayout()\n        layout.addWidget(self.profiler)\n        self.setLayout(layout)\n\n        # Initialize plugin\n        self.initialize_plugin()\n        \n    #------ SpyderPluginWidget API ---------------------------------------------    \n    def get_plugin_title(self):\n        \"\"\"Return widget title\"\"\"\n        return _(\"Profiler\")\n\n    def get_plugin_icon(self):\n        \"\"\"Return widget icon\"\"\"\n        path = osp.join(self.PLUGIN_PATH, self.IMG_PATH)\n        return ima.icon('profiler', icon_path=path)\n\n    def get_focus_widget(self):\n        \"\"\"\n        Return the widget to give focus to when\n        this plugin's dockwidget is raised on top-level\n        \"\"\"\n        return self.profiler.datatree\n    \n    def get_plugin_actions(self):\n        \"\"\"Return a list of actions related to plugin\"\"\"\n        return []\n\n    def on_first_registration(self):\n        \"\"\"Action to be performed on first plugin registration\"\"\"\n        self.main.tabify_plugins(self.main.help, self)\n        self.dockwidget.hide()\n\n    def register_plugin(self):\n        \"\"\"Register plugin in Spyder's main window\"\"\"\n        self.profiler.datatree.sig_edit_goto.connect(self.main.editor.load)\n        self.profiler.redirect_stdio.connect(\n            self.main.redirect_internalshell_stdio)\n        self.main.add_dockwidget(self)\n\n        profiler_act = create_action(self, _(\"Profile\"),\n                                     icon=self.get_plugin_icon(),\n                                     triggered=self.run_profiler)\n        profiler_act.setEnabled(is_profiler_installed())\n        self.register_shortcut(profiler_act, context=\"Profiler\",\n                               name=\"Run profiler\")\n        \n        self.main.run_menu_actions += [profiler_act]\n        self.main.editor.pythonfile_dependent_actions += [profiler_act]\n\n    def refresh_plugin(self):\n        \"\"\"Refresh profiler widget\"\"\"\n        #self.remove_obsolete_items()  # FIXME: not implemented yet\n        \n    def closing_plugin(self, cancelable=False):\n        \"\"\"Perform actions before parent main window is closed\"\"\"\n        return True\n            \n    def apply_plugin_settings(self, options):\n        \"\"\"Apply configuration file's plugin settings\"\"\"\n        # The history depth option will be applied at \n        # next Spyder startup, which is soon enough\n        pass\n        \n    #------ Public API ---------------------------------------------------------        \n    def run_profiler(self):\n        \"\"\"Run profiler\"\"\"\n        if self.main.editor.save():\n            self.analyze(self.main.editor.get_current_filename())\n\n    def analyze(self, filename):\n        \"\"\"Reimplement analyze method\"\"\"\n        if self.dockwidget and not self.ismaximized:\n            self.dockwidget.setVisible(True)\n            self.dockwidget.setFocus()\n            self.dockwidget.raise_()\n        pythonpath = self.main.get_spyder_pythonpath()\n        runconf = get_run_configuration(filename)\n        wdir, args = None, []\n        if runconf is not None:\n            if runconf.wdir_enabled:\n                wdir = runconf.wdir\n            if runconf.args_enabled:\n                args = runconf.args\n        self.profiler.analyze(self, filename, wdir=wdir, args=args,\n                              pythonpath=pythonpath)\n", "path": "spyder_profiler/profiler.py"}], "after_files": [{"content": "# -*- coding:utf-8 -*-\n#\n# Copyright \u00a9 Spyder Project Contributors\n# based on p_pylint.py by Pierre Raybaut\n#\n# Licensed under the terms of the MIT License\n# (see spyder/__init__.py for details)\n\n\"\"\"Profiler Plugin.\"\"\"\n\n# Standard library imports\nimport os.path as osp\n\n# Third party imports\nfrom qtpy.QtCore import Qt\nfrom qtpy.QtWidgets import QGroupBox, QLabel, QVBoxLayout\n\n# Local imports\nfrom spyder.config.base import get_translation\nfrom spyder.api.plugins import SpyderPluginWidget\nfrom spyder.api.preferences import PluginConfigPage\nfrom spyder.plugins.runconfig import get_run_configuration\nfrom spyder.utils import icon_manager as ima\nfrom spyder.utils.qthelpers import create_action\nfrom .widgets.profilergui import (ProfilerWidget, is_profiler_installed)\n\n\n_ = get_translation(\"profiler\", \"spyder_profiler\")\n\n\nclass ProfilerConfigPage(PluginConfigPage):\n    def setup_page(self):\n        results_group = QGroupBox(_(\"Results\"))\n        results_label1 = QLabel(_(\"Profiler plugin results \"\n                                  \"(the output of python's profile/cProfile)\\n\"\n                                  \"are stored here:\"))\n        results_label1.setWordWrap(True)\n\n        # Warning: do not try to regroup the following QLabel contents with\n        # widgets above -- this string was isolated here in a single QLabel\n        # on purpose: to fix Issue 863\n        results_label2 = QLabel(ProfilerWidget.DATAPATH)\n\n        results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)\n        results_label2.setWordWrap(True)\n\n        results_layout = QVBoxLayout()\n        results_layout.addWidget(results_label1)\n        results_layout.addWidget(results_label2)\n        results_group.setLayout(results_layout)\n\n        vlayout = QVBoxLayout()\n        vlayout.addWidget(results_group)\n        vlayout.addStretch(1)\n        self.setLayout(vlayout)\n\n\nclass Profiler(SpyderPluginWidget):\n    \"\"\"Profiler (after python's profile and pstats).\"\"\"\n\n    CONF_SECTION = 'profiler'\n    CONFIGWIDGET_CLASS = ProfilerConfigPage\n\n    def __init__(self, parent=None):\n        SpyderPluginWidget.__init__(self, parent)\n\n        max_entries = self.get_option('max_entries', 50)\n        self.profiler = ProfilerWidget(self, max_entries)\n\n        layout = QVBoxLayout()\n        layout.addWidget(self.profiler)\n        self.setLayout(layout)\n\n        # Initialize plugin\n        self.initialize_plugin()\n        \n    #------ SpyderPluginWidget API ---------------------------------------------    \n    def get_plugin_title(self):\n        \"\"\"Return widget title\"\"\"\n        return _(\"Profiler\")\n\n    def get_plugin_icon(self):\n        \"\"\"Return widget icon\"\"\"\n        path = osp.join(self.PLUGIN_PATH, self.IMG_PATH)\n        return ima.icon('profiler', icon_path=path)\n\n    def get_focus_widget(self):\n        \"\"\"\n        Return the widget to give focus to when\n        this plugin's dockwidget is raised on top-level\n        \"\"\"\n        return self.profiler.datatree\n    \n    def get_plugin_actions(self):\n        \"\"\"Return a list of actions related to plugin\"\"\"\n        return []\n\n    def on_first_registration(self):\n        \"\"\"Action to be performed on first plugin registration\"\"\"\n        self.main.tabify_plugins(self.main.help, self)\n        self.dockwidget.hide()\n\n    def register_plugin(self):\n        \"\"\"Register plugin in Spyder's main window\"\"\"\n        self.profiler.datatree.sig_edit_goto.connect(self.main.editor.load)\n        self.profiler.redirect_stdio.connect(\n            self.main.redirect_internalshell_stdio)\n        self.main.add_dockwidget(self)\n\n        profiler_act = create_action(self, _(\"Profile\"),\n                                     icon=self.get_plugin_icon(),\n                                     triggered=self.run_profiler)\n        profiler_act.setEnabled(is_profiler_installed())\n        self.register_shortcut(profiler_act, context=\"Profiler\",\n                               name=\"Run profiler\")\n        \n        self.main.run_menu_actions += [profiler_act]\n        self.main.editor.pythonfile_dependent_actions += [profiler_act]\n\n    def refresh_plugin(self):\n        \"\"\"Refresh profiler widget\"\"\"\n        #self.remove_obsolete_items()  # FIXME: not implemented yet\n        \n    def closing_plugin(self, cancelable=False):\n        \"\"\"Perform actions before parent main window is closed\"\"\"\n        return True\n            \n    def apply_plugin_settings(self, options):\n        \"\"\"Apply configuration file's plugin settings\"\"\"\n        # The history depth option will be applied at \n        # next Spyder startup, which is soon enough\n        pass\n        \n    #------ Public API ---------------------------------------------------------        \n    def run_profiler(self):\n        \"\"\"Run profiler\"\"\"\n        if self.main.editor.save():\n            self.analyze(self.main.editor.get_current_filename())\n\n    def analyze(self, filename):\n        \"\"\"Reimplement analyze method\"\"\"\n        if self.dockwidget and not self.ismaximized:\n            self.dockwidget.setVisible(True)\n            self.dockwidget.setFocus()\n            self.dockwidget.raise_()\n        pythonpath = self.main.get_spyder_pythonpath()\n        runconf = get_run_configuration(filename)\n        wdir, args = None, []\n        if runconf is not None:\n            if runconf.wdir_enabled:\n                wdir = runconf.wdir\n            if runconf.args_enabled:\n                args = runconf.args\n        self.profiler.analyze(filename, wdir=wdir, args=args,\n                              pythonpath=pythonpath)\n", "path": "spyder_profiler/profiler.py"}]}