H5py IOError: Can't write data - h5py

For a deep learning project, I reorganize data from hdf5 files into a big training_data.hfd5 containing batch0...batch_max
When running it in local on my laptop it works, but the process is a bit long (much data), so I tried to run it on big-CPU servers I have access to.
Now I have this error :
Traceback (most recent call last):
File "prepare_data.py", line 88, in <module>
main(readargs())
File "prepare_data.py", line 82, in main
prepare_data('', args)
File "prepare_data.py", line 72, in prepare_data
args.preprocessdatadir, args.datadir, stdout=None)
File "/home/bizeul/Stage/GCNN-1/GCNN_Icube/data_prepare_cube/group_batch.py", line 113, in group_batchs
curr_batch_idx, count_events = organizer.iter_data()
File "/home/bizeul/Stage/GCNN-1/GCNN_Icube/data_prepare_cube/group_batch.py", line 93, in iter_data
self.next_batch(batchsize)
File "/home/bizeul/Stage/GCNN-1/GCNN_Icube/data_prepare_cube/group_batch.py", line 65, in next_batch
self.next_event(fileout)
File "/home/bizeul/Stage/GCNN-1/GCNN_Icube/data_prepare_cube/group_batch.py", line 82, in next_event
fileout[self.group_name + '/label'][self.event_idx] = label
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/home/bizeul/virtual_cpu/build/h5py/h5py/_objects.c:2840)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/home/bizeul/virtual_cpu/build/h5py/h5py/_objects.c:2798)
File "/home/bizeul/virtual_cpu/lib/python2.7/site-packages/h5py/_hl/dataset.py", line 630, in __setitem__
self.id.write(mspace, fspace, val, mtype, dxpl=self._dxpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/home/bizeul/virtual_cpu/build/h5py/h5py/_objects.c:2840)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/home/bizeul/virtual_cpu/build/h5py/h5py/_objects.c:2798)
File "h5py/h5d.pyx", line 221, in h5py.h5d.DatasetID.write (/home/bizeul/virtual_cpu/build/h5py/h5py/h5d.c:3680)
File "h5py/_proxy.pyx", line 132, in h5py._proxy.dset_rw (/home/bizeul/virtual_cpu/build/h5py/h5py/_proxy.c:2022)
File "h5py/_proxy.pyx", line 93, in h5py._proxy.H5PY_H5Dwrite (/home/bizeul/virtual_cpu/build/h5py/h5py/_proxy.c:1732)
IOError: Can't write data (No appropriate function for conversion path)
What do you think is the problem ?

Had the same issue. I was trying to create a dataset with set of images and labels. But didn't resize it. After resizing all the images to same size, i was able to run the code and create dataset.
img = cv2.resize(img,(500,500))
Resize after you read the image

Related

jupyter_client.kernelspec.NoSuchKernel: No such kernel named PySpark

