import

Importing python variables of a program after its execution.

Hello, I've written two python scripts script1.py and script2.py. I want to run script1.py from script2.py and get the content of the variables of script1 created during the execution of script1. Script1 has several functions in which the variables are created including in the main. rgds, Bruno Thank you for all your answers. I've...

Is it good design to create a module-wide logger in python?

When coding python, I use the logging module a lot. After some bad experiences and reading articles like this one, I try to prevent import-time executed code wherever possible. However, for the sake of simplicity, I tend to get my logging object right at the beginning of the module file: # -*- coding: utf-8 -*- import logging logger =...

imports and extends

can any one explain " While we are importing a package we can use its all public functions, Then what is the use of extending a class ?" " I m studying OOP Langusges for 3 years and i didnt get ans to this question " ...

PostgreSQL throws error: "ERROR: permission denied for relation table_name"

Hey, I'm trying to import a schema-dump into PostgreSQL with 'psql -U username -W dbname < migrations/schema.psql', the Schema is imported partly, but the console throws errors like "ERROR: permission denied for relation table_name" and "ERROR: relation table_name does not exist". I've created the database like this: "createdb -O usern...

Why no option to import a WAR file into Eclipse?

I have a WAR file for a Java project but when I try to import it into Eclipse, the only option is for archive files such as tar, zip, jar - nothing for war. Is this only an option in certain editions of Eclipse because I have a copy of SpringSource (also Eclipse-base) that allows me to import WAR files? Would it be possible to add this...

Faster way to import thousands of records from a single txt file into database MySQL?

I have like 50 txt files each with around 8 columns and 80,000 records. I have written a script in Matlab that reads all the files one by one and then puts it into MySQL using a single INSERT statement for each file. However doing so is taking a huge amount of time(even for a single file!). I have also tried using PHPmyAdmin which says t...

Build android branch missing imports

I'm working on nifty enhancements to an Android app and I've cloned its source from android.git.kernel.org. How does one deal with imports not found, for example: import android.content.entity* import android.os.ServiceManager import com.google.android.collect.* import com.android.internal.* etc. This is with a checkout of tag Androi...

How to change a module variable from another module?

Suppose I have a package named bar, and it contains bar.py: a = None def foobar(): print a and __init__.py: from bar import a, foobar Then I execute this script: import bar print bar.a bar.a = 1 print bar.a bar.foobar() Here's what I expect: None 1 1 Here's what I get: None 1 None Can anyone explain my misconception?...

after importing products into magento they dont show up catalog

After i import the products into magento which appears to go smoothly no errors; the products aren't visible in the store. however if i go to any product and save(even without changing anything) it it is instantly available. Why are these products not visible right away... Running the latest stable build. Thanks ...

iphone sdk: how to connect two UIViewController??

Hi, i've got a problem: lets say i have two view controllers, firstViewController and secondViewController. The firstViewController is supposed to present the secondViewController and i also want to access a bunch of methods and properties from the secondViewController through the firstViewController. I do this by simply using the imp...

Import specific columns of CSV in Excel 2007

Hello, I have a csv file, which consists of many fields (columns). However, I would like to import some columns while not others. Every time I am importing csv files with same structure and selecting columns one by one takes much time. How to automatically select the columns imported? DO I need a template or VBA code? (I am lack of pro...

jsp: page imports causing a syntax error

Hello. I'm writing a jsp application, what i did so far was to include the classes i need and to write the string text: <%@ page import="com.google.code.facebookapi.FacebookException;" %> <%@ page import="com.google.code.facebookapi.FacebookWebappHelper;" %> <%@ page import="com.google.code.facebookapi.FacebookXmlRestClient;" %> <%@ p...

Import java project into eclipse

I just downloaded a Google App Engine sample Java project. I am trying to import it into eclipse. If I chose file/import/existing projects into workspace, and navigate to the appropriate directory, it doesn't find any projects. I'm speculating this means that dotmatrix is not an Eclipse project. How can I import it? Thanks. ...

Should I use from_xml or from_json for importing objects?

Hello all, I currently have a PHP app that I'm going to be rewriting in Rails. My idea is to slowly replace all of the PHP functionality with Rails, so both will need to run side-by-side (I think I've got this part figured out). Now, at the moment, each of our client's has a separate database, and as it turns out, it would be really gr...

Django / Python, using variablized object names

I'm confused on how to do this, I'm passing in a dictionary with different values, such as "app" which is the name of the app (so that I can better decouple code for easier modularization).. so this is just a simplified example and its not working so I'm wondering how to use the variable "app" within the string that is calling the models...

Any framework / 3rd party tool for importing contacts from gmail, hotmail, yahoo mail, etc

Hi, We have an application in which we want to let our users invite other contacts in their email contact lists. We;re currently using OpenInviter and it seems like that requires users to enter their email accounts and passwords on our site... which is something which we would like to avoid... A better solution would be something that ...

Pull remote SVN and merge local changes

Hi, We use WordPress for development, but often make a lot of modifications. We're looking for a way to always keep our development version up to date with our modified version. It possible to import all of the WordPress SVN commits, branches and tags, but merge these with any we've made in our repo. For example if we had removed the ...

Bug import main with arguments in Python.

Hello, In a script I'm trying to import the main module from another script with an argument. I get the error message "NameError: global name 'model' is not defined". If someone sees the mistake, I'd be grateful ! My code : script1 #!/usr/bin/python import sys import getopt import pdb import shelve class Car: """ class repre...

How to measure Python import latencies

My django application takes forever to load so I'd like to find a way to measure the import latencies so I can find the offending module and make it load lazily. Is there an obvious way to do this? I was considering tweaking the import statement itself to produce the latencies but I'm not sure exactly how to do that. I guess that it wou...

If you import yourself in Python, why don't you get an infinite loop?

This question is a response to the following SO post: http://stackoverflow.com/questions/3558718/how-do-i-pickle-an-object/3558783#3558783 In that thread, the OP accidentally imports his own module at the top of the same module. Why doesn't this cause an infinite loop? ...