How to chmod files within a python setup.py?

I think it would be better, and more customary, to not write to the installer's home directory any config files at all. What about other users? Better would be to have your code check, on initialization, if that file exists for the user running it and only add a new one if it does not.

I should try then to install the "did. Xml" file for instance in "/usr/share" during the installation, and then during the script's execution copy that file at initialization (for further custom edits)? Which place would be the best to install the file then?

– kluck Dec 29 '10 at 9:57 @kluck That depends on how big it is. If it's small you might try just embedding the template as a triple-quoted string right inside your source code. Then write that string to the users new config file.It will automatically have the right permissions, also.

– Keith Dec 29 '10 at 10:03 Yes, the file has about 40 lines, I could easily keep it inside my code. Thanks a lot! – kluck Dec 29 '10 at 10:07.

For me, you're looking either for chown (changing owner) or chgrp (changing group). Moreover I don't see why you're making sudo, you only need right access to those files. So just add chmod -R gou+rx setup_dir in order to be able to browse the installs.

The reason why i'm making sudo is because the setup. Py runs the following command : "creating /usr/local/lib/python2.6/dist-packages/didlib", and cannot do so without root access. I'm not that good with chmod/chown/chgrp, but if I keep using sudo (as I do not see any other way for now), I guess the command "os.

Chown('~/. Did/did. Xml', os.geteuid())" wouldn't work because os.geteuid() should give me the root id?

What should I type then? – kluck Dec 29 '10 at 9:34 I think, i'll execute the script using the current user, and just call the sudo when I need. By doing this I know the current user, and I have the good rights.

I'm avoiding using the sudo rights. – ykatchou Dec 29 '10 at 9:38.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions