0

I'm using the IDLE3 GUI on Ubuntu 14.04 Trusty, and I was wondering if anybody knows of a way to save to a different partition/external drive (from what Ubuntu is installed on) from the IDLE GUI?

The reason I'm asking is because currently, I'm using IDLE on Ubuntu, but I dual-boot Ubuntu w/ Windows 10 and sometimes use Windows IDLE, and since I can't access anything saved on my Ubuntu partition through Windows, I'd like to be able to save my .py files to an intermediary partition that I can access with both Windows and Ubuntu.

Let me know if you need anymore information, or clarification.

  • It is pretty easy, you just use 'save as..' and navigate to the drive you want to save on. Do you mean you want to know how to mount an external drive (so you can save to it)? – Nick Veitch Mar 21 '16 at 17:27
  • Not sure what is the main issue in your question; how to browse to mounted volumes from the Idle FileDialog window? (removed my answer because I am not sure) – Jacob Vlijm Mar 21 '16 at 21:51
  • @NickVeitch: No. Ok so, here's my HD setup: I have a 500GB HD, and it has 3 partitions: 1 for my Windows 10 install (which was the default OS with the laptop), 1 that's a separate "Data" partition (I guess it was setup like that to separate the OS from data files?), and then I created another one (from the OS partition) for Ubuntu. What I want is to be able to save my .py files in IDLE to the "Data" partition, but whenever I try to navigate to it in IDLE, it only lets me go as high as the "/" (root?) directory for the Ubuntu partition; the other drive partitions don't even show up as options. – cloud4xL Mar 22 '16 at 1:53
  • @JacobVlijm: I think so...they're on the same HD though (just separate partitions), so would I have to manually mount them (somehow) to enable them to be accessible to IDLE? – cloud4xL Mar 22 '16 at 1:56
0

Let's make some wild assumptions.

  1. Your "data" partition partition is ntfs file system for Windows.
  2. It is not automagically mounted in the Ubuntu system and therefore invisible from within the system.

To make data on the 'data' partition available from within the Ubuntu system the partition needs to be mounted. It could be mounted as needed, or for convenience can be mounted on system startup.

Ubuntu's Manual Configuration instructions are as follows:

First, you need to find the device locations of the partition(s) you wish to mount. Open a terminal and run:

sudo blkid

For illustration purposes, an example output from a computer setup with a Vista/Ubuntu dual-boot and shared NTFS data partition is shown here:

/dev/sda1: LABEL="Recovery" UUID="B23613F43613B875" TYPE="ntfs" 
/dev/sda2: LABEL="Windows" UUID="38CE9483CE943AD8" TYPE="ntfs" 
/dev/sda3: LABEL="Data" UUID="519CB82E5888AD0F" TYPE="ntfs" 
/dev/sda5: UUID="00d7d951-2a35-40fd-8e5d-411bb824ff3b" TYPE="swap" 
/dev/sda6: LABEL="Ubuntu" UUID="6044b1d0-208e-4ab3-850d-03a92e1516fc" TYPE="ext4" 

The first three partitions, all NTFS, are the ones that concern us here. There are no FAT32 partitions. In this instance, all three NTFS partitions have partition labels, which makes it easier to identify the purpose of each. If your blkid output does not include partition labels, this means that the partitions do not have labels and you will have to determine which partition you wish to mount by another means. Of the three NTFS partitions, we are going to configure /etc/fstab with only the third, the Data partition. Partition /dev/sda1 is the OEM manufacturer's recovery partition and should be left unmounted, or as described below. Partition /dev/sda2 is the Windows C:\ partition and is best not included in /etc/fstab for the reasons described above, or mounted read-only - see below.

You will now need to create a mountpoint for each NTFS partition that you wish to mount by means of /etc/fstab. In our illustration we are going to add one entry only for /dev/sda3. From a terminal:

sudo mkdir /media/Data

In this case we have created a mountpoint with the same name – Data – as the partition label. You may use (almost) any string you wish.

Before editing /etc/fstab directly, it is a good idea to make a backup. From a terminal:

sudo cp /etc/fstab /etc/fstab.orig

Now open /etc/fstab in a text editor with root privileges. In Ubuntu:

gksudo gedit /etc/fstab

In Kubuntu:

kdesudo kate /etc/fstab

In Xubuntu or Lubuntu:

gksudo leafpad /etc/fstab

For a general-purpose read-write mount, add this line to the end of /etc/fstab:

UUID=519CB82E5888AD0F  /media/Data  ntfs-3g  defaults,windows_names,locale=en_US.utf8  0 0

Replace the UUID with the one relevant for your partition as shown in your blkid output. “519CB82E5888AD0F” will not work for you.

Also, substitute your mountpoint for “/media/Data”. In case you have a blank space in the name of the mountpoint you want to use like "New Volume" instead of "Data" located in "/media" use "/media/New\040Volume". The space character is created by using "\040" in the fstab.

You will also need to change the “locale=en_US.utf8” option to one suitable for your location and language if you are not in the USA. You can determine your locale with this terminal command:

locale

Or for a list of all locales available on your system:

locale -a

Now save your edited /etc/fstab and close the text editor. The partition(s) you have configured will be mounted the next time you reboot, but to mount them now:

sudo mount -a

Now when you go to save/retrieve your data, written from the Windows system, it will be at the location specified in your /etc/fstab mounting instructions.

As a personal preference, rather than have the mount point be /mnt/Data or /media/Data, e.g., I used mount points just off root, /Data e.g.. because it saves 4-5 keystrokes or an extra click.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.