Exception adding note but no track from track dialog #160

Closed
opened 2023-01-16 12:01:05 +00:00 by kae · 0 comments
Owner
File "/home/kae/mm/app/musicmuster.py", line 1601, in add_selected_and_close
    1598  def add_selected_and_close(self) -> None:
    1599      """Handle Add and Close button"""
    1600  
--> 1601      self.add_selected()
    1602      self.accept()
    ..................................................
     self = <__main__.DbDialog object at 0x7fccfd6915e0>
     self.add_selected = <method 'DbDialog.add_selected' of <__main__.DbDialog object
                           at 0x7fccfd6915e0> musicmuster.py:1585>
    ..................................................

File "/home/kae/mm/app/musicmuster.py", line 1596, in add_selected
    1585  def add_selected(self) -> None:
(...)
    1592      track = None
    1593      item = self.ui.matchList.currentItem()
    1594      if item:
    1595          track = item.data(Qt.UserRole)
--> 1596      self.add_track(track)
    ..................................................
     self = <__main__.DbDialog object at 0x7fccfd6915e0>
     track = None
     item = None
     item.data = # AttributeError
          item = None
     Qt.UserRole = 256
     self.add_track = <method 'DbDialog.add_track' of <__main__.DbDialog object at
                        0x7fccfd6915e0> musicmuster.py:1604>
    ..................................................

File "/home/kae/mm/app/musicmuster.py", line 1612, in add_track
    1604  def add_track(self, track: Tracks) -> None:
(...)
    1608          self.ui.track = track
    1609          self.accept()
    1610          return
    1611  
--> 1612      self.parent().visible_playlist_tab().insert_track(
    1613          self.session, track, note=self.ui.txtNote.text())
    ..................................................
     self = <__main__.DbDialog object at 0x7fccfd6915e0>
     track = None
     self.ui.track = None
    ..................................................

File "/home/kae/mm/app/playlists.py", line 683, in insert_track
    671  def insert_track(self, session: scoped_session, track: Tracks,
    672                   note: str = None, repaint: bool = True) -> None:
(...)
    679      We simply build a PlaylistRows object and pass it to insert_row()
    680      to do the heavy lifing.
    681      """
    682  
--> 683      if not track and track.id:
    684          log.debug(
    ..................................................
     self = <PlaylistTab(id=82>
     track = None
     note = 'black is black'
     repaint = True
     track.id = # AttributeError
          track = None
     log.debug = <method 'Logger.debug' of <Logger musicmuster (DEBUG)> __ini
                  t__.py:1420>
    ..................................................

---- (full traceback above) ----
File "/home/kae/mm/app/musicmuster.py", line 1601, in add_selected_and_close
    self.add_selected()
File "/home/kae/mm/app/musicmuster.py", line 1596, in add_selected
    self.add_track(track)
File "/home/kae/mm/app/musicmuster.py", line 1612, in add_track
    self.parent().visible_playlist_tab().insert_track(
File "/home/kae/mm/app/playlists.py", line 683, in insert_track
    if not track and track.id:

AttributeError: 'NoneType' object has no attribute 'id'
``` File "/home/kae/mm/app/musicmuster.py", line 1601, in add_selected_and_close 1598 def add_selected_and_close(self) -> None: 1599 """Handle Add and Close button""" 1600 --> 1601 self.add_selected() 1602 self.accept() .................................................. self = <__main__.DbDialog object at 0x7fccfd6915e0> self.add_selected = <method 'DbDialog.add_selected' of <__main__.DbDialog object at 0x7fccfd6915e0> musicmuster.py:1585> .................................................. File "/home/kae/mm/app/musicmuster.py", line 1596, in add_selected 1585 def add_selected(self) -> None: (...) 1592 track = None 1593 item = self.ui.matchList.currentItem() 1594 if item: 1595 track = item.data(Qt.UserRole) --> 1596 self.add_track(track) .................................................. self = <__main__.DbDialog object at 0x7fccfd6915e0> track = None item = None item.data = # AttributeError item = None Qt.UserRole = 256 self.add_track = <method 'DbDialog.add_track' of <__main__.DbDialog object at 0x7fccfd6915e0> musicmuster.py:1604> .................................................. File "/home/kae/mm/app/musicmuster.py", line 1612, in add_track 1604 def add_track(self, track: Tracks) -> None: (...) 1608 self.ui.track = track 1609 self.accept() 1610 return 1611 --> 1612 self.parent().visible_playlist_tab().insert_track( 1613 self.session, track, note=self.ui.txtNote.text()) .................................................. self = <__main__.DbDialog object at 0x7fccfd6915e0> track = None self.ui.track = None .................................................. File "/home/kae/mm/app/playlists.py", line 683, in insert_track 671 def insert_track(self, session: scoped_session, track: Tracks, 672 note: str = None, repaint: bool = True) -> None: (...) 679 We simply build a PlaylistRows object and pass it to insert_row() 680 to do the heavy lifing. 681 """ 682 --> 683 if not track and track.id: 684 log.debug( .................................................. self = <PlaylistTab(id=82> track = None note = 'black is black' repaint = True track.id = # AttributeError track = None log.debug = <method 'Logger.debug' of <Logger musicmuster (DEBUG)> __ini t__.py:1420> .................................................. ---- (full traceback above) ---- File "/home/kae/mm/app/musicmuster.py", line 1601, in add_selected_and_close self.add_selected() File "/home/kae/mm/app/musicmuster.py", line 1596, in add_selected self.add_track(track) File "/home/kae/mm/app/musicmuster.py", line 1612, in add_track self.parent().visible_playlist_tab().insert_track( File "/home/kae/mm/app/playlists.py", line 683, in insert_track if not track and track.id: AttributeError: 'NoneType' object has no attribute 'id' ```
kae added the
bug
label 2023-01-16 12:01:06 +00:00
kae closed this issue 2023-01-16 17:20:25 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kae/musicmuster#160
No description provided.