Is this a bug, or am I not understanding something about %hist in IPython?
In [79]: hist -g shapely
102/16: from shapely import Point, mapping
102/17: from shapely import Point, mapping
102/18: from shapely import mapping
102/19: import shapely
102/20: shapely?
140/53: import shapely
54: import shapely
In [80]: hist -n ~102/14-20
122/14: l
122/15: ls
122/16: nco.variables.keys()
122/17: ls
122/20: nco.sync()
Ok? There seems to be an offset of 20... Why?
In [81]: hist -n ~122/14-20
102/14: utm33N = pyproj.Proj(proj='utm', zone=33, south=False, ellipse='ED50')
102/15: import ogr
102/16: from shapely import Point, mapping
102/17: from shapely import Point, mapping
102/18: from shapely import mapping
102/19: import shapely
102/20: shapely?
You have it inverted, see the output of %history? for information about how to call it
The relevant bits:
``243/1-5``
Lines 1-5, session 243
``~2/7``
Line 7, session 2 before current
So %history -n ~102/14-20 is actually lines 14-20 of 102 sessions ago. For session 102, remove the tilde:
%history -n 102/14-20
Related
I'm trying to embed an ipython console into my command line application.
I have the following:
import IPython
from traitlets.config import Config
c = Config()
c.InteractiveShellApp.exec_lines = [
'import matplotlib.pyplot as plt',
'%matplotlib',
]
return IPython.start_ipython(config=c, user_ns=globals())
However, it seems to completely ignore the "exec_lines" part since plt is not available.
See: Can you specify a command to run after you embed into IPython?
IPython.start_ipython(config=c, user_ns=locals())
I'm using a jupyter notebook.
I followed the code below and entered it.
pip install git+https://github.com/tensorflow/examples.git
import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow_examples.models.pix2pix import pix2pix
from IPython.display import clear_output
import matplotlib.pyplot as plt
And I tried to "Download the Oxford-IIIT Pets dataset"
dataset, info = tfds.load('oxford_iiit_pet:3.*.*', with_info=True)
However, in the console, printed this
Downloading and preparing dataset Unknown size (download: Unknown size, generated: Unknown size, total: Unknown size) to ~\tensorflow_datasets\mnist\3.0.1...
and there was no data in the folder created.
Why isn't it working?
Tutorial link:https://www.tensorflow.org/tutorials/images/segmentation
I'm simply trying to import libraries, e.g.:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
and getting this "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 3200: invalid start byte" error.
I'm new to Jupyter Notebooks and wondering if I didn't set something up correctly. I'm attaching the full error message I'm getting.
Any advice would be GREATLY appreciated.
Error Message Here
Whenenver I try to import a model via FreeCADCmd Script the objects loose all color information.
This can be checked within the GUI by running macros
import FreeCAD
import ImportGui
doc = FreeCAD.newDocument()
FreeCAD.setActiveDocument(doc.Name)
ImportGui.insert("file1.stp", doc.Name)
will preserve the colors -- but can not be run on commandline, because of ImportGui.
import FreeCAD
import Import
doc = FreeCAD.newDocument()
FreeCAD.setActiveDocument(doc.Name)
Import.insert("file1.stp", doc.Name)
will import the model without any color information.
Is there any way to import a step file into FreeCADCmd (commandline -- so no GUI) without the color information being dropped?
Or does anyone know a way to run FreeCAD (GUI Version) without running a xserver?
When I use alembic to control the version of my project's database,part of codes in env.py
like:
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
from al_test.models import metadata
target_metadata = metadata
when I run 'alembic revision --autogenerate -m "Added user table"', I get an error :
File "alembic/env.py", line 18, in
from al_test.models import metadata
ImportError: No module named al_test.models
so how to solve the question? thanks!
This might be a bit late, and you may have already figured out the issue, but my guess the problem is that your alembic/ directory is not part of the system path. I.e. you need to do something like:
import sys
sys.path.append(path/to/al_test)
from al_test.models import metadata
Update your env.py like this, to add the current working directory to the sys.path that Python uses when searching for modules:
import os
import sys
sys.path.append(os.getcwd())
from al_test.models import metadata
target_metadata = metadata
....
....