gaemachanize: ImportError: No module named _winreg - google-app-engine

gaemechanize used to work fine when I try to do
import gaemechanize
. But recently, I updated GAE to newest version and I get this error when I run on local machine (gaemachanize works fine when upload to server)
Internal Server Error
import_string() failed for 'myapp.views.index'. Possible reasons are: - missing __init__.py in a package; - package or module path not included in sys.path; - duplicated package or module name taking precedence in sys.path; - missing module, class, function or variable; Debugged import: - 'myapp' found in 'D:\\Dropbox\\GAE Proj\\xxxx\\myapp\\__init__.pyc'. - 'myapp.views' not found. Original exception: ImportError: No module named _winreg
I found import _winreg in _msiecookiejar.py file in gaemechanize
I am using python 2.7.7 on windows 7
I got error when I try to do
pip install _winreg
How to fix it?

Related

Using Scala to Write a DF to a SQL Server Table

I'm trying to use the code below.
import com.microsoft.azure.sqldb.spark.config.Config
import com.microsoft.azure.sqldb.spark.connect._
// Aquire a DataFrame collection (val collection)
val config = Config(Map(
"url" -> "mysqlserver.database.windows.net",
"databaseName" -> "MyDatabase",
"dbTable" -> "dbo.Clients"
"user" -> "username",
"password" -> "*********"
))
import org.apache.spark.sql.SaveMode
collection.write.mode(SaveMode.Append).sqlDB(config)
The script is from this link.
https://github.com/Azure/azure-sqldb-spark
I'm running this in a databricks environment. I'm getting these errors:
command-836397363127942:5: error: object sqlDB is not a member of package com.microsoft.azure
import com.microsoft.azure.sqlDB.spark.connect._
^
command-836397363127942:4: error: object sqlDB is not a member of package com.microsoft.azure
import com.microsoft.azure.sqlDB.spark.config.Config
^
command-836397363127942:7: error: not found: value Config
val bulkCopyConfig = Config(Map(
^
command-836397363127942:18: error: value sqlDB is not a member of org.apache.spark.sql.DataFrameWriter[org.apache.spark.sql.Row]
df.write.mode(SaveMode.Append).sqlDB(bulkCopyConfig)
I'm guessing that some kind of library is not installed correctly. I Googled for an answer, but didn't find anything useful. Any idea how to make this work? Thanks.
If you are getting the sqldb error means all other support libraries already imported to your notebook and only the latest JAR with dependencies are missing.
As per the repro, I got the same error message as shown above:
After bit of research, I had found that you will experience this error due to missing JAR with dependencies.
To resolve this issue, you need to download the JAR file from here: https://search.maven.org/artifact/com.microsoft.azure/azure-sqldb-spark/1.0.2/jar
After downloaded the jar file, upload the JAR library into the cluster and install it.
Note: After installing both the libraries, make sure to restart the cluster.
Now, you will be able to run the command successfully.
I think you have missed the library
If your using Maven Build Add the following library in pom.xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-sqldb-spark</artifactId>
<version>1.0.2</version>
</dependency>
If your using SBT Build Add the following library in build.sbt
libraryDependencies += "com.microsoft.azure" % "azure-sqldb-spark" % "1.0.2"
Have you imported and installed the library in DataBricks?
I found it easiest to import the library using Maven. See this answer: How to install a library on a databricks cluster using some command in the notebook?
Note: You need to install the Library on your cluster and then restart the cluster before you can use it.

Python dbconnection

I have a python code(python 3.5.1) in which I need to connect to SQL server. I am using the module 'pyodc' but its throwing me an error
"ImportError: No module named 'pyodbc'"
I am using eclipse on Windows 8.
Then I downloaded pyodc package from "https://github.com/mkleehammer/pyodbc". I tried to install using pip first but its not working on Windows 8.1:
"building 'pyodbc' extension error: Unable to find vcvarsall.bat'.
Then I tried running setup.py file in the folder. But still i am not able to import pyodc module.
Can anyone help me in properly importing the module. I am very new to python and I know there might be some beginner mistake.

ImportError: libmysqlclient_r.so.16

I have a problem in python 2.6. I am trying to
import MySQLdb
it will show me an error like
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
I tried to search a lot but couldn't find anything.
reason behind this error is missing package for mysql
download a rpm file containing libmysqlclient_r.so.16 file and make sure that file is 32/64 bit architecture depending on your OS.
install package and all done.
hope it will work for you too.

mod_wsgi, apache, bottle.py application

Currently, I am trying to have mod_wsgi run my bottle app but when I restart apache2, it keeps giving me the following error:
File "/usr/local/www/documents/bottle.py"
from __future__ import with_statement
ImportError: No module named __future__
I have adapter.wsgi in the same directory as bottle (following code in adapter.wsgi):
import sys, os
sys.path = ['/usr/local/www/documents/']
os.chdir(os.path.dirname(__file__))
import bottle
import webapp # This loads your application
application = bottle.default_app()
This error only occurs when mod_python can't find __future__.py, which is a standard module in every Python installation, which suggests that either your installation is messed up or the mod_python PythonPath isn't quite right.

Integrating Active Directory with Plone 4

How do you integrate Active Directory with Plone 4 on Ubuntu? I have searched the Internet up and down and cannot get this to work!!
All I know is that all you have to do is add "plone.app.ldap" in your buildout.cfg file and that will install the add-ons. However, every time I do this I get an error message. I have installed python-ldap 2.3.11 from the Ubuntu repos but yet I still get an error when I run bin/buildout.
When I run bin/buildount it starts Getting distribution for 'python-ldap>=2.0.6'. I don't understand why does it have to do that when I already have python-ldap installed and tested successfully!
I have Python 2.6.
Here is the message I get when I execute bin/buildout:
Getting distribution for 'python-ldap>=2.0.6'.
extra_compile_args: -g
extra_objects:
include_dirs: /opt/openldap-RE24/include /usr/include/sasl
library_dirs: /opt/openldap-RE24/lib
libs: ldap_r lber sasl2 ssl crypto
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
warning: no files found matching 'Makefile'
warning: no files found matching 'Modules/LICENSE'
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
file Lib/ldap.py (for module ldap) not found
file Lib/ldap/controls.py (for module ldap.controls) not found
file Lib/ldap/extop.py (for module ldap.extop) not found
file Lib/ldap/schema.py (for module ldap.schema) not found
In file included from Modules/LDAPObject.c:9:0:
Modules/errors.h:8:18: fatal error: lber.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
An error occured when trying to install python-ldap 2.4.3. Look above this message for any errors that were output by easy_install.
While:
Installing instance.
Getting distribution for 'python-ldap>=2.0.6'.
Error: Couldn't install: python-ldap 2.4.3
*************** PICKED VERSIONS ****************
[versions]
plone.app.ldap = 1.2.6
#Required by:
#Products.PloneLDAP 1.1
Products.LDAPMultiPlugins = 1.14
#Required by:
#Products.PloneLDAP 1.1
Products.LDAPUserFolder = 2.20
#Required by:
#plone.app.ldap 1.2.6
Products.PloneLDAP = 1.1
#Required by:
#Products.LDAPUserFolder 2.20
dataflake.ldapconnection = 1.2
*************** /PICKED VERSIONS ***************
Please advise.
Now that you've actually included the error, it turns out this is a whole different issue. You can't build python-ldap without having the LDAP development package avialable. On any debian based system, such as ubuntu, you can use the excellent deb package metadata to do this for you.
$ sudo apt-get build-dep python-ldap

Resources