portability

Can Anaconda be packaged for a portable zero-configuration install?

Can Anaconda be packaged for a portable zero-configuration install? Question: I’d like to deploy Python to non-programmers in my organization such that the install process consists entirely of syncing a directory from Perforce and maybe running one batch file that sets up environment variables. Is it possible to package up Miniconda in such a way …

Total answers: 3

Proper shebang for Python script

Proper shebang for Python script Question: I’m usually using the following shebang declaration in my Python scripts: #!/usr/bin/python Recently, I’ve came across this shebang declaration: #!/usr/bin/env python In the script documentation, it was noted that using this form is “more portable”. What does this declaration mean? How come there’s a space in the middle of …

Total answers: 1

Django: 'current_tags' is not a valid tag library

Django: 'current_tags' is not a valid tag library Question: I have a small Django project I received from a friend. The code works perfectly on his system. However, on my system I get the following error message when running the server: TemplateSyntaxError at / ‘current_tags’ is not a valid tag library: Template library current_tags not …

Total answers: 17

How do I type a floating point infinity literal in python

How do I type a floating point infinity literal in python Question: How do I type a floating point infinity literal in python? I have heard inf = float(‘inf’) is non portable. Thus, I have had the following recommended: inf = 1e400 Is either of these standard, or portable? What is best practice? Asked By: …

Total answers: 4

Is there a portable way to get the current username in Python?

Is there a portable way to get the current username in Python? Question: What is a portable way (e.g. for Linux and Windows) to get the current user’s username? Something similar to os.getuid() would be nice: >>> os.getuid() 42 >>> os.getusername() ‘slartibartfast’ The pwd module works for Unix only. Some people suggest that getting the …

Total answers: 15

Using Python's ftplib to get a directory listing, portably

Using Python's ftplib to get a directory listing, portably Question: You can use ftplib for full FTP support in Python. However the preferred way of getting a directory listing is: # File: ftplib-example-1.py import ftplib ftp = ftplib.FTP(“www.python.org”) ftp.login(“anonymous”, “ftplib-example-1”) data = [] ftp.dir(data.append) ftp.quit() for line in data: print “-“, line Which yields: $ …

Total answers: 7