Am trying to execute Jupyter notebook from command line. Am currently using the docker image provided in below link
https://hub.docker.com/r/jupyter/pyspark-notebook
When i try to execute below in command line it fails.
jupyter nbconvert --to notebook --ExecutePreprocessor.kernel_name=PySpark --ExecutePreprocessor.timeout=3600 --execute notebooks/sample-notebook.ipynb
Below is the error message
[NbConvertApp] Converting notebook notebooks/sample-notebook.ipynb to notebook
Traceback (most recent call last):
File "/opt/conda/bin/jupyter-nbconvert", line 11, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.7/site-packages/jupyter_core/application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 340, in start
self.convert_notebooks()
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 510, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 481, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 197, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/notebook.py", line 32, in from_notebook_node
nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 139, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 316, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
return self.preprocess(nb, resources)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 403, in preprocess
with self.setup_preprocessor(nb, resources, km=km):
File "/opt/conda/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 345, in setup_preprocessor
self.km, self.kc = self.start_new_kernel(**kwargs)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 291, in start_new_kernel
km.start_kernel(extra_arguments=self.extra_arguments, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 301, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 254, in pre_start_kernel
kernel_cmd = self.format_kernel_cmd(extra_arguments=extra_arguments)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 178, in format_kernel_cmd
cmd = self.kernel_spec.argv + extra_arguments
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 84, in kernel_spec
self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/kernelspec.py", line 235, in get_kernel_spec
raise NoSuchKernel(kernel_name)
jupyter_client.kernelspec.NoSuchKernel: No such kernel named PySpark

django-simple-history 1.9 break unittests

When I run unittests with django-simple-history==1.6.0, it runs fine but with
django-simple-history==1.9.0 it breaks the unittests.
Any ideas how to fix this?
Creating test database for alias 'default'...
Traceback (most recent call last):
File "manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 90, in handle
failures = test_runner.run_tests(test_labels)
File "/home/me/venv/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
old_config = self.setup_databases()
File "/home/me/venv/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
**kwargs
File "/home/me/venv/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 376, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 413, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "/home/me/venv/lib/python2.7/site-packages/django/core/serializers/__init__.py", line 129, in serialize
s.serialize(queryset, **options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/serializers/base.py", line 52, in serialize
for obj in queryset:
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 409, in get_objects
for obj in queryset.iterator():
File "/home/me/venv/lib/python2.7/site-packages/django/db/models/query.py", line 238, in iterator
results = compiler.execute_sql()
File "/home/me/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 829, in execute_sql
cursor.execute(sql, params)
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/me/venv/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such column: myapp_historicalbook.history_change_reason
I got it. I had to remove my migration folder in order to be able to run the unit tests.

Enthought Canopy GUI won't open

I've downloaded Enthought Canopy Express onto my 64-bit Windows 10 laptop, but when I try to open the Canopy program it won't open.
If I try to open it from the desktop shortcut or go into the program files and try to open it directly from the .exe file, all it will do is show the splash page, which then disappears after showing for a few seconds, and then nothing happens. Also after the splash page is gone, task manager shows that Canopy isn't running.
The PyLab application will open and works fine, but I need the actual Enthought Canopy application to work for a class I'm taking.
When I installed it for the very first time, it did open and I was able to use the Enthought Canopy application, but ever since I closed out of it since then it hasn't worked.
When I go into the program files to try and open it from the .exe file, for the file Canopy.exe it will open the splash page and then close, and for Canopy_cli.exe it will open a command prompt looking window, then the splash page, and then both close. The file _python.exe will open and work, and the file _pythonw.exe does nothing.
(These files are at C:\Users\charizard\AppData\Local\Enthought\Canopy\App if that makes any difference.)
I've uninstalled and restarted and reinstalled several times, and I've tried the "Full Reset" suggested in this article. My user name is just "charizard" and my computer name is "messier42", so the problem isn't that it's a non-ASCII user name.
I have also tried the test to see if it's a problem with the PYTHONPATH or PYTHONHOME environment variables like it suggests in this article, but it didn't start Canopy.
This is what I got from the command prompt when I tested that:
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Users\charizard>
C:\Users\charizard>set pythonpath=
C:\Users\charizard>set pythonhome=
C:\Users\charizard>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\charizard\AppData\Roaming
asl.log=Destination=file
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=MESSIER42
ComSpec=C:\WINDOWS\system32\cmd.exe
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\charizard
LOCALAPPDATA=C:\Users\charizard\AppData\Local
LOGONSERVER=\\MicrosoftAccount
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter;;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\Acer\Remote Files\;C:\Program Files (x86)\Calibre2\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;c:\users\charizard\appdata\local\enthought\canopy\user\scripts;C:\Users\charizard\AppData\Roaming\Dashlane\3.5.2.91395\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\charizard\AppData\Local\Enthought\Canopy\User;C:\Users\charizard\AppData\Local\Enthought\Canopy\User\Scripts
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=4501
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\CHARIZ~1\AppData\Local\Temp
TMP=C:\Users\CHARIZ~1\AppData\Local\Temp
USERDOMAIN=MESSIER42
USERDOMAIN_ROAMINGPROFILE=MESSIER42
USERNAME=charizard
USERPROFILE=C:\Users\charizard
windir=C:\WINDOWS
[.... later after correcting typo...]
C:\Users\charizard>cd "%localappdata%\enthought\canopy\app"
C:\Users\charizard\AppData\Local\Enthought\Canopy\App>_python.exe canopy-script.pyw
Traceback (most recent call last):
File "canopy-script.pyw", line 776, in <module>
File "canopy-script.pyw", line 336, in bootstrap
File "canopy-script.pyw", line 363, in chainload
File "canopy-script.pyw", line 762, in _chainload
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Canopy-script.pyw", line 8, in <module>
sys.exit(main())
File "build\bdist.win-amd64\egg\canopy\app\bootstrap.py", line 2421, in main
File "build\bdist.win-amd64\egg\canopy\app\bootstrap.py", line 2357, in send_bug_report
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter.py", line 25, in <module>
File "build\bdist.win-amd64\egg\canopy\app\application.py", line 22, in <module>
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\envisage\ui\tasks\api.py", line 2, in <module>
from preferences_pane import PreferencesPane
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\envisage\ui\tasks\preferences_pane.py", line 4, in <module>
from traitsui.api import Controller
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\traitsui\api.py", line 41, in <module>
from .editors.api import (BooleanEditor, ButtonEditor,
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\traitsui\editors\__init__.py", line 27, in <module>
from .api import (toolkit, BooleanEditor, ButtonEditor,
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\traitsui\editors\api.py", line 8, in <module>
from .array_editor import ArrayEditor
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\traitsui\editors\array_editor.py", line 27, in <module>
import numpy
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\numpy\__init__.py", line 185, in <module>
from . import add_newdocs
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\Lib\site-packages\numpy\lib\__init__.py", line 17, in <module>
from . import scimath as emath
ImportError: cannot import name scimath
C:\Users\charizard\AppData\Local\Enthought\Canopy\App>
C:\Users\charizard\AppData\Local\Enthought\Canopy\App>Uncaught exception captured
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "build\bdist.win-amd64\egg\canopy\app\main.py", line 53, in main
File "build\bdist.win-amd64\egg\canopy\app\application_launcher.py", line 350, in launch
File "build\bdist.win-amd64\egg\canopy\app\application.py", line 361, in run
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\ui\tasks\tasks_application.py", line 131, in run
started = self.start()
File "build\bdist.win-amd64\egg\canopy\app\application.py", line 295, in start
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\application.py", line 295, in start
self.plugin_manager.start()
File "build\bdist.win-amd64\egg\canopy\app\canopy_plugin_manager.py", line 140, in start
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\composite_plugin_manager.py", line 133, in start
self.start_plugin(plugin)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\composite_plugin_manager.py", line 143, in start_plugin
plugin.activator.start_plugin(plugin)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\plugin_activator.py", line 30, in start_plugin
plugin.start()
File "build/bdist.macosx-10.6-x86_64/egg/canopy_data_import_addon/plugin.py", line 79, in start
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\application.py", line 370, in get_service
protocol, query, minimize, maximize
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\service_registry.py", line 77, in get_service
services = self.get_services(protocol, query, minimize, maximize)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\service_registry.py", line 114, in get_services
actual_protocol, name, obj, properties, service_id
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\service_registry.py", line 258, in _resolve_factory
obj = obj(**properties)
File "build\bdist.win-amd64\egg\canopy\plugin\plugin.py", line 183, in _create_package_manager_service
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\application.py", line 370, in get_service
protocol, query, minimize, maximize
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\service_registry.py", line 77, in get_service
services = self.get_services(protocol, query, minimize, maximize)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\service_registry.py", line 114, in get_services
actual_protocol, name, obj, properties, service_id
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\envisage\service_registry.py", line 258, in _resolve_factory
obj = obj(**properties)
File "build\bdist.win-amd64\egg\canopy\accounts\plugin.py", line 69, in _create_account_service
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 359, in __init__
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 3285, in _init_trait_listeners
getattr( self, '_init_trait_%s_listener' % data[0] )( name, *data )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 3340, in _init_trait_delegate_listener
self.on_trait_change( notify, name_pattern, target=self )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 2584, in on_trait_change
listener.register( self )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\traits_listener.py", line 433, in register
value = getattr( self, type )( new, name, False )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\traits_listener.py", line 701, in _register_simple
return next.register( getattr( object, name ) )
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 308, in _preferences_default
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 314, in _enstaller_config_default
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\enstaller\config.py", line 299, in from_file
ret = _create(fp)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\enstaller\config.py", line 268, in _create
parsed = parse_assignments(fp)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\egginst\utils.py", line 207, in parse_assignments
return _AssignmentParser().parse(file_or_filename.read())
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\egginst\utils.py", line 172, in parse
root = ast.parse(s)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: compile() expected string without null bytes
Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object: <canopy.logging.logging_service.LoggingService object at 0x00000000054EAA98>, trait: exception_added, old value: <undefined>, new value: <LogRecord: root, 40, build\bdist.win-amd64\egg\canopy\logging\logging_service.py, 154, "Uncaught exception captured">
Traceback (most recent call last):
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\trait_notifiers.py", line 340, in __call__
self.handler( *args )
File "build\bdist.win-amd64\egg\canopy\logging\logging_service.py", line 203, in _exception_added_fired
File "build\bdist.win-amd64\egg\canopy\logging\logging_service.py", line 187, in _report_exception
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter.py", line 505, in start
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter_view.py", line 192, in __init__
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter_view.py", line 221, in setup_ui
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter_view.py", line 304, in __init__
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter.py", line 269, in _requester_email_default
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter.py", line 261, in _account_service_default
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 359, in __init__
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 3285, in _init_trait_listeners
getattr( self, '_init_trait_%s_listener' % data[0] )( name, *data )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 3340, in _init_trait_delegate_listener
self.on_trait_change( notify, name_pattern, target=self )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 2584, in on_trait_change
listener.register( self )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\traits_listener.py", line 433, in register
value = getattr( self, type )( new, name, False )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\traits_listener.py", line 701, in _register_simple
return next.register( getattr( object, name ) )
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 308, in _preferences_default
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 314, in _enstaller_config_default
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\enstaller\config.py", line 299, in from_file
ret = _create(fp)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\enstaller\config.py", line 268, in _create
parsed = parse_assignments(fp)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\egginst\utils.py", line 207, in parse_assignments
return _AssignmentParser().parse(file_or_filename.read())
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\egginst\utils.py", line 172, in parse
root = ast.parse(s)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: compile() expected string without null bytes
Exception occurred in traits notification handler for object: <canopy.logging.logging_service.LoggingService object at 0x00000000054EAA98>, trait: exception_added, old value: <undefined>, new value: <LogRecord: root, 40, build\bdist.win-amd64\egg\canopy\logging\logging_service.py, 154, "Uncaught exception captured">
Traceback (most recent call last):
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\trait_notifiers.py", line 340, in __call__
self.handler( *args )
File "build\bdist.win-amd64\egg\canopy\logging\logging_service.py", line 203, in _exception_added_fired
File "build\bdist.win-amd64\egg\canopy\logging\logging_service.py", line 187, in _report_exception
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter.py", line 505, in start
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter_view.py", line 192, in __init__
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter_view.py", line 221, in setup_ui
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter_view.py", line 304, in __init__
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter.py", line 269, in _requester_email_default
File "build\bdist.win-amd64\egg\canopy\feedback\data_reporter.py", line 261, in _account_service_default
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 359, in __init__
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 3285, in _init_trait_listeners
getattr( self, '_init_trait_%s_listener' % data[0] )( name, *data )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 3340, in _init_trait_delegate_listener
self.on_trait_change( notify, name_pattern, target=self )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\has_traits.py", line 2584, in on_trait_change
listener.register( self )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\traits_listener.py", line 433, in register
value = getattr( self, type )( new, name, False )
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\traits\traits_listener.py", line 701, in _register_simple
return next.register( getattr( object, name ) )
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 308, in _preferences_default
File "build\bdist.win-amd64\egg\canopy\accounts\account_service.py", line 314, in _enstaller_config_default
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\enstaller\config.py", line 299, in from_file
ret = _create(fp)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\enstaller\config.py", line 268, in _create
parsed = parse_assignments(fp)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\egginst\utils.py", line 207, in parse_assignments
return _AssignmentParser().parse(file_or_filename.read())
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\egginst\utils.py", line 172, in parse
root = ast.parse(s)
File "C:\Users\charizard\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: compile() expected string without null bytes
Please zip and email your file C:\Users\charizard\.enstaller4rc to support#enthought.com for forensics, and refer to this SO article. Then just delete that file, and I expect that you'll be able to start Canopy ok.

can not rename column using alter_column

I have an existing project that is based on pylons and sqlalchemy. I did not use alembic or any wrapper in this project, yet.
I migrated the project to flask and sqlalchemy.
I took the old database of the old version 1.5 and generated the first migration script with Flast-Migrate. Hm, I realized I will have to do many things manually.
I am already stuck, when renaming columns. I am doing this with an SQLite database.
The old project had a table "Token", which was renamed to "token". Obviously there are some database that do not care about upper or lower case.
When I try to rename the first column like this:
op.alter_column('token', 'privacyIDEATokenId', new_column_name='id')
I get this error:
sqlalchemy.exc.OperationalError: (OperationalError) near \
""privacyIDEATokenId"": syntax error u'ALTER TABLE token RENAME \
"privacyIDEATokenId" TO id' ()
The column Token.privacyIDEATokenId is the primary key that should be token.id in the new version.
The same happens to columns that are not the primary key.
Full trace:
Traceback (most recent call last):
File "./manage.py", line 107, in <module>
manager.run()
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 412, in run
result = self.handle(sys.argv[0], sys.argv[1:])
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 383, in handle
res = handle(*args, **config)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/flask_script/commands.py", line 216, in __call__
return self.run(*args, **kwargs)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/flask_migrate/__init__.py", line 98, in upgrade
command.upgrade(config, revision, sql = sql, tag = tag)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/command.py", line 129, in upgrade
script.run_env()
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/script.py", line 208, in run_env
util.load_python_file(self.dir, 'env.py')
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/util.py", line 230, in load_python_file
module = load_module_py(module_id, path)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/compat.py", line 63, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "migrations/env.py", line 72, in <module>
run_migrations_online()
File "migrations/env.py", line 65, in run_migrations_online
context.run_migrations()
File "<string>", line 7, in run_migrations
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/environment.py", line 696, in run_migrations
self.get_context().run_migrations(**kw)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/migration.py", line 266, in run_migrations
change(**kw)
File "migrations/versions/112475c7f45_.py", line 103, in upgrade
_upgrade_token_table()
File "migrations/versions/112475c7f45_.py", line 49, in _upgrade_token_table
op.alter_column('token', 'privacyIDEATokenId', new_column_name='id')
File "<string>", line 7, in alter_column
File "<string>", line 1, in <lambda>
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/util.py", line 353, in go
return fn(*arg, **kw)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/operations.py", line 329, in alter_column
existing_autoincrement=existing_autoincrement
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 131, in alter_column
existing_nullable=existing_nullable,
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 81, in _exec
conn.execute(construct, *multiparams, **params)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute
return meth(self, multiparams, params)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 69, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 783, in _execute_ddl
compiled
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
context)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1159, in _handle_dbapi_exception
exc_info
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
context)
File "/home/cornelius/src/privacyidea/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) near ""privacyIDEATokenId"": syntax error u'ALTER TABLE token RENAME "privacyIDEATokenId" TO id' ()
Nowadays you can use "batch migration" to enable ALTER-ing columns under SQLite:
with op.batch_alter_table('table_name') as bop:
bop.alter_column('old_column_name', new_column_name='new_name')
Obivously sqlite can not rename a column. So finally I ended up with creating new tables with new columns and shoving data from one to the other.
This is ok, since I realized, I also have to mangle the data, adapt and modify it before writing to the new table again.
The script I ended up with, is here:
https://github.com/privacyidea/privacyidea/blob/version2/migrations/versions/4f32a4e1bf33_.py#L241

ipython: OperationalError: disk I/O error

I was running ipython successfully on fedora 18 until now: I'm getting the following exception when trying to launch it:
Traceback (most recent call last):
File "/usr/bin/ipython", line 9, in <module>
load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
File "/usr/lib/python2.7/site-packages/IPython/__init__.py", line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 544, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 323, in initialize
self.init_shell()
File "/usr/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 339, in init_shell
ipython_dir=self.ipython_dir, user_ns=self.user_ns)
File "/usr/lib/python2.7/site-packages/IPython/config/configurable.py", line 349, in instance
inst = cls(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 320, in __init__
**kwargs
File "/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 456, in __init__
self.init_history()
File "/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 1487, in init_history
self.history_manager = HistoryManager(shell=self, parent=self)
File "/usr/lib/python2.7/site-packages/IPython/core/history.py", line 481, in __init__
self.new_session()
File "<string>", line 2, in new_session
File "/usr/lib/python2.7/site-packages/IPython/core/history.py", line 65, in needs_sqlite
return f(self, *a, **kw)
File "/usr/lib/python2.7/site-packages/IPython/core/history.py", line 500, in new_session
self.session_number = cur.lastrowid
OperationalError: disk I/O error
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev#scipy.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
c.Application.verbose_crash=True
I tried to upgrade ipython to the latest version using pip, which did not help. Any solution or workaround is very much welcomed.
IPython store history in a profile generally in ~/.ipython/profile_default/history.sqlite. There seem to be a disk error reading/writting to it.
Check the permissions of the file/folders, if necessary delete the file.
I solved it by set c.NotebookNotary.db_file = u':memory:' in jupyter configure file ~/.jupyter/jupyter_notebook_config.py