The title says it all... I'm creating Python software that compresses files/folders... How would I create a section of the code that asks for the user input of the folder location and then compresses it. I currently have the code for a single file but not a folder full of files. Please explain in detail how to do this. Thanks!
...
I'm decorating a function as such:
def some_abstract_decorator(func):
@another_lower_level_decorator
def wrapper(*args, **kwargs):
# ... details omitted
return func(*args, **kwargs)
return wrapper
This does what you'd expect (applies a low level decorator and then does some more stuff. My problem is that I ...
Hello,
I'm working on a robotic problem. The situation is something like this:
There are N number of robots (generally N>100) initially all at rest.
Each robot attracts all other robots which are with in its radius r.
I've set of equations with which I can compute acceleration, velocity & hence the position of the robot after time del...
Hi all,
I want to use scipy.spatial's KDTree to find nearest neighbor pairs in a two dimensional array (essentially a list of lists where the dimension of the nested list is 2). I generate my list of lists, pipe it into numpy's array and then create the KDTree instance. However, whenever I try to run "query" on it, I inevitably get weir...
I have start a project to redefine keyboard layout for coders.under GPLv3
The most popular layout is qwerty, then dvorak, then colemak. but qwerty and dvorak is design for typewriter, and colemak is design for easy to learn. but this layout is design for coders.
5~ 3! 1@ 0$ 29 48 67 #` *^ y w x q
Tab (\ c d .< ,>...
I'm thinking of making an alarm clock that can wake up some systems (depending on motherboard model) from hibernation/standby modes at a certain pre-determined time. I've seen similar software do this, I think in VB. I can't seem to find any documentation anywhere on how to do this in Python. Does anyone have any hints? If it's not possi...
I'm using Java Scripting API to execute some external Python scripts from my Java application. The python scripts use sqlite3 module. Execution of the application is resulting in error
ImportError: No module named sqlite3
As I look into the Lib directory(which is in the classpath) of Jython, there's no sqlite3 module. Hence, my search...
hi i have a string like this
track._Event('product', 'test');Product.lisen(1234, 21, 4343); return false;
i want to use some regular expression so i would end up with groups
pid = 1234
p1 = 21
p2 = 4343
...
The title may be a bit vague, but here's my goal: I have a frontend webserver which takes incoming HTTP requests, does some preprocessing on them, and then passes the requests off to my real webserver to get the HTTP response, which is then passed back to the client.
Currently, my frontend is built off of BaseHTTPServer.HTTPServer and ...
Hello,
When creating a template in Mako, I would need to write things like : ${_('Hello, %(fname)s %(lname)s') % {'fname':'John','lname':'Doe'}}
I keep getting SyntaxException: (SyntaxError) unexpected EOF while parsing when writing that. Is there wny way to do the same ?
${_('Hello, %s %s') % ('John', 'Doe')} works, but it does not a...
I am using the YAML parser from http://pyyaml.org and I want it to always interpret certain fields as string, but I can't figure out how add_path_resolver() works.
For example: The parser assumes that "version" is a float:
network:
- name: apple
- name: orange
version: 2.3
site: banana
Some files have "version: 2" (which is interpret...
In Python, the with statement is used to make sure that clean-up code always gets called, regardless of exceptions being thrown or function calls returning. For example:
with open("temp.txt", "w") as f:
f.write("hi")
raise ValueError("spitespite")
Here, the file is closed, even though an exception was raised. A better explanat...
Hey there, everyone. A really random question, but I'm looking to get into some GUI programming with Python, specifically with the PyGTK library. I've only ever done GUI programming with Java/Swing, and I'd like to do some independent, personal projects in Python as a way of learning my way around the language, since it's been something ...
I have a file with dates and times listed as huge numbers like 634213557000000000. I believe this is a .NET tick. That's the number of 100 nanosecond increments since midnight on January 1, 1 A.D. What's a good way to read that into a python datetime object?
...
I need to automate something like this:
Open an URL
Wait until the page is fully loaded
Save COMPLETE page as... (I can provide a name).
I saw https://developer.mozilla.org/en/Command_Line_Options but I can't find an option to invoke the command "save page as... (in mode Web page complete)". So I can have all css, js, xml and related...
... or if not, can you provide me link or RFC number to full algorithm (from getting ASCII encoded Private key file/string to generation of ASCII encoded public key file/string).
To show you a bigger picture - I started using a pylibssh2 library. This library has a method - userauth_publickey_fromfile (it raises NotImplementedException,...
I have a subclassed QFrame that generates a list of buttons when my project loads, and at times, I want to be able to completely destroy and rebuild "buttonGrid".
Rather than add a button in the proper spot with the proper geometry settings etc. I figured it'd be easiest to destroy this and then call it again as it was originally one. ...
I'm using Python and Tkinter, and I want the equivalent of onchange event from other toolkits/languages. I want to run code whenever the user updates the state of some widgets.
In my case, I have many Entry, Checkbutton, Spinbox and Radiobutton widgets. Whenever any one of these changes, I want to run my code (in this case, update a tex...
Hello
I need to either call exec() or eval() based on an input string "s"
If "s" was an expression, after calling eval() I want to print the result if the result was not None
If "s" was a statement then simply exec(). If the statement happens to print something then so be it.
s = "1 == 2" # user input
# ---
try:
v = eval(s)
...
I'm using pyinotify to watch a folder for when files are created in it. And when certain files are created I want to move them. The problem is that as soon as the file is created (obviously), my program tries to move it, even before it's completely written to disk.
Is there a way to make pyinotify wait until a file is completely written...