import

Python Import and 'object has no attribute' with Qt

From research on Stack Overflow and other sites I'm 99% sure that the problem I'm having is due to incorrect importing. Below is a QLabel sub class that I'm using to respond to some mouse events: import Qt import sys class ASMovableLabel(Qt.QLabel): def mouseReleaseEvent(self, event): button = event.button() if b...

How can I import a C++ python extension into a module in another directory?

Here is the directory structure: app/ __init__.py sub1/ __init__.py mod1.py sub2/ __init__.py sub2.so test_sub2.py The folder app is on my PYTHONPATH All of the _init_.py files are empty. The shared library sub2.so is a C++ extension module that I compiled using cmake and boost-pyth...

How to import java class?

Possible Duplicate: Import package.* vs import package.SpecificType Can I do: import java.awt.* instead of: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; if both ways are correct which one is better? ...

How to force an ImportError on development machine? (pwd module)

I'm trying to use a third-party lib (docutils) on Google App Engine and have a problem with this code (in docutils): try: import pwd do stuff except ImportError: do other stuff I want the import to fail, as it will on the actual GAE server, but the problem is that it doesn't fail on my development box (ubuntu). How to make...

load python code at runtime

I would like to load a .py file at runtime. This .py file is basically a config file of the following format: var1=value var2=value predicate_function=func line : Once this file is loaded, I would like to be able to access var1, var2 and predicate_function. For each line, I'll pass it to the predicate func, if it returns...

How to make my Python unit tests to import the tested modules if they are in sister folders?

I am still getting my head around the import statement. If I have 2 folders in the same level: src test How to make the py files in test import the modules in src? Is there a better solution (like put a folder inside another?) ...

How to import existing project into Workplace in Eclipse?

I am trying to follow Eclipse instructions to create a Hello World SWT application. I have the following instruction: Import the SWT project from the main menu via File > Import..., and select Existing Projects into Workspace. Specify the archive file you downloaded and click Finish. This will create the org.eclipse.swt pro...

Error doing an MSBuild on a CLR Storedprocedure project on Build Server

Hi, When building a CLR Storedprocedure Project using MSBuild on our build server (Team City) we're getting the following error: error MSB4019: The imported project "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\SqlServer.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists o...

Dynamic class loading in Python 2.6: RuntimeWarning: Parent module 'plugins' not found while handling absolute import

I am working on a plugin system where plugin modules are loaded like this: def load_plugins(): plugins=glob.glob("plugins/*.py") instances=[] for p in plugins: try: name=p.split("/")[-1] name=name.split(".py")[0] log.debug("Possible plugin: %s", name) f, file, desc=imp.find_module(name...

Why "Source > Organize Imports" does not work in Eclipse?

I am writning a Hello World SWT application in Eclipse (I follow instructions given by Eclipse). At some point I have to "Right click in the Java editor and select Source > Organize Imports". I did it in Eclipse installed on Ubuntu. This operation has generated import statements in the beginning of my code. But it was not sufficient to ...

How can 4,000 products be easily transfered from one ecommerce solution to another?

A potential client has a slow ecommerce site using Joomla/Virtuecart which takes 6-10 seconds for any page to load. I've seen faster solutions and would like to transfer the 4,000+ products with little hassle to a speedier, more full-featured open-source solution. Is there a good way to transfer thousands of products between ecommerce ...

Python imports with different directory structures

I'm working on a project where all the code in the source tree is separated into module directories, e.g.: modules/check/lib/check.py modules/edit/lib/edit.py During installation, the Python files are put in the same directory program_name under Python's site-packages. All the modules therefore use the syntax import program_name.edit....

Import/Exporting databases from one machine to another

I have two PCs, one is Ubuntu 8.10 and the other Ubuntu 9.10. On the Ubuntu 8.10, i have a few databases in phpmyadmin which i would like to copy across to the Ubuntu 9.10 phpmyadmin(which has no databases). I'm not sure if i'm on the right path but here's what i think i should do: Export the databases onto Ubuntu 8.10. And copy those...

Need to find beginning and ending points of an Excel Range in C#

I'm trying to read an excel file from C# using COM, and can get it opened and loaded just fine. However, I don't want to use all of the data on the sheet (it expands monthly), just a certain subset that starts below the top of the sheet (row 3 for headers, row 4 for data) and goes to the end. I can currently get a range representing th...

R package: read.table as it is

Hi! I'm trying to read data from csv file, but instead of e.g. 001000 I get 1000 in my data. I've tried to set as.is=!stringsAsFactors, but got error: object stringsAsFactors not found. Anybody can help? ...

How is the Actionscript 3.0 sample Maze game's code included?

I can't find the line in the Adobe samples for a maze game where the actual .as code is included into the project. This is fundamental, since my own implementation is just using include "file name";, which isn't working. I also can't use import, since I then can't access the elements placed on the stage. Help, please? The files are avail...

Why am I getting the error "cannot import name Scanner" when I try to use the mwclient module for Python?

I'm using Python 2.5.2 (because mwclient still only works for 2.x). I've copied the mwclient folder into the /usr/lib/python2.5/site-packages/mwclient folder, and when I run a program that imports mwclient I get this: Traceback (most recent call last): File "get_wiki.py", line 2, in <module> import mwclient File "/usr/lib/pyth...

Data in 'xml' columns cleared when imported in Management Studio

Using the SQL Server Import and Export wizard in Management Studio 2005 I've encountered a big problem. After selecting a set of tables whose data I want to copy (specifying Delete Rows in Existing Tab and Identity Insert in the mappings) I execute the wizard and my rows from one database are nicely copied into my identical but previousl...

Is it possible to export/import product categories in Magento?

I saw one other question on how to do a mass import of products, categories, and all that, but all I want to be able to do is import my categories from one store to another. When you export products I see that there is still a category ID attribute that it gives the products, but I don't see any options for exporting product categories....

Importing eclipse projects using Ant

Hello there, I currently use an Ant script to download several Java projects (projects divided as modules) from a svn repository and generate a single war file. But now there is a need to use those scripts to download these projects directly to an eclipse workspace. Even after the build.xml is executed successfully, these projects are...