how to get the file path to my csv file in data assets in watson studio?











up vote
0
down vote

favorite












I have been trying to get the file path of my csv file in watson studio. The file is saved in my project data assets in watson studio. And all I need is the file path to read its content in a jupyter notebook. I'm trying to use a simple python file reader, that should read a file in a specified path. I have tried using watson studio insert file credentials, but can't get it to work.
This works fine when I run the same file in IBM cognitiveclass.ai platform, but I can't get this to work in IBM watson studio, please help.



file name is enrollments.csv



import unicodecsv
with open('enrollments.csv', 'rb') as f:
reader = unicodecsv.DictReader(f)
enrollments = list(reader)









share|improve this question


























    up vote
    0
    down vote

    favorite












    I have been trying to get the file path of my csv file in watson studio. The file is saved in my project data assets in watson studio. And all I need is the file path to read its content in a jupyter notebook. I'm trying to use a simple python file reader, that should read a file in a specified path. I have tried using watson studio insert file credentials, but can't get it to work.
    This works fine when I run the same file in IBM cognitiveclass.ai platform, but I can't get this to work in IBM watson studio, please help.



    file name is enrollments.csv



    import unicodecsv
    with open('enrollments.csv', 'rb') as f:
    reader = unicodecsv.DictReader(f)
    enrollments = list(reader)









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have been trying to get the file path of my csv file in watson studio. The file is saved in my project data assets in watson studio. And all I need is the file path to read its content in a jupyter notebook. I'm trying to use a simple python file reader, that should read a file in a specified path. I have tried using watson studio insert file credentials, but can't get it to work.
      This works fine when I run the same file in IBM cognitiveclass.ai platform, but I can't get this to work in IBM watson studio, please help.



      file name is enrollments.csv



      import unicodecsv
      with open('enrollments.csv', 'rb') as f:
      reader = unicodecsv.DictReader(f)
      enrollments = list(reader)









      share|improve this question













      I have been trying to get the file path of my csv file in watson studio. The file is saved in my project data assets in watson studio. And all I need is the file path to read its content in a jupyter notebook. I'm trying to use a simple python file reader, that should read a file in a specified path. I have tried using watson studio insert file credentials, but can't get it to work.
      This works fine when I run the same file in IBM cognitiveclass.ai platform, but I can't get this to work in IBM watson studio, please help.



      file name is enrollments.csv



      import unicodecsv
      with open('enrollments.csv', 'rb') as f:
      reader = unicodecsv.DictReader(f)
      enrollments = list(reader)






      python filereader ibm-watson






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 11:13









      Lawrence Krukrubo

      11




      11
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I assume you mean uploaded the "enrollments.csv" file to Files section.
          This uploads file to the Bucket of Cloud Object Storage service which storage for your project.
          You can use project-lib to fetch the file url.



          # Import the lib
          from project_lib import Project
          project = Project(sc,"<ProjectId>", "<ProjectToken>")

          # Get the url
          url = project.get_file_url("myFile.csv")


          For more refer this:-
          https://dataplatform.cloud.ibm.com/docs/content/analyze-data/project-lib-python.html



          https://dataplatform.cloud.ibm.com/analytics/notebooks/v2/a972effc-394f-4825-af91-874cb165dcfc/view?access_token=ee2bd90bee679afc278cdb23453946a3922c454a6a7037e4bd3c4b0f90eb0924






          share|improve this answer





















          • Thanks, I tried it and read all the links but it did not work. I generated the project ID and token successfully, but the code to get url (url = project.get_file_url('enrollments.csv') gives an error message, that says "ValueError: Something went wrong! error message:ProjectCore__get_file_url(): spark context (sc) is not available. This function can't be invoked!!" I have no idea why, it's more than a bit frustrating I must say. But thanks again.
            – Lawrence Krukrubo
            Nov 12 at 11:40











          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',
          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%2f53224648%2fhow-to-get-the-file-path-to-my-csv-file-in-data-assets-in-watson-studio%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








          up vote
          0
          down vote













          I assume you mean uploaded the "enrollments.csv" file to Files section.
          This uploads file to the Bucket of Cloud Object Storage service which storage for your project.
          You can use project-lib to fetch the file url.



          # Import the lib
          from project_lib import Project
          project = Project(sc,"<ProjectId>", "<ProjectToken>")

          # Get the url
          url = project.get_file_url("myFile.csv")


          For more refer this:-
          https://dataplatform.cloud.ibm.com/docs/content/analyze-data/project-lib-python.html



          https://dataplatform.cloud.ibm.com/analytics/notebooks/v2/a972effc-394f-4825-af91-874cb165dcfc/view?access_token=ee2bd90bee679afc278cdb23453946a3922c454a6a7037e4bd3c4b0f90eb0924






          share|improve this answer





















          • Thanks, I tried it and read all the links but it did not work. I generated the project ID and token successfully, but the code to get url (url = project.get_file_url('enrollments.csv') gives an error message, that says "ValueError: Something went wrong! error message:ProjectCore__get_file_url(): spark context (sc) is not available. This function can't be invoked!!" I have no idea why, it's more than a bit frustrating I must say. But thanks again.
            – Lawrence Krukrubo
            Nov 12 at 11:40















          up vote
          0
          down vote













          I assume you mean uploaded the "enrollments.csv" file to Files section.
          This uploads file to the Bucket of Cloud Object Storage service which storage for your project.
          You can use project-lib to fetch the file url.



          # Import the lib
          from project_lib import Project
          project = Project(sc,"<ProjectId>", "<ProjectToken>")

          # Get the url
          url = project.get_file_url("myFile.csv")


          For more refer this:-
          https://dataplatform.cloud.ibm.com/docs/content/analyze-data/project-lib-python.html



          https://dataplatform.cloud.ibm.com/analytics/notebooks/v2/a972effc-394f-4825-af91-874cb165dcfc/view?access_token=ee2bd90bee679afc278cdb23453946a3922c454a6a7037e4bd3c4b0f90eb0924






          share|improve this answer





















          • Thanks, I tried it and read all the links but it did not work. I generated the project ID and token successfully, but the code to get url (url = project.get_file_url('enrollments.csv') gives an error message, that says "ValueError: Something went wrong! error message:ProjectCore__get_file_url(): spark context (sc) is not available. This function can't be invoked!!" I have no idea why, it's more than a bit frustrating I must say. But thanks again.
            – Lawrence Krukrubo
            Nov 12 at 11:40













          up vote
          0
          down vote










          up vote
          0
          down vote









          I assume you mean uploaded the "enrollments.csv" file to Files section.
          This uploads file to the Bucket of Cloud Object Storage service which storage for your project.
          You can use project-lib to fetch the file url.



          # Import the lib
          from project_lib import Project
          project = Project(sc,"<ProjectId>", "<ProjectToken>")

          # Get the url
          url = project.get_file_url("myFile.csv")


          For more refer this:-
          https://dataplatform.cloud.ibm.com/docs/content/analyze-data/project-lib-python.html



          https://dataplatform.cloud.ibm.com/analytics/notebooks/v2/a972effc-394f-4825-af91-874cb165dcfc/view?access_token=ee2bd90bee679afc278cdb23453946a3922c454a6a7037e4bd3c4b0f90eb0924






          share|improve this answer












          I assume you mean uploaded the "enrollments.csv" file to Files section.
          This uploads file to the Bucket of Cloud Object Storage service which storage for your project.
          You can use project-lib to fetch the file url.



          # Import the lib
          from project_lib import Project
          project = Project(sc,"<ProjectId>", "<ProjectToken>")

          # Get the url
          url = project.get_file_url("myFile.csv")


          For more refer this:-
          https://dataplatform.cloud.ibm.com/docs/content/analyze-data/project-lib-python.html



          https://dataplatform.cloud.ibm.com/analytics/notebooks/v2/a972effc-394f-4825-af91-874cb165dcfc/view?access_token=ee2bd90bee679afc278cdb23453946a3922c454a6a7037e4bd3c4b0f90eb0924







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 3:13









          charles gomes

          1,592414




          1,592414












          • Thanks, I tried it and read all the links but it did not work. I generated the project ID and token successfully, but the code to get url (url = project.get_file_url('enrollments.csv') gives an error message, that says "ValueError: Something went wrong! error message:ProjectCore__get_file_url(): spark context (sc) is not available. This function can't be invoked!!" I have no idea why, it's more than a bit frustrating I must say. But thanks again.
            – Lawrence Krukrubo
            Nov 12 at 11:40


















          • Thanks, I tried it and read all the links but it did not work. I generated the project ID and token successfully, but the code to get url (url = project.get_file_url('enrollments.csv') gives an error message, that says "ValueError: Something went wrong! error message:ProjectCore__get_file_url(): spark context (sc) is not available. This function can't be invoked!!" I have no idea why, it's more than a bit frustrating I must say. But thanks again.
            – Lawrence Krukrubo
            Nov 12 at 11:40
















          Thanks, I tried it and read all the links but it did not work. I generated the project ID and token successfully, but the code to get url (url = project.get_file_url('enrollments.csv') gives an error message, that says "ValueError: Something went wrong! error message:ProjectCore__get_file_url(): spark context (sc) is not available. This function can't be invoked!!" I have no idea why, it's more than a bit frustrating I must say. But thanks again.
          – Lawrence Krukrubo
          Nov 12 at 11:40




          Thanks, I tried it and read all the links but it did not work. I generated the project ID and token successfully, but the code to get url (url = project.get_file_url('enrollments.csv') gives an error message, that says "ValueError: Something went wrong! error message:ProjectCore__get_file_url(): spark context (sc) is not available. This function can't be invoked!!" I have no idea why, it's more than a bit frustrating I must say. But thanks again.
          – Lawrence Krukrubo
          Nov 12 at 11:40


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224648%2fhow-to-get-the-file-path-to-my-csv-file-in-data-assets-in-watson-studio%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

          how to define a CAPL function taking a sysvar argument

          Schultheiß

          Ansible :Unable to parse /etc/ansible/hosts as an inventory source