text stringlengths 200 200k | source stringclasses 2
values |
|---|---|
# Is there a way around coding in Python without the tab, indent & whitespace criteria?
## Question
I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using ... | stackoverflow-qa |
# Is there a way around coding in Python without the tab, indent & whitespace criteria?
## Question
I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using ... | stackoverflow-qa |
# Is there a way around coding in Python without the tab, indent & whitespace criteria?
## Question
I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using ... | stackoverflow-qa |
# Is there a way around coding in Python without the tab, indent & whitespace criteria?
## Question
I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using ... | stackoverflow-qa |
# Is there a way around coding in Python without the tab, indent & whitespace criteria?
## Question
I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using ... | stackoverflow-qa |
# Is there a way around coding in Python without the tab, indent & whitespace criteria?
## Question
I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using ... | stackoverflow-qa |
# How create threads under Python for Delphi
## Question
I'm hosting Python script with Python for Delphi components inside my Delphi application. I'd like to create background tasks which keep running by script.
Is it possible to create threads which keep running even if the script execution ends (but not the host ... | stackoverflow-qa |
# Classes in Python
## Question
In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second cla... | stackoverflow-qa |
# Classes in Python
## Question
In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second cla... | stackoverflow-qa |
# Classes in Python
## Question
In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second cla... | stackoverflow-qa |
# Classes in Python
## Question
In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second cla... | stackoverflow-qa |
# Classes in Python
## Question
In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second cla... | stackoverflow-qa |
# Classes in Python
## Question
In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second cla... | stackoverflow-qa |
# Nice Python wrapper for Yahoo's Geoplanet web service?
## Question
Has anybody created a nice wrapper around Yahoo's geo webservice "GeoPlanet" yet?
## Answer
After a brief amount of Googling, I found nothing that looks like a wrapper for this API, but I'm not quite sure if a wrapper is what is necessary for GeoPla... | stackoverflow-qa |
# When to create a new app (with startapp) in Django?
## Question
I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of th... | stackoverflow-qa |
# When to create a new app (with startapp) in Django?
## Question
I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of th... | stackoverflow-qa |
# When to create a new app (with startapp) in Django?
## Question
I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of th... | stackoverflow-qa |
# When to create a new app (with startapp) in Django?
## Question
I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of th... | stackoverflow-qa |
# When to create a new app (with startapp) in Django?
## Question
I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of th... | stackoverflow-qa |
# How can I access App Engine through a Corporate proxy?
## Question
I have corporate proxy that supports https but not HTTP CONNECT (even after authentication). It just gives 403 Forbidden in response anything but HTTP or HTTPS URLS. It uses HTTP authenication, not NTLM. It is well documented the urllib2 does not wor... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Best Python supported server/client protocol?
## Question
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a ... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# Sending mail from Python using SMTP
## Question
I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ?
from smtplib import SMTP
import datetime
debuglevel = 0
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('YOUR.MAIL.SERVER'... | stackoverflow-qa |
# How to setup VIM autoindentation properly for editing Python files - *.py
## Question
I've troubles setting VIM (7.1.xxx) for editing python files.
Indenting seems to be broken (optimal 4 spaces).
I've followed some tutorials I found via Google. Still no effect :/
Please help.
## Answer
I use this on my macbook:
... | stackoverflow-qa |
# How to setup VIM autoindentation properly for editing Python files - *.py
## Question
I've troubles setting VIM (7.1.xxx) for editing python files.
Indenting seems to be broken (optimal 4 spaces).
I've followed some tutorials I found via Google. Still no effect :/
Please help.
## Answer
Ensure you are editing the... | stackoverflow-qa |
# How to setup VIM autoindentation properly for editing Python files - *.py
## Question
I've troubles setting VIM (7.1.xxx) for editing python files.
Indenting seems to be broken (optimal 4 spaces).
I've followed some tutorials I found via Google. Still no effect :/
Please help.
## Answer
I use the vimrc in the pyt... | stackoverflow-qa |
# How to setup VIM autoindentation properly for editing Python files - *.py
## Question
I've troubles setting VIM (7.1.xxx) for editing python files.
Indenting seems to be broken (optimal 4 spaces).
I've followed some tutorials I found via Google. Still no effect :/
Please help.
## Answer
I use:
$ cat ~/.vimrc
syn... | stackoverflow-qa |
# Caching compiled regex objects in Python?
## Question
Each time a python file is imported that contains a large quantity of static regular expressions, cpu cycles are spent compiling the strings into their representative state machines in memory.
a = re.compile("a.*b")
b = re.compile("c.*d")
...
Question: Is it p... | stackoverflow-qa |
# Caching compiled regex objects in Python?
## Question
Each time a python file is imported that contains a large quantity of static regular expressions, cpu cycles are spent compiling the strings into their representative state machines in memory.
a = re.compile("a.*b")
b = re.compile("c.*d")
...
Question: Is it p... | stackoverflow-qa |
# Caching compiled regex objects in Python?
## Question
Each time a python file is imported that contains a large quantity of static regular expressions, cpu cycles are spent compiling the strings into their representative state machines in memory.
a = re.compile("a.*b")
b = re.compile("c.*d")
...
Question: Is it p... | stackoverflow-qa |
# How to add method using metaclass
## Question
How do I add an instance method to a class using a metaclass (yes I do need to use a metaclass)? The following kind of works, but the func_name will still be "foo":
def bar(self):
print "bar"
class MetaFoo(type):
def __new__(cls, name, bases, dict):
dic... | stackoverflow-qa |
# How to add method using metaclass
## Question
How do I add an instance method to a class using a metaclass (yes I do need to use a metaclass)? The following kind of works, but the func_name will still be "foo":
def bar(self):
print "bar"
class MetaFoo(type):
def __new__(cls, name, bases, dict):
dic... | stackoverflow-qa |
# Decorating a parent class method
## Question
I would like to make a child class that has a method of the parent class where the method is a 'classmethod' in the child class but not in the parent class.
Essentially, I am trying to accomplish the following:
class foo(Object):
def meth1(self, val):
self.v... | stackoverflow-qa |
# Decorating a parent class method
## Question
I would like to make a child class that has a method of the parent class where the method is a 'classmethod' in the child class but not in the parent class.
Essentially, I am trying to accomplish the following:
class foo(Object):
def meth1(self, val):
self.v... | stackoverflow-qa |
# How do I create a new signal in pygtk
## Question
I've created a python object, but I want to send signals on it. I made it inherit from gobject.GObject, but there doesn't seem to be any way to create a new signal on my object.
## Answer
Here is how:
import gobject
class MyGObjectClass(gobject.GObject):
...
... | stackoverflow-qa |
# How do I create a new signal in pygtk
## Question
I've created a python object, but I want to send signals on it. I made it inherit from gobject.GObject, but there doesn't seem to be any way to create a new signal on my object.
## Answer
You can also define signals inside the class definition:
class MyGObjectClas... | stackoverflow-qa |
# How do I create a new signal in pygtk
## Question
I've created a python object, but I want to send signals on it. I made it inherit from gobject.GObject, but there doesn't seem to be any way to create a new signal on my object.
## Answer
If you use kiwi available here you can just do:
from kiwi.utils import gsign... | stackoverflow-qa |
# why might my pyglet vertex lists and batches be very slow on Windows?
## Question
I'm writing opengl code in python using the library pyglet. When I draw to the screen using pyglet.graphics.vertex_list or pyglet.graphics.batch objects, they are very slow (~0.1 fps) compared to plain old pyglet.graphics.draw() or jus... | stackoverflow-qa |
# why might my pyglet vertex lists and batches be very slow on Windows?
## Question
I'm writing opengl code in python using the library pyglet. When I draw to the screen using pyglet.graphics.vertex_list or pyglet.graphics.batch objects, they are very slow (~0.1 fps) compared to plain old pyglet.graphics.draw() or jus... | stackoverflow-qa |
# Serving dynamically generated ZIP archives in Django
## Question
How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my s... | stackoverflow-qa |
# Serving dynamically generated ZIP archives in Django
## Question
How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my s... | stackoverflow-qa |
# Serving dynamically generated ZIP archives in Django
## Question
How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my s... | stackoverflow-qa |
# Serving dynamically generated ZIP archives in Django
## Question
How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my s... | stackoverflow-qa |
# Serving dynamically generated ZIP archives in Django
## Question
How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my s... | stackoverflow-qa |
# Serving dynamically generated ZIP archives in Django
## Question
How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my s... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
I believe you can use imp.find_module() and imp.load_module() to load the specified module. You'll need to spl... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
For Python 3.5+ use:
import importlib.util
spec = importlib.util.spec_from_file_location("module.name", "/path... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
You can use the
load_source(module_name, path_to_file)
method from imp module.
Tags: python, configuratio... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
Import package modules at runtime (Python recipe)
http://code.activestate.com/recipes/223972/
##############... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
You can also do something like this and add the directory that the configuration file is sitting in to the Pyth... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
Do you mean load or import?
You can manipulate the sys.path list specify the path to your module, then import ... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
def import_file(full_path_to_module):
try:
import os
module_dir, module_file = os.path.spli... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
The advantage of adding a path to sys.path (over using imp) is that it simplifies things when importing more th... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
I made a package that uses imp for you. I call it import_file and this is how it's used:
>>>from import_file i... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
This should work
path = os.path.join('./path/to/folder/with/py/files', '*.py')
for infile in glob.glob(path):
... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
You can use the pkgutil module (specifically the walk_packages method) to get a list of the packages in the cur... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
In Linux, adding a symbolic link in the directory your python script is located works.
ie:
ln -s /absolute/p... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
This area of Python 3.4 seems to be extremely tortuous to understand! However with a bit of hacking using the c... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
I'm not saying that it is better, but for the sake of completeness, I wanted to suggest the exec function, avai... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
To import a module from a given filename, you can temporarily extend the path, and restore the system path in t... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
It sounds like you don't want to specifically import the configuration file (which has a whole lot of side effe... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
Here is some code that works in all Python versions, from 2.7-3.5 and probably even others.
config_file = "/tm... | stackoverflow-qa |
# How to import a module given the full path?
## Question
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
## Answer
import sys
sys.path.append('/your/modul/path')
Tags: python, configuration, python-import, python-module | stackoverflow-qa |
# Why do you need explicitly have the "self" argument into a Python method?
## Question
When defining a method on a class in Python, it looks something like this:
class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
But in some other languages, such as C#, you have a reference ... | stackoverflow-qa |
# Why do you need explicitly have the "self" argument into a Python method?
## Question
When defining a method on a class in Python, it looks something like this:
class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
But in some other languages, such as C#, you have a reference ... | stackoverflow-qa |
# Why do you need explicitly have the "self" argument into a Python method?
## Question
When defining a method on a class in Python, it looks something like this:
class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
But in some other languages, such as C#, you have a reference ... | stackoverflow-qa |
# Why do you need explicitly have the "self" argument into a Python method?
## Question
When defining a method on a class in Python, it looks something like this:
class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
But in some other languages, such as C#, you have a reference ... | stackoverflow-qa |
# Why do you need explicitly have the "self" argument into a Python method?
## Question
When defining a method on a class in Python, it looks something like this:
class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
But in some other languages, such as C#, you have a reference ... | stackoverflow-qa |
# Why do you need explicitly have the "self" argument into a Python method?
## Question
When defining a method on a class in Python, it looks something like this:
class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
But in some other languages, such as C#, you have a reference ... | stackoverflow-qa |
# Change command Method for Tkinter Button in Python
## Question
I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created?
## Answer
Sure; just use the bind method to specify the callback aft... | stackoverflow-qa |
# Change command Method for Tkinter Button in Python
## Question
I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created?
## Answer
Though Eli Courtwright's program will work fine¹, what yo... | stackoverflow-qa |
# How to copy a file to a remote server in Python using SCP or SSH?
## Question
I have a text file on my local machine that is generated by a daily Python script run in cron.
I would like to add a bit of code to have that file sent securely to my server over SSH.
## Answer
If you want the simple approach, this shou... | stackoverflow-qa |
# How to copy a file to a remote server in Python using SCP or SSH?
## Question
I have a text file on my local machine that is generated by a daily Python script run in cron.
I would like to add a bit of code to have that file sent securely to my server over SSH.
## Answer
You'd probably use the subprocess module. ... | stackoverflow-qa |
# How to copy a file to a remote server in Python using SCP or SSH?
## Question
I have a text file on my local machine that is generated by a daily Python script run in cron.
I would like to add a bit of code to have that file sent securely to my server over SSH.
## Answer
There are a couple of different ways to ap... | stackoverflow-qa |
# How to copy a file to a remote server in Python using SCP or SSH?
## Question
I have a text file on my local machine that is generated by a daily Python script run in cron.
I would like to add a bit of code to have that file sent securely to my server over SSH.
## Answer
To do this in Python (i.e. not wrapping sc... | stackoverflow-qa |
# How to copy a file to a remote server in Python using SCP or SSH?
## Question
I have a text file on my local machine that is generated by a daily Python script run in cron.
I would like to add a bit of code to have that file sent securely to my server over SSH.
## Answer
fabric could be used to upload files vis s... | stackoverflow-qa |
# How to copy a file to a remote server in Python using SCP or SSH?
## Question
I have a text file on my local machine that is generated by a daily Python script run in cron.
I would like to add a bit of code to have that file sent securely to my server over SSH.
## Answer
Reached the same problem, but instead of "... | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
Yes. You'd use the urllib2 module, and encode using the multipart/form-data content type. Here is some sample code to get you started -- it's a bit more than just file uploading, but you sh... | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
This code might be of use to you
Tags: python, post, file-upload, http-post | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
Blatant self-promotion:
check out my poster module for python. It handles the multipart/form-data encoding, as well as supporting streaming uploads (so you don't have to load the entire f... | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
Chris Atlee's poster library works really well for this (particularly the convenience function poster.encode.multipart_encode()). As a bonus, it supports streaming of large files without lo... | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
The only thing that stops you from using urlopen directly on a file object is the fact that the builtin file object lacks a len definition. A simple way is to create a subclass, which provi... | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
From http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
Requests makes it very simple to upload Multipart-encoded files:
>>> r = requests.post('http:... | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
Looks like python requests does not handle extremely large multi-part files.
The documentation recommends you look into requests-toolbelt.
Here's the pertinent page from their documentati... | stackoverflow-qa |
# Send file using POST from a Python script
## Question
Is there a way to send a file using POST from a Python script?
## Answer
I am trying to test django rest api and its working for me:
def test_upload_file(self):
filename = "/Users/Ranvijay/tests/test_price_matrix.csv"
data = {'file': open(filena... | stackoverflow-qa |
# Are tuples more efficient than lists in Python?
## Question
Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements?
## Answer
Tuples should be slightly more efficient and because of that, faster, than lists because they are immutable.
Tags: python, per... | stackoverflow-qa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.