Tagged Questions
67
votes
13answers
32k views
Which game scripting language is better to use: Lua or Python? [closed]
I have to program a game engine starting very soon for a 3rd year Games technology project. As a part of our project we have to integrate a scripting language for scripting our NPCs and other elements ...
28
votes
4answers
22k views
Driving Excel from Python in Windows
We have various spreadsheets that employ deliciously complicated macros and third party extensions to produce complicated models. I'm working on a project that involves slightly tweaking various ...
91
votes
15answers
94k views
In Python, how do I get the path and name of the file that is currently executing?
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process.
For example, let's say I have three files. Using execfile, ...
21
votes
8answers
4k views
How can I sandbox Python in pure Python?
I'm developing a web game in pure Python, and want some simple scripting available to allow for more dynamic game content. Game content can be added live by privileged users.
It would be nice if the ...
23
votes
5answers
50k views
How to execute Python scripts in Windows?
I have a simple script blah.py:
import sys
print sys.argv[1]
If I execute my script by:
python c:/..../blah.py argument
It prints argument but if I execute script by:
blah.py argument
error ...
14
votes
24answers
6k views
Which scripting language should I learn after Perl?
I have used Perl for many years now, mostly for doing all kinds of file parsing and system scripting jobs. Several newer scripting languages (python, ruby) are now available, that all in part tend to ...
5
votes
12answers
2k views
Is there a “safe” subset of Python for use as an embedded scripting language?
In the many Python applications I've created, I often create simple modules containing nothing but constants to be used as config files. Additionally, because the config file is actually a Python ...
8
votes
6answers
4k views
What cross-platform GUI libraries are simple, lightweight, and have minimal dependencies?
I've written a small command line utility in Python (ljdump if you're curious). I originally wrote it for a technical audience who is comfortable with editing textual config files and running Python ...
30
votes
7answers
31k views
How to make a python script run like a service or daemon in linux
I have written a python script that checks a certain e-mail address and passes new e-mails to an external program. How can I get this script to execute 24/7, such as turning it into daemon or service ...
39
votes
4answers
26k views
deleting items from a dictionary while iterating over it
Is it legitimate to delete items from a dictionary in Python while iterating over it?
For example:
for k, v in mydict.iteritems():
if k == val:
del mydict[k]
The idea is to remove elements ...
31
votes
5answers
28k views
Python recursive folder read
I have a C++/Obj-C background and I am just discovering Python (been writing it for about an hour).
I am writing a script to recursively read the contents of text files in a folder structure.
The ...
37
votes
7answers
6k views
Why the Global Interpreter Lock?
What is exactly the function of Python's Global Interpreter Lock?
Do other languages that are compiled to bytecode employ a similar mechanism?
7
votes
7answers
1k views
Is it good style to call bash commands within a Python script using os.system(“bash code”)?
I was wondering whether or not it is considered a good style to call bash commands within a Python script using os.system(). I was also wondering whether or not it is safe to do so as well.
I know ...
3
votes
4answers
477 views
File Manipulation: Scripting Question
I have a script which connects to database and gets all records which statisfy the query. These record results are files present on a server, so now I have a text file which has all file names in it.
...
27
votes
11answers
6k views
Lua as a general-purpose scripting language?
When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW".
Why is it limited to embedding the ...