ERROR: could not open file for reading: Permission denied. SQL state: 42501 - macos

I am trying to copy an existing CSV file in a SQL table in pgAdmin4 1.5.
I am running the following query to copy the data from the CSV file:
COPY console_games FROM '/users/user1/Desktop/ConsoleGames.csv' DELIMITER ',' CSV HEADER;
And I get this result:
********** Error **********
ERROR: could not open file "/Users/user1/Desktop/ConsoleGames.csv" for reading: Permission denied
SQL state: 42501
I have changed the permissions of this file for all users to be read and write, but I still get the error.

I faced the same problem and here is how I solved
On Mac-
Open 'System Preferences'
Select 'Security and Privacy' option
Select 'Full Disk Access' from the list
Give access to PgAdmin AND postgres
Then, close and reopen your pgadmin

Use PgAdmin4's bulk-load features to import the CSV. This will do a COPY ... FROM STDIN behind the scenes. PgAdmin4 will access the file with your user's permissions, not those of the postgres server like a direct COPY from file will.

I solved this problem by creating a folder named Database in the PostgreSQL bin where I save all the data files that I want to work on. I use pgAdmin4 on both Mac and Windows. Whereas it is rather straightforward to find the bin on Windows, it is a bit tricky to find it on Mac because the Library where the bin is kept is hidden. Try to save your files on C:\ProgramFiles\PostgreSQL\10\bin\Database if you are using Windows and /Library/PostgreSQL/10/bin/Database/if you are using Mac. The Library can be found by pressing command+shift+g and type ~/Library on the go to folder. Your Mac will require your password to make changes in the Library. After saving your data files here, your code on pgAdmin4 should be like this:
COPY console_games FROM 'C:\ProgramFiles\PostgreSQL\10\bin\Database\ConsoleGames.csv' DELIMITER ',' CSV HEADER;
or
COPY console_games FROM '/Library/PostgreSQL/10/bin/Database/ConsoleGames.csv' DELIMITER ',' CSV HEADER;

On a Mac
Close PGAdmin
Open 'System Preferences'
Select 'Security and Privacy' option
Select 'Privacy'
Select 'Files and folders' from the list
Grant PgAdmin access for Documents-folder
Reopen PGAdmin

Related

When I try to save I get enospc Error VSCODE

when I try to save one of the file of my workspace it gave me this error:
"Failed to save 'style.css': The content of the file is newer. Please compare your version with the file contents or overwrite the content of the file with your changes."
I'm a WINDOWS 10 user, and a newbie so I don't really know what to do about it, of course I have a lot of free space on my pc
I tried to restart the software first and than the computer.

SQL*Plus editor in 10g

I have installed Oracle 10g on my machine but not able to run ed for edit option error:
SP2-0110: Cannot create save file "afiedt.buf"
Please, help me out to solve this. I have already tried so many options for fix it.
Check the file path where you are trying to save, check if the folder structure exists and you have write permission

[Microsoft][ODBC Visual FoxPro Driver]Cannot open file C:\users\aleer\locals\locals~1\temp\6uu0004.tmp?

Okay I checked this out and C:\users\aleer\locals\locals~1\temp\6uu0004.tmp is actually point to C:\Users\aleer\Local Settings\temp where the 6uu0004.tmp file does not even exist.
I guess it's possible that this file is being created and then it disappears once I get to the command prompt.
I'm not sure what the problem is...
Discovered the directory the temp file was being created in wasn't owned by my user. Changed the owner of the directory and now it works.

appcfg.py is not running with cmd prompt (Windows 7)

I am having strange problem. I used to run appcfg.py to update my app to appengine but now its not working anymore. When I run this command
C:\Program Files <x86>\Google\google_appengine>appcfg.py update E:\path\myApp\
Its not giving me anything, no error no feedback. Its just back to this line
C:\Program Files <x86>\Google\google_appengine>
Any idea about this issue!
P.S. I'm using Python 2.7. My code is updating through google app launcher but I need to run it from cmd prompt as I will be downloading/uploading appengine stuff which launcher doesn't allow me to do!
Thanks
I still had a little trouble with the instructions. Here's the steps I used to create a batch file to use the Google App Engine download_app with Windows 7.
In my example,
I'll use drive, C:
Default python path will be, C:\Python27\python.exe
GAE path (include "), "C:\Program Files (x86)\Google\google_appengine\appcfg.py"
App ID {your_app_id} will be just your app-id name
{your_app_version} is the "Version:" number in your GAE app.yaml file
I'll create a folder on my Windows 7 desktop and call it GAE_App
The desktop folder path will be C:\Users\{username}\Desktop\GAE_App
{your email} will be the Gmail account connected to your GAE
Right-click on the desktop and select New->Text Document. Open the newly created text document and add the following line of code modified for your setup to the blank text document,
C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" download_app -A {your_app_id} -V {your_app_version} --email={your email} C:\Users\{username}\Desktop\GAE_App
Save the text document and change the file name to GAE_Download.bat
It's important that the extension now says ".bat" instead of ".txt"
Once finished, click on the batch to execute it. You'll be asked for a password and then the files should download into the GAE_App folder on your desktop. Now, whenever you need to download your files, just click on the batch file.
Not sure why Google didn't simply include this feature with their GAE for Windows software.
I faced the same issue. Here is a simple solution.
Just do this following Steps:
Go to program file where google app engine is installed. Generally It is named as Google.
click on appcfg.py and select open with.. Select "Choose Default Programs".
Select Python from programs and select "Always Use the selected program to open this kind of file" .
Now run the command you should get the results on command line.
For reference click here
Fixed by accessing python lib like that
C:\Python27>python appcfg.py update E:\path\myApp\
Here's a solution that worked for me:
"google_appengine/appcfg.py" update "C:\PATH TO APP
The appcfg.bat that should be used is located **C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\appengine-java-sdk\bin** and not the empty appcfg.bat that for some unknown reason also was here C:\Program Files\Google\Cloud SDK\
Good practice is to add this path to the system variable PATH
This worked for me
Basis
<PATH_TO_PYTHON>python <PATH_TO_APPCFG.PY>appcfg.py -A <PROJECT_INSTANCE_NAME> update app.yaml
Example
X:\Software\Python2.7\python Q:\SOFTWARE\GoogleAppEngineSDK\appcfg.py -A great-1337 update app.yaml

error when i want to save java file in jdk/bin

when i save java file error is you dont have permission to save in this location contact the administrator to obtain permission on window7
Don't store application data in the "Program Files" directory.
It is very bad design and regular users don't have write access to that directory (for a very good reason).
So even if you changed your settings locally to open up the door for viruses your application won't run on other computers.
Besides: storing a Java file in the JDK directory serves no purpose at all.
Btw: your uppercase letters are broken, as well as the dot or the comma...
That's normal - jdk/bin is the installation directory of the JDK, regular users cannot (and should not) write files there. You'll have the same problem on Linux/Unix and on Mac OS X, where installation directories are off-limits to regular users.
Write your files to the users home directory (System property "user.home", works across platforms), or let the user choose where you save stuff.
Bin directory do not allow directly to save program in it.
it is so simple, just save your .java file on desktop and then copy paste it in Bin. done ;)
If the file can't save directly to c:\program files\java\jdk1.8.0\bin\
Solution:-
Click start Menu type Notepad command in run run as administrator
Right click the Notepad run as Administrator, then type the program file can save directly to c:\program files\java\jdk1.8.0\bin\
Just try it......

Resources