Is there a way to encrypt files (.zip, .doc, .exe, ... any type of file) with Python?
I've looked at a bunch of crypto libraries for Python including pycrypto and ezpycrypto but as far as I see they only offer string encryption.
hi ,
Mine is similar to this question.
http://stackoverflow.com/questions/2042342/network-path-and-variables-in-python/2042376
The only difference is my network drive has a password protect with user name and password .
I need to copy files to a samba share using python and verify it.
if i manually login in then the code works but without logging in the shutil command does not work
Thanks
Hi,
I am very new to Python, I need to read numbers from a file and store them in a matrix like I would do it in fortran or C;
for i
for j
data[i][j][0]=read(0)
data[i][j][1]=read(1)
data[i][j][2]=read(2)
...
...
How can I do the same in Python? I read a bit but got confused with tuples and similar things
If you could point me to a similar example it would be great
thanks
I have a file called foobar (without .py extension). In the same directory I have another python file that tries to import it:
import foobar
But this only works if I rename the file to foobar.py. Is it possible to import a python module that doesn't have the .py extension?
I'm porting over a program of mine from python2 to python3, and I'm hitting the following error: AttributeError: 'HTTPMessage' object has no attribute 'getdate'
Here's the code:
conn = urllib.request.urlopen(fileslist, timeout=30)
last_modified = conn.info().getdate('last-modified')
This section worked under python 2.7, and so far I haven't been able to find out the correct method to get this information in python 3.1.
The full context is an update method. It pulls new files from a server down to its local database, but only if the file on the server is newer than the local file. If there's a smarter way to achieve this functionality than just comparing local and remote file timestamps, then I'm open to that as well.
Given a class such as
def MyClass
text = "hello"
number = 123
Is there a way in python to inspect MyClass an determine that it has the two attributes text and number. I can not use something like inspect.getSource(object) because the class I am to get it's attributes for are generate using SWIG (so they are hidden in .so :) ).
So I am really looking for something equivalant to Java's [Class.getDeclardFields][1]
Any help would be appreciated, otherwise I'll have to solve this problem with SWIG + JAVA instead of SWIG + Python.
Hi,
Has anyone used scipy-cluster for python? I am trying to compile its source code with python 2.6 but I get some irrelevant errors. has someone had the same problem?
I've created iPhone app with in-app purchase.
Now, I'm in testing phase.
I created provisioning profile com.satyam.testapp
In iTunes connected I created the application and uploaded the images, screen shots, desscription etc. I also created two id's for in-app purchase. One is com.satyam.testapp.book1 and the other one is com.satyam.testapp.book5
I created test account also for verifying my in-app purchases.
Using com.stayam.testapp i created developer test profile and using the same in my developed application.
I logged out the itunes app store account in my iphone.
Now i started running my application on my iphone. Its saying that no items are there to purchase. But its not even asking me for credentials where i've to enter test account username and password.....
how to debug it?
Here's my delegate:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *myProduct = [[NSArray alloc] initWithArray:response.products];
for(int i=0;i<[myProduct count];i++)
{
SKProduct *product = [myProduct objectAtIndex:i];
NSLog(@"Name: %@ - Price: %f",[product localizedTitle],[[product price] doubleValue]);
NSLog(@"Product identifier: %@", [product productIdentifier]);
}
for(NSString *invalidProduct in response.invalidProductIdentifiers)
NSLog(@"Problem in iTunes connect configuration for product: %@", invalidProduct);
[request autorelease];
[myProduct release];
}
Hi,
I'm looking for a python library for finding the longest common substring from a set of python strings.
I'have read that it exist to way to solve this problem :
- one using suffix trees
- the other using dynamic programming.
The method implemented is not important. Otherwise, it is important to have a implementation that can be use for a set of strings and not only two strings
Thanks,
Hi,
We plan to advertise our iphone app on other sites. Is there a way to track from which website my iphone app hyperlink was clicked when a purchase is made? Can this be programmed, or is there any analytics app which does this. We will want to track the exact number of sales made from each site..
Appreciate any help..
mb
I have written a Python application and would like to give my users the option of having the app automatically launch itself when the user logs in. It is important that the user is able to toggle this option on/off from within the app itself, rather than having to manually edit login scripts, so this needs to be done from within the Python code rather than from a shell script. The app is deployed on Ubuntu Linux, any suggestions for the best way of doing this?
I found this python plugin list but thought I'd ask if anyone has any experience with anything listed there?
I'm totally new to both python and dynamic programming languages if that makes any difference.
I want to use the Twitter API in Python to lookup user ids from name using the lookup method. I have done similar requests simply using
response = urllib2.urlopen('http://search.twitter.com...')
but for this one I need authentication. I don't think I can do it through the Googlepython twitter API because it doesn't have the lookup method. Any ideas how can I can auth with urllib2??
I have this Python application that gets stuck from time to time and I can't find out where.
Is there any way to signal Python interpreter to show you the exact code that he's running (somekind of stacktrace on-the-fly)?
I am building a web application that is currently PHP with MySQL. There is payment on the website so the db tables are InnoDB with transactions.
Can this type of application be implemented in Google's AppEngine.
Using Python I need to insert a newline character into a string every 64 characters. In Perl it's easy:
s/(.{64})/$1\n/
How could this be done using regular expressions in Python?
Is there a more pythonic way to do it?
I'm looking to achieve the following:
For a specific person, for example BarackObama, I'd like to get the last 100 times/tweets he was mentioned. Not his own tweets but the tweets of others containing @BarackObama.
In the end I'd like to have: the person who mentioned, location, datetime.
This content should be written to a flat file.
I've been experimenting with the Twitter API and Python, with success but haven't yet succeeded achieving the above problem.
I know there is a dev sections on the twitter website but they don't provide any example of code!!
https://dev.twitter.com/docs/api/1/get/statuses/mentions
count=100 ....
For me the scripting language or way of doing is not relevant it's the result. I just read on the internet that python and Twitter api are a good match.
Thanks a lot in advance!!
Hi,
Im fighting with installation SIP for Python on Mac OS X. Finally after compilation and installation when I run console form folder of SIP (locally) I can import sipconfig, but when Im in other folder I cant - there is no module called sipconfig.
My question is - Where is folder to which I have to copy modules if I want to have them available globally (like "import os"), or how I can check it, because location "/Library/Python/2.6/site-packages/" doesn`t work.
how can i have python move to the top of an if statement if nothing is satisfied correctly
i have a basic if/else statement like this:
print "pick a number, 1 or 2"
a = int(raw_input("> ")
if a == 1:
print "this"
if a == 2:
print "that"
else:
print "you have made an invalid choice, try again."
what i want is to prompt the user to make another choice for 'a' this if statement without them having to restart the entire program, but am very new to python and am having trouble finding the answer online anywhere.
hi, i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any programming language implemented in pure python which i can see as a reference ( or use directly ? ) -- i need simple language ( simple statements and ifs can do )
Hello,
I am trying to retrieve some local restaurants using the LocalSearch Google API. I am initializing the search objects in the OnLoad function and I am calling the searchControl execute function when the user clicks on a search button.
The problem is that my function attached to setSearchCompleteCallback never get called.
Please let me know what I am doing wrong here.
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('maps' , '2');
google.load('search' , '1');
var searcher, searchControl;
function OnLoad() {
searchControl = new google.search.SearchControl();
searcher = new google.search.LocalSearch(); // create the object
// Add the searcher to the SearchControl
searchControl.addSearcher(searcher);
searchControl.setSearchCompleteCallback(searcher , function() {
var results = searcher.results; // Grab the results array
// We loop through to get the points
for (var i = 0; i < results.length; i++) {
var result = results[i];
}
});
$('#user_search_address').live('click', function() {
g_searchControl.execute('pizza san francisco');
});
}
google.setOnLoadCallback(OnLoad);
</script>
If I have a recorded audio file (MP3), is there any way to get the figure out the DTMF tones that were recorded in pure Python?
(If pure python is not available, then Java is okay too. The point being that it should be able to run in Google Appengine)
Hi, I am trying to send raw xml to a service in Python. I have a the address of the service and my question is how would I wrap XML in python and send it to the service. The address is in the format below.
192.1100.2.2:54239
And say the XML is:
<xml version="1.0" encoding="UTF-8"><header/><body><code><body/>
Anyone know what to do?