title: Cassandra error 'NoneType' object has no attribute 'datacenter' while importing csv
body: <p>I have set up a cassandra cluster with 3 nodes.</p>
  
  <p>I am trying to do a simple export/ import using copy command, but it fails with the following error:</p>
  
  <pre><code>cqlsh:walmart&gt; select * from test;
  
   store | date       | isholiday | dept
  -------+------------+-----------+------
       1 | 22/04/1993 |     False |    1
  
  
  cqlsh&gt; use walmart;
  cqlsh:walmart&gt; copy test to 'test.csv';
  'NoneType' object has no attribute 'datacenter'
  </code></pre>
  
  <p>I researched the error and every related link seems to point out to python problems.</p>
  
  <p>I also installed python driver pip cassandra-driver. Inserting data manually works, but not through export/ import.</p>
  
  <pre><code>cassandra@cassandra-srv01:~$ python -c 'import cassandra; print cassandra.__version__'
  3.6.0
  </code></pre>
  
  <p>Ubuntu 16.04 64bit.</p>
  
  <p>how can I fix this error?</p>
  
  <p>the logs inside <code>$CASSANDRA_HOME/logs</code> don't have any entries regarding the error.</p>
  
  <p>Traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/Cellar/cassandra/3.7/libexec/bin/cqlsh.py", line 1152, in onecmd
      self.handle_statement(st, statementtext)
    File "/usr/local/Cellar/cassandra/3.7/libexec/bin/cqlsh.py", line 1189, in handle_statement
      return custom_handler(parsed)
    File "/usr/local/Cellar/cassandra/3.7/libexec/bin/cqlsh.py", line 1907, in do_copy
      task = ImportTask(self, ks, table, columns, fname, opts, DEFAULT_PROTOCOL_VERSION, CONFIG_FILE)
    File "/usr/local/Cellar/cassandra/3.7/libexec/bin/../pylib/cqlshlib/copyutil.py", line 1061, in __init__
      CopyTask.__init__(self, shell, ks, table, columns, fname, opts, protocol_version, config_file, 'from')
    File "/usr/local/Cellar/cassandra/3.7/libexec/bin/../pylib/cqlshlib/copyutil.py", line 207, in __init__
      self.local_dc = shell.conn.metadata.get_host(shell.hostname).datacenter
  AttributeError: 'NoneType' object has no attribute 'datacenter
  </code></pre>