PermissionError at /download/Django 1.10 error, 'NoneType' object is not callableKeyError when trying to assign clean_data value in DjangoKeyError at /users/login 'isLoggedIn'Unable to use login method in djangoerror 'NoneType' object has no attribute '__dict__'class has no attributed userasyncio in django viewDjango response error 'unicode' object has no attribute '_meta' jsonlist object has no attribute copy

Pandas: fill one column with count of # of obs between occurrences in a 2nd column

How to say "fit" in Latin?

Why should public servants be apolitical?

Should I take out a personal loan to pay off credit card debt?

Replace data between quotes in a file

Blocking people from taking pictures of me with smartphone

Why can I log in to my Facebook account with a misspelled email/password?

Team goes to lunch frequently, I do intermittent fasting but still want to socialize

How to query data in backups?

Can a character who casts Shapechange and turns into a spellcaster use innate spellcasting to cast spells with a long casting time?

How do I calculate the difference in lens reach between a superzoom compact and a DSLR zoom lens?

What is a "Genuine Geraldo interviewee"?

Colleagues speaking another language and it impacts work

Double blind peer review when paper cites author's GitHub repo for code

Can I call myself an assistant professor without a PhD

Why is there a need to prevent a racist, sexist, or otherwise bigoted vendor from discriminating who they sell to?

Is it really ~648.69 km/s delta-v to "land" on the surface of the Sun?

How to write "upright" integrals with automatic sizing

Looking for a new job because of relocation - is it okay to tell the real reason?

Tikzcd pullback square issue

A question about 'reptile and volatiles' to describe creatures

Do other countries guarantee freedoms that the United States does not have?

How to mark beverage cans in a cooler for a blind person?

"How do you solve a problem like Maria?"



PermissionError at /download/


Django 1.10 error, 'NoneType' object is not callableKeyError when trying to assign clean_data value in DjangoKeyError at /users/login 'isLoggedIn'Unable to use login method in djangoerror 'NoneType' object has no attribute '__dict__'class has no attributed userasyncio in django viewDjango response error 'unicode' object has no attribute '_meta' jsonlist object has no attribute copy






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















when i try to download the file it says PermissionError at /download/



views.py



def download(request, path):
file_path = os.path.join(settings.MEDIA_ROOT, path)
if os.path.exists(file_path):
with open(file_path, 'rb') as f:
response = HttpResponse(f.read(), content_type="application/vnd.ms-excel")
response['Content-Disposition'] = 'inline; filename=' + os.path.basename(file_path)
return response
raise Http404


urls.py



re_path(r'^download/(?P<path>.*)$', views.download)


in html templates



<a href="/download">Download</a>


i have tried everything such as moved project folder to another directory or run it as admin etc but it says



 Internal Server Error: /download/
Traceback (most recent call last):
File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersexception.py", line 34, in inner
response = get_response(request)
File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:UsersZako5PycharmProjectsjurnaljurnal_appviews.py", line 40, in download
with open(file_path, 'rb') as fh:
PermissionError: [Errno 13] Permission denied: 'C:\Users\Zako5\PycharmProjects\jurnal\media/'
[27/Mar/2019 10:56:09] "GET /download/ HTTP/1.1" 500 66483


any help would be appreciated) this problem has been pissing me off for a week










