Tag Info

Hot answers tagged

4

Directory permissions: The write bit allows the affected user to create, rename, or delete files within the directory, and modify the directory's attributes The read bit allows the affected user to list the files within the directory The execute bit allows the affected user to enter the directory, and access files and directories inside The sticky bit ...


4

Given just this file, you can do something like: <testfile jq -r '.data | map(.displayName), map(.value) | join(", ")' The . operator selects a field from an object/hash. Thus, we start with .data, which returns the array with the data in it. We then map over the array twice, first selecting the displayName, then selecting the value, giving us two ...


3

You seem to be mistaken in that abc.py would not be a command. If you can execute it, then is, just one with a dot in the name. Execute in the sense that you can do ./abc.py, so the execute bits must be set. If you have to do python abc.py than you it is not a command (yet). In general, to make a normal python file abc.py executable you should make sure ...


3

On a fresh Ubuntu 13.10 (32bit) the steps indicated here will not work. Even if you additionally install python-dev (which seems to be needed by PIP). The problems seems to be PIP which probably collides with the replacement functionality provided by Pillow (already installed). The base installation on 13.10 should therefore be: sudo apt-get install ...


2

For an application used by others you should probably not use pickle as it is not save to load pickle data from untrusted sources (alternatively you would have to make 100% sure the pickled data could not be changed on disc between writing and reading). If the data ever needs modifying by users, you should have a look at writing it out using YAML. A Python ...


1

You normally don't edit a shared object file, you compile it from the sources after editing it. You can download the sources for pygame, the latest released sources are http://pygame.org/ftp/pygame-1.9.1release.tar.gz. If you download that, the actual sources for the joystick.so are under src/joystick.c. Compilation/installation is not done via the common ...


1

vcard is not only executable by root, but also by any member of the group root. This is caused by the umask being 007 or even more restrictive at the moment pip2 is started. Just change with umask 002 or start with: python -c "import os; os.umask(2); os.system('pip2 install vcard')"


1

I think it dynamically loads libcurl when python runs? Yep. I would like pycurl to use a custom build of libcurl, and all other programs to use the standard version. Make sure your libcurl is not installed into one of the standard library paths, including /usr/local/lib. If it's /opt/curl/lib, before you run python: export ...


1

If the path is only pointing to executables you call, you should consider putting links in standard locations during install (/usr/bin/ or /usr/local/bin) and have the executable find out where they were invoked from and then have them derive the path to any data files from that. You would use the following: /usr/bin/myprog /opt/myprog/bin/myprog ...


1

You should approach this as a two step process. First make your api installable using pip by creating a setup.py file for the project and use setuptools. There is quite a lot to go through and I recommend you follow some of the examples out there to go through the steps before you start tweaking to get your own project installable this way. Extension in ...


1

Anthon's answer is correct, however for non-trivial Python projects you should have a look at the distutils module in the standard library. It's designed to deploy python modules and executables on a system the "right way", and : Python devs are familiar with this module (or should be) because it's in the standard library and most well-known Python ...


1

The only way I am able to reproduce the error: execve("/usr/bin/python", ["python", "--version"], [/* 14 vars */]) = -1 EACCES (Permission denied) ...is by making the ELF dynamic loader non-executable. This works: $ ls -l chroot12/lib64/ld-linux-x86-64.so.2 -rwxr-xr-x 1 root root 149280 Oct 30 16:22 chroot12/lib64/ld-linux-x86-64.so.2 This doesn't: ...


1

Stdout is being buffered, probably because of systemd redirect Adding sys.stdout.flush() after write or PYTHONUNBUFFERED environment will solve this problem See also the Stack Overflow question Python output buffering.


1

if you have sysstat installed you can use sar command e.g sar -q runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 16:49:01 0 173 0.00 0.01 0.05 1 16:50:01 0 173 0.00 0.01 0.05 0 from sar 's man page -q Report queue length and load ...


1

I think that vmstat does what you need. From the man page: vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity. The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay.


1

I've found jq hard to wrap my head around. Here's some Ruby: ruby -rjson -rcsv -e ' data = JSON.parse(File.read "file.json") data["data"].collect {|item| [item["displayName"], item["value"]]} .transpose .each {|row| puts row.to_csv} ' First Name,Last Name,Position,Company Name,Country VALUE,VALUE,VALUE,VALUE,VALUE The ...



Only top voted, non community-wiki answers of a minimum length are eligible