No usable temporary directory found

后端 未结 9 1593
迷失自我
迷失自我 2020-12-14 05:51

I am trying to find a temp directory , but when i am trying to get the directory using

tempfile.gettempdir()

it\'s giving me error of

相关标签:
9条回答
  • 2020-12-14 05:53

    I got this when my root drive (/dev/sda1) was corrupted on my Ubuntu.

    Rebooted, got the error /dev/sda1 contains a file system with errors.

    Followed instructions here: https://askubuntu.com/questions/885062/root-file-system-requires-manual-fsck, which was to fsck -y <dev/xxx reported to have error> twice. Then exit to reboot.

    0 讨论(0)
  • 2020-12-14 05:54

    This kind of error occured in two case

    1. permission(should be drwxrwxrwt and owened by root)
    2. space

    To check space(disk usage)just run the command on terminal

    df -h
    

    Will list the disk usage on unix and get the output like

    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda5        28G   15G   12G  58% /
    

    If the root(mounted on /) usage is 100%.

    You need to clean the tmp directory or restart the machine or make some space on the root.

    0 讨论(0)
  • 2020-12-14 06:01

    I got the same issue when there was no space on /.

    Issue:

    File "/usr/lib64/python2.6/tempfile.py", line 201, in _get_default_tempdir("No usable temporary directory found in %s" % dirlist))
    IOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']  [FAILED] 
    

    [root@master hue]# df -h

    Filesystem Size Used Avail Use% Mounted on

    /dev/mapper/vg_master-lv_root

                 35G   34G     0 100%     /
    

    tmpfs
    7.8G 72K 7.8G 1% /dev/shm

    /dev/sda1
    477M 34M 418M 8% /boot

    When I cleared out some space then it worked fine for me.

    [root@master log]# service hue start

    Starting hue: [ OK ]

    [root@master log]#

    0 讨论(0)
  • 2020-12-14 06:03

    This error can occur when the file system has been switched to read-only mode.

    0 讨论(0)
  • 2020-12-14 06:03

    definately a disk space issue,

    on terminal, type df -h you should see output like below ( notice the 100% on one of the filesystems)

    $ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            992M     0  992M   0% /dev
    tmpfs           200M   21M  179M  11% /run
    /dev/xvda1      7.8G  7.8G  0  100% /
    tmpfs          1000M     0 1000M   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs          1000M     0 1000M   0% /sys/fs/cgroup
    tmpfs           200M     0  200M   0% /run/user/997
    tmpfs           200M     0  200M   0% /run/user/1042
    

    in this case, you need to make space by deleting files, artifacts folders e.t.c on path root /

    0 讨论(0)
  • 2020-12-14 06:05

    I had the same issue on the Windows 7x64 machine. It was OK with disk space and permissions.

    When I excecuted

    tempfile.mkdtemp(prefix='MyPrefix_')
    

    manually in python console the directory %TEMP%\MyPrefix_xxxx was successfully created. But when I did the same from script I received the error IOError: [Errno 2] No usable temporary directory found in [...].

    I solved the problem using dir parameter:

     # '.' is a default value for example
     tempfile.mkdtemp(prefix='MyPrefix_', dir=os.environ.get('TEMP', '.')) 
    

    After that from script it worked well.

    0 讨论(0)
提交回复
热议问题