How to save in the terminal window eg a .py file after modifying it?

I was advised to modify a file buffer.py within /home/xilinx/pynq directory to resolve an error whilst running the fir_accel tutorial.

This is probably a stupid / simple question to ask.

On line 127 of the buffer.py file I modified :

self.free_buffer() ->. self.freebuffer()

but how do I save this file? I do not see a save option. Usually I do ctrl+S if I edit a file in a normal editor but this file is only accessible in the terminal window when I access the file over the network.

If this file was accessible on jupyter_notebooks area I would have been able to modify/save it ok.

What text editor are you using to modify the file? Normally the text editor comes with saving options - I think you can check online?

Well I am not talking about the txt editor I have as a stand-alone one ie eg notepad+. That one there is a save option but I cannot use that to access the pynq network file. Can I?

The file I opened was via the network root@pynq: /home/xilinx/pynq when I logged into jupyter and I get a pynq terminal window. Here I opened and edited the /home/xilinx/pynq/buffer.py By using the delete keyboard button to delete the underscore (_) but I cannot save it. I tried ctrl+S but that did not save it because when I run the code again it did not pick my latest changes to the file.

Yes, you could edit a source from the network drive.

How did you “open” the file in the terminal and what “editor” are you using? This is what rock was asking.

For example, if you use “vi” you can google commands you need to edit and save the file if you aren’t very familiar with it.
E.g.

  • ESC then “i” to enter edit mode
  • Make changes
  • “qw” to quit and write

Cathal .

1 Like

Thanks guys, It’s working fine now :slight_smile:
Can edit the file and then save it.

—-

I was using edit to open a file before.

From your latest reply, I used vi instead.

I followed this way to edit / save a file :

  1. Switch to command mode by pressing the ESC key.

  2. Press : to open the prompt bar

  3. Type x after the colon and hit Enter. This will save the changes and exit.

Alternatively, your way need to put a : to open the prompt bar before typing wq

:wq

w stands for write (=save)
q stands for quit