title: Django:TypeError : int() argument must be a string, a bytes-like object or a number, not 'NoneType' while getting value from the user
body: <p>I'm working on a Django project where I upload a .csv extension file and i give a integer value in the dashboard while uploading the file, the value that I upload must be given to the variable <strong>sf</strong> that is in the <code>Index</code> request field, and this error popped up</p>
  <pre><code>  File &quot;E:\Django_proj\mysite\visual\views.py&quot;, line 29, in index
      sf = int(request.GET.get('text1'))
  TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
  [06/Apr/2021 23:15:46] &quot;POST /visual/index/ HTTP/1.1&quot; 500 67471
  </code></pre>
  <p><strong>views.py</strong> file contains:</p>
  <pre><code>def index(request):
      if request.method ==&quot;POST&quot; and request.FILES.get('file', False):
          file = request.FILES[&quot;file&quot;]
          csv = pd.read_csv(file, error_bad_lines=False)
          sf = int(request.GET.get('text1'))       #The error field
          samplingFrequency = sf;
          samplingInterval = 1 / samplingFrequency;
          time = csv['time']
          amplitude = csv['amplitude']
          fourierTransform = np.fft.fft(amplitude)/len(amplitude)           # Normalize amplitude
          fourierTransform = fourierTransform[range(int(len(amplitude)/2))] # Exclude sampling frequency
          tpCount     = len(amplitude)
          values      = np.arange(int(tpCount/2))
          timePeriod  = tpCount/samplingFrequency
          frequencies = values/timePeriod
          plt.title('Fourier transform depicting the frequency components')
          plt.plot(frequencies, abs(fourierTransform))
          plt.xlabel('Frequency')
          plt.ylabel('Amplitude')
          plt.show()
          fig = plt.fft()
          buf = io.BytesIO()
          fig.savefig(buf, format = 'png')
          buf.seek(0)
          string = base64.b64encode(buf.read())
          uri = urllib.parse.quote(string)
  
          return render (request, 'visual/index.html', {&quot;something&quot;: True, &quot;frequency&quot;: frequencies, &quot;amplitude&quot; : amplitude }, {'data':uri})
      else:
          return render (request,'visual/index.html')
  </code></pre>
  <p>uploading a file in <strong>views.py</strong></p>
  <pre><code>def upload(request):
      if request.method == 'POST':
          form = UploadFileForm(request.POST, request.FILES)
          if form.is_valid():
              form.save()
              return redirect('index')
      else:
          form = UploadFileForm()
      return render (request, 'visual/upload.html', {'form' : form})
  </code></pre>
  <p><strong>upload.html file</strong></p>
  <pre><code>{% extends 'base.html' %} {% block content %}
  
  &lt;h1&gt;UPLOAD&lt;/h1&gt;
  &lt;form method=&quot;POST&quot; action=&quot;/visual/index/&quot; enctype=&quot;multipart/form-data&quot;&gt;
      {% csrf_token %}{{ form.as_p }}
      &lt;h3&gt;Sampling_Frequency Value :&lt;/h3&gt; &lt;input type=&quot;text&quot; name=&quot; text1 &quot; /&gt;&lt;br&gt;
      &lt;button type=&quot;submit &quot; class=&quot;mb-xs mt-xs mr-xs btn btn-primary &quot;&gt;&lt;i class=&quot;fa fa-cloud &quot;&gt;&lt;/i&gt; Upload file &lt;/button&gt;
  &lt;/form&gt;
  {% if url %}
  &lt;h4&gt;Uploaded file: &lt;a href=&quot;{{ url }}&quot;&gt;{{ url }}&lt;/a&gt;&lt;/h4&gt;
  {% endif %} {% endblock %}
  </code></pre>
  <p>I'm adding the <strong>form.py</strong> file if necessary</p>
  <pre><code>from .validators import validate_file
  
  class UploadFileForm(forms.ModelForm):
      file = forms.FileField(label = 'CSV File upload:', required = 'True', validators = [validate_file])
  
      class Meta:
          model = SourceFile
          fields = ('file', 'title')
  </code></pre>
  <p>I'm not able to get the value from the dashboard and not understanding the mistake here, please help me out here, thank you in advance</p>