@Zacharee1 Not really, it's asking about ssh tunneling. Since one end is Ubuntu and, presumably, that end will be launching the tunnel, it seems on topic. Unclear, but on topic.
@Rinzwind actually the script takes the file name test1.json as user input.. And it will also take the class name as input and it has to append the class name into the json file under classes..
@Rinzwind there the appending is not happening.. not sure what is missing out.
I want to upgrade to a new distro because Ubuntu 16.04LTS has MAJOR problems with any graphical use, I can't edit videos, and the screen is really glitchy, I can't watch videos on fullscreen because of this anoying glitchy thing. I would be also happy if someone would suggest a distro. I heard th...
I'm guessing what happens is that vim copies the file to a new inode. I just tested and I can't modify something unless I have write access to the directory. I can, however, use ! to modify a file in a directory I have access to, despite not having write access to the file.
In a Unix-style file system, the inode is a data structure used to represent a filesystem object, which can be one of various things including a file or a directory. Each inode stores the attributes and disk block location(s) of the filesystem object's data. Filesystem object attributes may include manipulation metadata (e.g. change, access, modify time), as well as owner and permission data (e.g. group-id, user-id, permissions).
Directories are lists of names assigned to inodes. The directory contains an entry for itself, its parent, and each of its children.
== Etymology ==
There has been some...
Well, it doesn't look like it's deleting/recreating the file, but let me check again to make sure. It might just be using the same inode again (although that seems unlikely)
@karthick87 the way to do this sort of thing is to i) explain what the code is supposed to do; ii) explain what it is doing instead and iii) trim it down to the simplest possible example that reproduces the error
that said, looks like you're passing an object instead of the contents
an opened file is just an object. Reading the file helps :p
simply opening the file does jack squat
f.read() will give the json contents
f = open(userinput,'a') # Opens the file for append, but that's just the write mode
json.dump(f,data['classes'].append(class_add)) # Does something with 'f', but likely expects *json* content, not a file object.
:31858614 Just flag such things as offensive next time.
I'm not doing anything other than deleting the comment because this is a new user who's probably never coming back. Issuing a suspension will just lead to drama.
@karthick87 so you want this script to take user input of a path to a JSON file, import it as a JSON object, manipulate the data in the JSON object, and then write the updated JSON to the original JSON file, correct?
@Zanna nah, it's an answer, it just doesn't need to be nearly as long. It also follows HP keyboard shortcuts when OP has MSI, but that doesn't really matter.
@edwinksl they said it worked for them, but I doubt it would have affected anything. They might not even have Nvidia.
@karthick87 note I replaced your user input with static strings for my testing, as I was using an IDE that doesn't have interactive python console during code test runs
yeah @Zacharee1 and that's why it's useful to everyone, but the other answer is like "this totally generic procedure mysteriously worked on my particular device"
@karthick87 I added some additional prints to make sure JSON format was done. Note that I replaced "append" with "write" for the file open mode, because you have to write the whole JSON object as overwrite, not append, otherwise you get weird errors.
@karthick87 (such as random list objects at the end of the file, which breaks JSON serialization - this means you have to overwrite the whole file with the complete JSON, not append.)
@Zacharee1 I actually have not tried. I will have to get my son's account and install it on my system and test it that way. Train Sim 2016 and Flight Sim X look awesome on it. I have not tried any newer games that are higher end like Doom or GTA
See, that's why I'm not in favor of translating questions. I left a comment explaining that the site only accepts post in English and directing the user to Google Translate. They responded by telling me "OK, I added the link to the guide I followed".
And so forced me to write yet another comment. In bleedin' French! I hate writing in French. I can speak the language well enough, but writing it is a whole different thing.