share|improve this question






























    0















    when i try to download the file it says PermissionError at /download/



    views.py



    def download(request, path):
    file_path = os.path.join(settings.MEDIA_ROOT, path)
    if os.path.exists(file_path):
    with open(file_path, 'rb') as f:
    response = HttpResponse(f.read(), content_type="application/vnd.ms-excel")
    response['Content-Disposition'] = 'inline; filename=' + os.path.basename(file_path)
    return response
    raise Http404


    urls.py



    re_path(r'^download/(?P<path>.*)$', views.download)


    in html templates



    <a href="/download">Download</a>


    i have tried everything such as moved project folder to another directory or run it as admin etc but it says



     Internal Server Error: /download/
    Traceback (most recent call last):
    File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersexception.py", line 34, in inner
    response = get_response(request)
    File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
    File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "C:UsersZako5PycharmProjectsjurnaljurnal_appviews.py", line 40, in download
    with open(file_path, 'rb') as fh:
    PermissionError: [Errno 13] Permission denied: 'C:\Users\Zako5\PycharmProjects\jurnal\media/'
    [27/Mar/2019 10:56:09] "GET /download/ HTTP/1.1" 500 66483


    any help would be appreciated) this problem has been pissing me off for a week










    share|improve this question


























      0












      0








      0








      when i try to download the file it says PermissionError at /download/



      views.py



      def download(request, path):
      file_path = os.path.join(settings.MEDIA_ROOT, path)
      if os.path.exists(file_path):
      with open(file_path, 'rb') as f:
      response = HttpResponse(f.read(), content_type="application/vnd.ms-excel")
      response['Content-Disposition'] = 'inline; filename=' + os.path.basename(file_path)
      return response
      raise Http404


      urls.py



      re_path(r'^download/(?P<path>.*)$', views.download)


      in html templates



      <a href="/download">Download</a>


      i have tried everything such as moved project folder to another directory or run it as admin etc but it says



       Internal Server Error: /download/
      Traceback (most recent call last):
      File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersexception.py", line 34, in inner
      response = get_response(request)
      File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 126, in _get_response
      response = self.process_exception_by_middleware(e, request)
      File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 124, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "C:UsersZako5PycharmProjectsjurnaljurnal_appviews.py", line 40, in download
      with open(file_path, 'rb') as fh:
      PermissionError: [Errno 13] Permission denied: 'C:\Users\Zako5\PycharmProjects\jurnal\media/'
      [27/Mar/2019 10:56:09] "GET /download/ HTTP/1.1" 500 66483


      any help would be appreciated) this problem has been pissing me off for a week










      share|improve this question














      when i try to download the file it says PermissionError at /download/



      views.py



      def download(request, path):
      file_path = os.path.join(settings.MEDIA_ROOT, path)
      if os.path.exists(file_path):
      with open(file_path, 'rb') as f:
      response = HttpResponse(f.read(), content_type="application/vnd.ms-excel")
      response['Content-Disposition'] = 'inline; filename=' + os.path.basename(file_path)
      return response
      raise Http404


      urls.py



      re_path(r'^download/(?P<path>.*)$', views.download)


      in html templates



      <a href="/download">Download</a>


      i have tried everything such as moved project folder to another directory or run it as admin etc but it says



       Internal Server Error: /download/
      Traceback (most recent call last):
      File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersexception.py", line 34, in inner
      response = get_response(request)
      File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 126, in _get_response
      response = self.process_exception_by_middleware(e, request)
      File "C:UsersZako5.virtualenvsjurnal-6LxuXEYulibsite-packagesdjangocorehandlersbase.py", line 124, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "C:UsersZako5PycharmProjectsjurnaljurnal_appviews.py", line 40, in download
      with open(file_path, 'rb') as fh:
      PermissionError: [Errno 13] Permission denied: 'C:\Users\Zako5\PycharmProjects\jurnal\media/'
      [27/Mar/2019 10:56:09] "GET /download/ HTTP/1.1" 500 66483


      any help would be appreciated) this problem has been pissing me off for a week







      django python-3.x






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 6:14









      codercoder

      536 bronze badges




      536 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1














          your path is empty as such it is trying to open MEDIA_ROOT which is a directory



          say your directory structure is as follows:



          -media root
          - 1.xlsx


          Then you update tour html as



          <a href="/download/1.xlsx">Download</a>


          so your path variable becomes 1.xlsx






          share|improve this answer



























          • here is my media root dir 'MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')'

            – coder
            Mar 27 at 6:31











          • yes its a directory you need to open a file

            – Jibin Mathews
            Mar 27 at 6:38












          • @JibinMathews is right you need to open a file

            – Yugandhar Chaudhari
            Mar 27 at 6:41











          • please can you show me how to open? I opened the path if exists above code

            – coder
            Mar 27 at 6:45











          • @coder updated my answer

            – Jibin Mathews
            Mar 27 at 6:53










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370877%2fpermissionerror-at-download%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          your path is empty as such it is trying to open MEDIA_ROOT which is a directory



          say your directory structure is as follows:



          -media root
          - 1.xlsx


          Then you update tour html as



          <a href="/download/1.xlsx">Download</a>


          so your path variable becomes 1.xlsx






          share|improve this answer



























          • here is my media root dir 'MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')'

            – coder
            Mar 27 at 6:31











          • yes its a directory you need to open a file

            – Jibin Mathews
            Mar 27 at 6:38












          • @JibinMathews is right you need to open a file

            – Yugandhar Chaudhari
            Mar 27 at 6:41











          • please can you show me how to open? I opened the path if exists above code

            – coder
            Mar 27 at 6:45











          • @coder updated my answer

            – Jibin Mathews
            Mar 27 at 6:53















          1














          your path is empty as such it is trying to open MEDIA_ROOT which is a directory



          say your directory structure is as follows:



          -media root
          - 1.xlsx


          Then you update tour html as



          <a href="/download/1.xlsx">Download</a>


          so your path variable becomes 1.xlsx






          share|improve this answer



























          • here is my media root dir 'MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')'

            – coder
            Mar 27 at 6:31











          • yes its a directory you need to open a file

            – Jibin Mathews
            Mar 27 at 6:38












          • @JibinMathews is right you need to open a file

            – Yugandhar Chaudhari
            Mar 27 at 6:41











          • please can you show me how to open? I opened the path if exists above code

            – coder
            Mar 27 at 6:45











          • @coder updated my answer

            – Jibin Mathews
            Mar 27 at 6:53













          1












          1








          1







          your path is empty as such it is trying to open MEDIA_ROOT which is a directory



          say your directory structure is as follows:



          -media root
          - 1.xlsx


          Then you update tour html as



          <a href="/download/1.xlsx">Download</a>


          so your path variable becomes 1.xlsx






          share|improve this answer















          your path is empty as such it is trying to open MEDIA_ROOT which is a directory



          say your directory structure is as follows:



          -media root
          - 1.xlsx


          Then you update tour html as



          <a href="/download/1.xlsx">Download</a>


          so your path variable becomes 1.xlsx







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 27 at 6:53

























          answered Mar 27 at 6:23









          Jibin MathewsJibin Mathews

          6326 silver badges17 bronze badges




          6326 silver badges17 bronze badges















          • here is my media root dir 'MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')'

            – coder
            Mar 27 at 6:31











          • yes its a directory you need to open a file

            – Jibin Mathews
            Mar 27 at 6:38












          • @JibinMathews is right you need to open a file

            – Yugandhar Chaudhari
            Mar 27 at 6:41











          • please can you show me how to open? I opened the path if exists above code

            – coder
            Mar 27 at 6:45











          • @coder updated my answer

            – Jibin Mathews
            Mar 27 at 6:53

















          • here is my media root dir 'MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')'

            – coder
            Mar 27 at 6:31











          • yes its a directory you need to open a file

            – Jibin Mathews
            Mar 27 at 6:38












          • @JibinMathews is right you need to open a file

            – Yugandhar Chaudhari
            Mar 27 at 6:41











          • please can you show me how to open? I opened the path if exists above code

            – coder
            Mar 27 at 6:45











          • @coder updated my answer

            – Jibin Mathews
            Mar 27 at 6:53
















          here is my media root dir 'MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')'

          – coder
          Mar 27 at 6:31





          here is my media root dir 'MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')'

          – coder
          Mar 27 at 6:31













          yes its a directory you need to open a file

          – Jibin Mathews
          Mar 27 at 6:38






          yes its a directory you need to open a file

          – Jibin Mathews
          Mar 27 at 6:38














          @JibinMathews is right you need to open a file

          – Yugandhar Chaudhari
          Mar 27 at 6:41





          @JibinMathews is right you need to open a file

          – Yugandhar Chaudhari
          Mar 27 at 6:41













          please can you show me how to open? I opened the path if exists above code

          – coder
          Mar 27 at 6:45





          please can you show me how to open? I opened the path if exists above code

          – coder
          Mar 27 at 6:45













          @coder updated my answer

          – Jibin Mathews
          Mar 27 at 6:53





          @coder updated my answer

          – Jibin Mathews
          Mar 27 at 6:53






          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370877%2fpermissionerror-at-download%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현