import

How do I do 'from foo import *' using Python's __import__ function

I want to replace settings.py in my Django system with a module implemented as a directory settings containing __init__.py. This will try to import a module named after the server, thus allowing for per-server settings. If I don't know the name of a module before I import it then I can't use the import keyword but must instead use the _...

LOAD DATA LOCAL, How do I skip the first line?

I'm trying to Load a CSV file into my MySQL database, But I would like to skip the first line. I fact It contains the name of my columns and no interesting data. Here is the query I'm using: LOAD DATA LOCAL INFILE '/myfile.csv' INTO TABLE tableName FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERM...

Possible circular reference problem

I am not an idiot, but header files make me feel like one sometimes. I have what is probably an overly-complicated set-up that has an error that I cannot resolve. Here it is in about as simple as detail as I can make it.... I have a Controller class that contains a Model class. I have a Scene class to capture actions and communicates ...

python import error

I'm trying to use some python-2.1 code to control another program (ArcGIS). The version of python I am using is 2.5. I am getting the following error message when I run the code. <type'exceptions.ImportError'>: No module named win32api Failed to execute (polyline2geonetwork2). I tried installing pywin32-214.win32-py2.5.exe but I still...

python package import fails

I've got a trac installation which works correctly from the command line. I deployed the trac.cgi to the proper directory, but when I open the page, I get: Trac detected an internal error: No module named pkg_resources Traceback (most recent call last): File "/some/path/htdocs/trac.cgi", line 22, in ? import pkg_resources ImportE...

Can someone explain this unexpected Python import behavior?

Hi all, I've run into some behavior from Python 2.6.1 that I didn't expect. Here is some trivial code to reproduce the problem: ---- ControlPointValue.py ------ class ControlPointValue: def __init__(self): pass ---- ControlPointValueSet.py ---- import ControlPointValue ---- main.py -------------------- from ControlPointValu...

sqlite3 file import

is here a way to import a file into table with ":" being the separator? for example I have file test.txt with value1:result1 value2:result2 want to use something like this on the CLI: sqlite> .import test.txt table and at the end I would have: +--------------+ |value1|result1| +------+-------+ |value2|result2| +------+-------+ ...

Generate xml from csv data in conformance with given xsd schema

I have an xml schema and csv data to generate corresponding xml files. I found this, how to generate xml files from given CSV file. But with my schema, it's always the same mapping because of the element. So the last 5 columns are mapped according to the DataType column. I could expand the code with case switch, and map every element ...

__init__.py descends dirtree for python, but not from c++; causes "import matplotlib" error.

Why or how does the file __init__.py cause the python interpreter to search subdirectories for a module -- and why does the interpreter not honor this convention when invoked from C++? Here's what I know: Using strace on my program, I can see that the same python2.5 interpreter is being executed for both the interactive case and the ...

Load an extern C-library into an existing C++-Project (f.e. ffmpeg/libavcodec - step by step)

I really have big problems with importing an extern C-Library to my existing C++-Project. I want to import libavcodec from the FFmpeg-Project, so I downloaded the latest source-code-release. What do I have to do now? Do I have to compile FFmpeg first or can I import it just like that? A really simple step-by-step manual would be awesome!...

Jython 2.5.1: "ImportError: No Module named os"

I looked through the other posts and bug reports and couldn't figure out what's causing this. I'm using Jython 2.5.1, in a Java project in Eclipse (Ubuntu 8.10). It has been added to the project as a standalone .jar file (I just replaced the old Jython 2.1 jar with this one). I'm running a script that uses the threading.py class. At som...

mysql hanging while importing database dump

We have a db dump import script from our production db that we use to rebuild our sandbox dbs. The syntax we use for this is mysql -u uname -ppass dbname < prod_db_export.sql. The script proceeds to create the first table and then do this: LOCK TABLES `ad` WRITE; /*!40000 ALTER TABLE `ad` DISABLE KEYS */; /*!40000 ALTER TABLE `ad` ENABL...

Failure to import javax.servlet

I know this is a common error, but bear with me. I've pursued the CLASSPATH problem and I don't think that is the issue. I'm getting an error like this. ./src/process.java:2: package javax.servlet does not exist import javax.servlet.*; I installed Tomcat and the Java SDK, and I know that Tomcat is supposed to supply the servlet API. ...

Import Excel spreadsheet into PostgreSQL

I need to be able to import an Excel spreadsheet into a PostgreSQL database. The goal is for use with a Rails application. I have looked at the Roo gem and it takes 16 seconds to convert a 2000 line XLS file to CSV which is unacceptable. So I was wondering if I could just short-circuit the Rails application and import directly into Postg...

css import from another server

it is possible to import the css file from another server? let's say i have my html on www.mysite.com can i import my css like this? <link href="www.anothersite.com/style.css" rel="stylesheet" type="text/css" /> ...

What's the difference between import java.util.*; and import java.util.Date; ?

I just want to output current and I wrote import java.util.*; at beginning, and System.out.println(new Date()); in the main part. But what I got was something like this: Date@124bbbf When I change the import to import java.util.Date; the code works perfectly, why? ==================================== The problem was, OK, my so...

MySQL LOAD DATA INFILE - Loading a file with no primary key

I was trying to load a data file into mysql table using "LOAD DATA LOCAL INFILE 'filename' INTO TABLE 'tablename'". The problem is the source data file contains data of every fields but the primary key is missing ('id' column). I have to add a unique id to each line of source data file otherwise the import will not go through. Is ther...

FasterCSV: columns into an array -- rails

I'm trying to get fastercsv setup so that rather than parsing each row, it will place each column into an multi array. CSV import file: id, first name, last name, age 1, joe, smith, 11 2, jane, doe, 14 Save to array named people: people[0][0] would equal id people[2][1] would equal jane This is what I currently have: url = 'http://u...

Export subtree in Git with history

I have a folder in my Git repository that I'd like to move out in to its own repository. Is it possible to move the history of that folder along with the folder? I've previously been doing just a git rm -r --cached subfolder/ and then git init on the subfolder. However, the history is not imported in to the new repository. ...

*.dmp file import in Oracle

I need to import data from *.dmp file say mydump.dmp. What I'm doing is: imp myuser/mypass file=mydump.dmp log=mylog.log And I'm getting: only a DBA can import a file exported by another DBA I know the DBA credentianls to db but I want to import dump into 'myuser' schema. So how to do it? ...