python - permission denied when trying to read csv file












0















I'm trying to build a neural net for a school project. I went with a popular model, its a program that determines diabetes risk. The program is based off of the popular 'pima indians diabetes' data set. I have keras and tensorflow set up, but I cant get the program to read the file, it always says "permission denied'.



I've tried updating permissions to 'everyone' but that doesn't work. I'm pretty sure the program can find the file, as they are both inside the same folder. Or maybe that's whats causing the problem? Either way, I'm pretty new to programming in general. any and all help would be greatly appreciated. Below is my code and attached is the console and my file location/contents. thanks.



EDIT: correct picture of console and file location



from keras.models import Sequential
from keras.layers import Dense, Dropout
from sklearn.model_selection import train_test_split
import numpy

# random seed for reproducibility
numpy.random.seed(2)

# load up the data
#dataset = numpy.loadtxt("dataset.csv", delimiter=",")
dataset = open("dataset.csv")


# split into input (X) and output (Y) variables, (split the data, ouput is 0 or 1)
X = dataset[:,0:8]
Y = dataset[:,8]

# split X, Y into a train and test set
x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, random_state=42)

# create model, add layers (specify the function)
model = Sequential()
model.add(Dense(15, input_dim=8, activation='relu')) # input layer requires input_dim param
model.add(Dense(10, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dropout(.2))
model.add(Dense(1, activation='sigmoid')) # sigmoid instead of relu for final probability between 0 and 1

# compile the model, adam gradient descent model (optimized)
model.compile(loss="binary_crossentropy", optimizer="adam", metrics=['accuracy'])

# function for fitting the data (training the network)
model.fit(x_train, y_train, epochs = 1000, batch_size=20, validation_data=(x_test, y_test))

# save it
model.save('weights.h5')









share|improve this question





























    0















    I'm trying to build a neural net for a school project. I went with a popular model, its a program that determines diabetes risk. The program is based off of the popular 'pima indians diabetes' data set. I have keras and tensorflow set up, but I cant get the program to read the file, it always says "permission denied'.



    I've tried updating permissions to 'everyone' but that doesn't work. I'm pretty sure the program can find the file, as they are both inside the same folder. Or maybe that's whats causing the problem? Either way, I'm pretty new to programming in general. any and all help would be greatly appreciated. Below is my code and attached is the console and my file location/contents. thanks.



    EDIT: correct picture of console and file location



    from keras.models import Sequential
    from keras.layers import Dense, Dropout
    from sklearn.model_selection import train_test_split
    import numpy

    # random seed for reproducibility
    numpy.random.seed(2)

    # load up the data
    #dataset = numpy.loadtxt("dataset.csv", delimiter=",")
    dataset = open("dataset.csv")


    # split into input (X) and output (Y) variables, (split the data, ouput is 0 or 1)
    X = dataset[:,0:8]
    Y = dataset[:,8]

    # split X, Y into a train and test set
    x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, random_state=42)

    # create model, add layers (specify the function)
    model = Sequential()
    model.add(Dense(15, input_dim=8, activation='relu')) # input layer requires input_dim param
    model.add(Dense(10, activation='relu'))
    model.add(Dense(8, activation='relu'))
    model.add(Dropout(.2))
    model.add(Dense(1, activation='sigmoid')) # sigmoid instead of relu for final probability between 0 and 1

    # compile the model, adam gradient descent model (optimized)
    model.compile(loss="binary_crossentropy", optimizer="adam", metrics=['accuracy'])

    # function for fitting the data (training the network)
    model.fit(x_train, y_train, epochs = 1000, batch_size=20, validation_data=(x_test, y_test))

    # save it
    model.save('weights.h5')









    share|improve this question



























      0












      0








      0








      I'm trying to build a neural net for a school project. I went with a popular model, its a program that determines diabetes risk. The program is based off of the popular 'pima indians diabetes' data set. I have keras and tensorflow set up, but I cant get the program to read the file, it always says "permission denied'.



      I've tried updating permissions to 'everyone' but that doesn't work. I'm pretty sure the program can find the file, as they are both inside the same folder. Or maybe that's whats causing the problem? Either way, I'm pretty new to programming in general. any and all help would be greatly appreciated. Below is my code and attached is the console and my file location/contents. thanks.



      EDIT: correct picture of console and file location



      from keras.models import Sequential
      from keras.layers import Dense, Dropout
      from sklearn.model_selection import train_test_split
      import numpy

      # random seed for reproducibility
      numpy.random.seed(2)

      # load up the data
      #dataset = numpy.loadtxt("dataset.csv", delimiter=",")
      dataset = open("dataset.csv")


      # split into input (X) and output (Y) variables, (split the data, ouput is 0 or 1)
      X = dataset[:,0:8]
      Y = dataset[:,8]

      # split X, Y into a train and test set
      x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, random_state=42)

      # create model, add layers (specify the function)
      model = Sequential()
      model.add(Dense(15, input_dim=8, activation='relu')) # input layer requires input_dim param
      model.add(Dense(10, activation='relu'))
      model.add(Dense(8, activation='relu'))
      model.add(Dropout(.2))
      model.add(Dense(1, activation='sigmoid')) # sigmoid instead of relu for final probability between 0 and 1

      # compile the model, adam gradient descent model (optimized)
      model.compile(loss="binary_crossentropy", optimizer="adam", metrics=['accuracy'])

      # function for fitting the data (training the network)
      model.fit(x_train, y_train, epochs = 1000, batch_size=20, validation_data=(x_test, y_test))

      # save it
      model.save('weights.h5')









      share|improve this question
















      I'm trying to build a neural net for a school project. I went with a popular model, its a program that determines diabetes risk. The program is based off of the popular 'pima indians diabetes' data set. I have keras and tensorflow set up, but I cant get the program to read the file, it always says "permission denied'.



      I've tried updating permissions to 'everyone' but that doesn't work. I'm pretty sure the program can find the file, as they are both inside the same folder. Or maybe that's whats causing the problem? Either way, I'm pretty new to programming in general. any and all help would be greatly appreciated. Below is my code and attached is the console and my file location/contents. thanks.



      EDIT: correct picture of console and file location



      from keras.models import Sequential
      from keras.layers import Dense, Dropout
      from sklearn.model_selection import train_test_split
      import numpy

      # random seed for reproducibility
      numpy.random.seed(2)

      # load up the data
      #dataset = numpy.loadtxt("dataset.csv", delimiter=",")
      dataset = open("dataset.csv")


      # split into input (X) and output (Y) variables, (split the data, ouput is 0 or 1)
      X = dataset[:,0:8]
      Y = dataset[:,8]

      # split X, Y into a train and test set
      x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, random_state=42)

      # create model, add layers (specify the function)
      model = Sequential()
      model.add(Dense(15, input_dim=8, activation='relu')) # input layer requires input_dim param
      model.add(Dense(10, activation='relu'))
      model.add(Dense(8, activation='relu'))
      model.add(Dropout(.2))
      model.add(Dense(1, activation='sigmoid')) # sigmoid instead of relu for final probability between 0 and 1

      # compile the model, adam gradient descent model (optimized)
      model.compile(loss="binary_crossentropy", optimizer="adam", metrics=['accuracy'])

      # function for fitting the data (training the network)
      model.fit(x_train, y_train, epochs = 1000, batch_size=20, validation_data=(x_test, y_test))

      # save it
      model.save('weights.h5')






      python tensorflow permissions denied






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 4:52







      Al Capwned

















      asked Nov 25 '18 at 4:47









      Al CapwnedAl Capwned

      63




      63
























          0






          active

          oldest

          votes











          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%2f53464726%2fpython-permission-denied-when-trying-to-read-csv-file%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f53464726%2fpython-permission-denied-when-trying-to-read-csv-file%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

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          Refactoring coordinates for Minecraft Pi buildings written in Python