title: Telethon: OperationalError: database is locked
body: <p>Apologies if it is a silly question.</p>
  
  <p>I am trying telethon for the first time and it fails to synchronize with my telegram API. </p>
  
  <p>I get an IP address when I type this code:
  <a href="https://i.stack.imgur.com/jC1SO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jC1SO.png" alt="enter image description here"></a></p>
  
  <p>But I get this message when I try to connect to start or connect the client:</p>
  
  <p><a href="https://i.stack.imgur.com/e4Dd4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e4Dd4.png" alt="enter image description here"></a></p>
  
  <p>And finally, I get <code>OperationalError: database is locked</code> error when I try to log in using my phone. </p>
  
  <p><a href="https://i.stack.imgur.com/urpZN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/urpZN.png" alt="enter image description here"></a></p>
  
  <p>The error message in full:</p>
  
  <pre><code>-------------------------------------------------------------------- 
  
  OperationalError Traceback (most recent 
   call last)
  &lt;ipython-input-13-880bc0e4ea12&gt; in &lt;module&gt;()
    1 from telethon import TelegramClient, sync
   ----&gt; 2 client = TelegramClient('session_name', api_id, api_hash)
    3 
    4 client.connect()
    5 if not client.is_user_authorized():
  
   /anaconda3/lib/python3.7/site- 
   packages/telethon/client/telegrambaseclient.py in __init__(self, 
   session, api_id, api_hash, connection, use_ipv6, proxy, timeout, 
   request_retries, connection_retries, retry_delay, auto_reconnect, 
   sequential_updates, flood_sleep_threshold, device_model, 
   system_version, app_version, lang_code, system_lang_code, loop, 
   base_logger)
   221                 DEFAULT_DC_ID,
   222                 DEFAULT_IPV6_IP if self._use_ipv6 else 
   DEFAULT_IPV4_IP,
   --&gt; 223                 DEFAULT_PORT
   224             )
   225 
  
   /anaconda3/lib/python3.7/site-packages/telethon/sessions/sqlite.py 
   in set_dc(self, dc_id, server_address, port)
  184     def set_dc(self, dc_id, server_address, port):
  185         super().set_dc(dc_id, server_address, port)
  --&gt; 186         self._update_session_table()
  187 
  188         # Fetch the auth_key corresponding to this data center
  
  /anaconda3/lib/python3.7/site-packages/telethon/sessions/sqlite.py 
  in _update_session_table(self)
  205         # some more work before being able to save auth_key's 
   for
  
  206         # multiple DCs. Probably done differently.
   --&gt; 207         c.execute('delete from sessions')
  208         c.execute('insert or replace into sessions values 
  (?,?,?,?)', (
  209             self._dc_id,
  
  OperationalError: database is locked
  </code></pre>
  
  <p>What does coroutine object AuthMethods._start at mean?
  Why is it giving database is locked?</p>