phpThumb Image Resizing Errors - image-resizing

I have spent all day on this and can't figure out where I'm going wrong.
I am trying to resize some images to then write them to a folder so they can be zipped up and downloaded.
I can get the images to resize, rename and then save into another directory when using the phpThumb Demo -> phpThumb.demo.object.php. This is because the source image, phpThumb class, and the final image destination directory are all in the same folder.
However, I have now changed the directory structure so the phpThumb.class.php file is being called from the admin subdomain and the images need to be grabbed from the images subdomain and then saved to a directory in either the images or admin domains so I can get them later to write to a ZIP file.
I am just getting errors all the time and can't make out where to go from here. Can anyone help?
Here is the php:
require_once('../phpThumb/phpthumb.class.php');
// create phpThumb object
$phpThumb = new phpThumb();
// create 3 sizes of thumbnail
$thumbnail_widths = array(160, 320, 1000);
$capture_raw_data = false; // set to true to insert to database rather than render to screen or file (see below)
foreach ($thumbnail_widths as $thumbnail_width) {
// this is very important when using a single object to process multiple images
$phpThumb->resetObject();
// set data source -- do this first, any settings must be made AFTER this call
$phpThumb->setSourceFilename('/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg');
// PLEASE NOTE:
// You must set any relevant config settings here. The phpThumb
// object mode does NOT pull any settings from phpThumb.config.php
$phpThumb->setParameter('config_document_root', '/home/server/domains/images.testdomain.co.uk/public_html/');
$phpThumb->setParameter('config_cache_directory', '/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache/');
$phpThumb->setParameter('w', $thumbnail_width);
// set options (see phpThumb.config.php)
// here you must preface each option with "config_"
$phpThumb->setParameter('config_output_format', 'jpg');
$phpThumb->setParameter('config_imagemagick_path', '/usr/local/bin/convert');
// generate & output thumbnail
$output_filename = 'zip_temp/_'.$thumbnail_width.'.'.$phpThumb->config_output_format;
echo $output_filename;
if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
$output_size_x = ImageSX($phpThumb->gdimg_output);
$output_size_y = ImageSY($phpThumb->gdimg_output);
if ($output_filename || $capture_raw_data) {
if ($capture_raw_data && $phpThumb->RenderOutput()) {
// RenderOutput renders the thumbnail data to $phpThumb->outputImageData, not to a file or the browser
//mysql_query("INSERT INTO `table` (`thumbnail`) VALUES ('".mysql_escape_string($phpThumb->outputImageData)."') WHERE (`id` = '".$id."')");
} elseif ($phpThumb->RenderToFile($output_filename)) {
// do something on success
echo 'Successfully rendered:<br><img src="http://images.testdomain.co.uk/zip_temp/'.$output_filename.'">';
} else {
// do something with debug/error messages
echo 'Failed (size='.$thumbnail_width.'):<pre>'.implode("\n\n", $phpThumb->debugmessages).'</pre>';
}
$phpThumb->purgeTempFiles();
} else {
$phpThumb->OutputThumbnail();
}
} else {
// do something with debug/error messages
echo 'Failed (size='.$thumbnail_width.').<br>';
echo '<div style="background-color:#FFEEDD; font-weight: bold; padding: 10px;">'.$phpThumb->fatalerror.'</div>';
echo '<form><textarea rows="10" cols="60" wrap="off">'.htmlentities(implode("\n* ", $phpThumb->debugmessages)).'</textarea></form><hr>';
}
}
AND HERE ARE THE ERRORS:
phpThumb() v1.7.11-201108081537 in file "phpthumb.class.php" on line 216
* phpThumb() v1.7.11-201108081537 in file "phpthumb.class.php" on line 216
* setSourceFilename(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) set $this->sourceFilename to "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg" in file "phpthumb.class.php" on line 262
* Leaving $this->config_imagemagick_path as (/usr/local/bin/convert) because !is_execuatable(realpath($this->config_imagemagick_path)) () in file "phpthumb.class.php" on line 1162
* file_exists(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1165
* file_exists_ignoreopenbasedir(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1166
* is_file(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1167
* is_executable(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1168
* ImageMagickThumbnailToGD() aborting because cannot find convert in $this->config_imagemagick_path (/usr/local/bin/convert), and `which convert` returned (which: no convert in (/bin:/usr/bin)) in file "phpthumb.class.php" on line 1198
* $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 923
* $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 934
* $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 951
* ResolveFilenameToAbsolute() NOT prepending $this->config_document_root (/home/server/domains/images.testdomain.co.uk/public_html/) to $filename (/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) resulting in ($AbsoluteFilename = "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg") in file "phpthumb.class.php" on line 1060
* $this->sourceFilename set to "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg" in file "phpthumb.class.php" on line 852
* phpThumb() v1.7.11-201108081537
http://phpthumb.sourceforge.net
Error messages disabled in file "phpthumb.class.php" on line 3847
* setCacheDirectory() starting with config_cache_directory = "/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache/" in file "phpthumb.class.php" on line 958
* setting config_cache_directory to realpath(/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache) = "/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache" in file "phpthumb.class.php" on line 986
* $this->config_cache_directory is not writable (/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache) in file "phpthumb.class.php" on line 997
* SetCacheFilename() _src set from md5($this->sourceFilename) "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg" = "688d3d8dc707794f27b6ef6db51ee9a2" in file "phpthumb.class.php" on line 3240
* SetCacheFilename() _par set from md5(_w160_dpi150_q75) in file "phpthumb.class.php" on line 3273
* starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3035
* GetImageSize(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) says image is x in file "phpthumb.class.php" on line 3045
* GetImageSize("/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg") failed in file "phpthumb.class.php" on line 3078
* $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1315
* ImageMagickThumbnailToGD() aborting because ImageMagickCommandlineBase() failed in file "phpthumb.class.php" on line 2006
* ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3085
* SetOrientationDependantWidthHeight() starting with ""x"" in file "phpthumb.class.php" on line 3014
* SetOrientationDependantWidthHeight() setting w="160", h="0" in file "phpthumb.class.php" on line 3030
* EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 3142
* starting SourceImageToGD() in file "phpthumb.class.php" on line 3400
* starting ImageCreateFromFilename(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) in file "phpthumb.class.php" on line 3315
* empty $filename or GetImageSize(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) failed in file "phpthumb.class.php" on line 3364
* Populating $rawimagedata in file "phpthumb.class.php" on line 3372
* cannot fopen(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) in file "phpthumb.class.php" on line 3383
* Not using EXIF thumbnail data because $this->exif_thumbnail_data is empty in file "phpthumb.class.php" on line 3471
* $this->gdimg_source is still empty in file "phpthumb.class.php" on line 3523
* ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3525
* phpThumb() v1.7.11-201108081537
http://phpthumb.sourceforge.net
Error messages disabled in file "phpthumb.class.php" on line 3847
* SourceImageToGD() failed in file "phpthumb.class.php" on line 342

open file phpthumb/phpthumb.class.php and change line 141:
var $config_disable_debug = true;
to
var $config_disable_debug = false;
Revisit the original page, and this time the actual error message should appear

Related

PyAlgoTrade: How to use resampleBarFeed with multiple instruments?

I am resampling a few instruments with [pyalogtrade][1].
I have a base barfeed for 1-minute data, which is working fine
I have added a resampler to resample for 2 minutes, as follows:
class Strategy(strategy.BaseStrategy):
def __init__(self, instruments,feed, brk):
strategy.BaseStrategy.__init__(self, feed, brk)
self.__position = None
self.__instrument = instruments
self._resampledBF = self.resampleBarFeed(2 * bar.Frequency.MINUTE, self.resampledOnBar_2minute)
self.info ("initialised strategy")
I got this error:
2022-09-08 12:36:00,396 strategy [INFO] 1-MIN: INSTRUMENT1: Date: 2022-09-08 12:35:00+05:30 Open: 17765.55 High: 17774.5 Low: 17765.35 Close: 1777 myStrategy.run()
File "pyalgotrade\pyalgotrade\strategy\__init__.py", line 514, in run
self.__dispatcher.run()
File "pyalgotrade\pyalgotrade\dispatcher.py", line 109, in run
eof, eventsDispatched = self.__dispatch()
File "pyalgotrade\pyalgotrade\dispatcher.py", line 97, in __dispatch
if self.__dispatchSubject(subject, smallestDateTime):
File "pyalgotrade\pyalgotrade\dispatcher.py", line 75, in __dispatchSubject ret = subject.dispatch() is True
File "pyalgotrade\pyalgotrade\feed\__init__.py", line 106, in dispatch
dateTime, values = self.getNextValuesAndUpdateDS()
File "pyalgotrade\pyalgotrade\feed\__init__.py", line 81, in getNextValuesAndUpdateDS
dateTime, values = self.getNextValues()
File "pyalgotrade\pyalgotrade\barfeed\__init__.py", line 101, in getNextValues
raise Exception(
Exception: Bar date times are not in order. Previous datetime was 2022-09-08 12:34:00+05:30 and current datetime is 2022-09-08 12:34:00+05:30
However, the error does not occur if the self._resampledBF = self.resampleBarFeed is commented out.
Also, on searching online, I found a similar report/ possible fix reported earlier on Google groups: https://groups.google.com/g/pyalgotrade/c/v9ht1Bfz5Ds/m/ojF8uH8sFwAJ
The solution recommended was:
Sorry never mind, I fixed it. Using current timestamp instead of the one from IB and that fixed it.
Not sure if this is has been resolved.
Would like to know how to resolve the error while resampling.

UnicodeDecodeError: invalid start byte in METADATA file at path:

I see that several Python-package related files have gibberish at their end.
Due to this, I am unable to do several pip operations (even basic ones like "pip list").
(Usually, I use conda by the way)
For example. When I pressed pip list. I get the following error.
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\commands\list.py", line 179, in run
self.output_package_listing(packages, options)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\commands\list.py", line 255, in output_package_listing
data, header = format_for_columns(packages, options)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\commands\list.py", line 307, in format_for_columns
row = [proj.raw_name, str(proj.version)]
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\metadata\base.py", line 163, in raw_name
return self.metadata.get("Name", self.canonical_name)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\metadata\pkg_resources.py", line 96, in metadata
return get_metadata(self._dist)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\utils\packaging.py", line 48, in get_metadata
metadata = dist.get_metadata(metadata_name)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1424, in get_metadata
return value.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 14097: invalid start byte in METADATA file at path: c:\users\shan_jaffry\miniconda3\envs\sql_version\lib\site-packages\hupper-1.10.2.dist-info\METADATA
I went into the file META and found the following gibberish at the end. This (I found) has been done in several other files i.e. end of files are appended with gibberish and the actual thin is removed. Any help?
> 0.1 (2016-10-21)
> ================
> -
> - Initial rele9ýl·øA
I found that the by manually going to the site-packages folder, and removing the two folders, :: hupper and hupper-1.10.2.dist-info and then installing hupper again using "pip install hupper", problem was solved.
The issue was that the hupper package (and hupper-1.10.2.dist-info) were corrupted. Hence uninstall and re-install helped.

Dataflow job fails with HttpError, NotImplementedError

I'm running a Dataflow job which I think should work, and is failing after 1.5 hrs with what looks like network errors. It works fine when run against a subset of the data.
The first trouble sign is a whole string of warnings like this:
Refusing to split <dataflow_worker.shuffle.GroupedShuffleRangeTracker object at 0x7f2bcb629950> at b'\xa4r\xa6\x85\x00\x01': proposed split position is out of range [b'\xa4^E\xd2\x00\x01', b'\xa4r\xa6\x85\x00\x01'). Position of last group processed was b'\xa4r\xa6\x84\x00\x01'.
Then there are four errors which seem to be about writing CSV files to GCS:
Error in _start_upload while inserting file gs://(redacted).csv: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/gcsio.py", line 565, in _start_upload self._client.objects.Insert(self._insert_request, upload=self._upload) File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/internal/clients/storage/storage_v1_client.py", line 1156, in Insert upload=upload, upload_config=upload_config) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 731, in _RunMethod return self.ProcessHttpResponse(method_config, http_response, request) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 737, in ProcessHttpResponse self.__ProcessHttpResponse(method_config, http_response, request)) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 604, in __ProcessHttpResponse http_response, method_config=method_config, request=request) apitools.base.py.exceptions.HttpError: HttpError accessing <https://www.googleapis.com/resumable/upload/storage/v1/b/(redacted).csv&uploadType=resumable&upload_id=(redacted)>: response: <{'content-type': 'text/plain; charset=utf-8', 'x-guploader-uploadid': '(redacted)', 'content-length': '0', 'date': 'Wed, 08 Jul 2020 22:17:28 GMT', 'server': 'UploadServer', 'status': '503'}>, content <>
Error in _start_upload while inserting file gs://(redacted).csv: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/gcsio.py", line 565, in _start_upload self._client.objects.Insert(self._insert_request, upload=self._upload) File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/internal/clients/storage/storage_v1_client.py", line 1156, in Insert upload=upload, upload_config=upload_config) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 715, in _RunMethod http_request, client=self.client) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 908, in InitializeUpload return self.StreamInChunks() File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 1020, in StreamInChunks additional_headers=additional_headers) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 971, in __StreamMedia self.RefreshResumableUploadState() File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 873, in RefreshResumableUploadState self.stream.seek(self.progress) File "/usr/local/lib/python3.7/site-packages/apache_beam/io/filesystemio.py", line 301, in seek offset, whence, self.position, self.last_block_position)) NotImplementedError: offset: 0, whence: 0, position: 411, last: 411
The Dataflow job ID is 2020-07-07_13_08_31-7649894576933400587 -- if anyone from Google Cloud Support is able to look at this I'd be very grateful. Thanks very much.
P.S I asked a similar question last year (Dataflow job fails at BigQuery write with backend errors), the resolution was to use --experiments=use_beam_bq_sink -- I am already doing this.
You can safely ignore "Refusing to split" errors. This just means that the split position Dataflow service provided probably was received by the worker after that position was already read by the worker. Hence the worker has to ignore the split request.
Error "Error in _start_upload while inserting" seems more problematic and seems to be similar to https://issues.apache.org/jira/browse/BEAM-7014. I suspect this to be a rare flake though so I'm not sure if this was the reason for your job failure (the job only fails of the same workitem failed four times).
Can you contact Google Cloud support so that they can look into your job ?
I will mention this in the JIRA.

Sphinx documentation and links to Markdown

I'm trying to use Sphinx to build some documentation from Markdown source. My conf.py is as follows...
conf.py
from recommonmark.parser import CommonMarkParser
project = 'DS'
copyright = '2018, DS'
author = 'DS, Work'
version = ''
release = ''
extensions = []
templates_path = ['_templates']
source_suffix = ['.rst', '.md']
master_doc = 'index'
language = None
exclude_patterns = []
pygments_style = 'sphinx'
html_theme = 'classic'
html_static_path = ['_static']
source_parsers = {
'.md': CommonMarkParser,
}
htmlhelp_basename = 'DSDocumentationdoc'
latex_elements = {
}
latex_documents = [
(master_doc, 'DSDocumentation.tex', 'DS Documentation',
'DS, Work', 'manual'),
]
man_pages = [
(master_doc, 'dsdocumentation', 'DS Documentation',
[author], 1)
]
texinfo_documents = [
(master_doc, 'DSDocumentation', 'DS Documentation',
author, 'DSDocumentation', 'One line description ofproject.',
'Miscellaneous'),
]
index.rst
Welcome to DS Documentation!
======================================
The following documentation is produced and maintained by the Data Science team.
Contents:
.. toctree::
:maxdepth: 2
:glob:
README.md
documentation.md
getting_started/*
how-tos/*
statistics_data_visualisation.md
The documents build and html output is generated, however README.md has links to other markdown documents in the two sub-directories such as the following...
... [this document](./getting_started/setting_your_machine_up.md)...
...which in the translated README.html document the target has not been converted to the translated HTML target as its been recognised as reference external...
...<a class="reference external" href="./getting_started/setting_your_machine_up.md">this document</a>...
...I was half-expecting/hoping it would output as reference internal and convert the file extension approrpiately...
...<a class="reference internal" href="./getting_started/setting_your_machine_up.html">this document</a>...
...so that links worked in the same vein as the Table of Contents does in the sidebar.
Any suggestions as to whether this can be achieved would be appreciated.
Cheers.
EDIT
Trying out the solution suggested by #waylan I have added the following to by conf.py to enable_auto_doc_ref...
def setup(app):
app.add_config_value('recommonmark_config', {
'enable_auto_doc_ref': True,
}, True)
app.add_transform(AutoStructify)
...and on running make html I get the following error.....
❱ cat /tmp/sphinx-err-57rejer3.log
# Sphinx version: 1.8.0
# Python version: 3.6.6 (CPython)
# Docutils version: 0.14
# Jinja2 version: 2.10
# Last messages:
# building [mo]: targets for 0 po files that are out of date
#
# building [html]: targets for 16 source files that are out of date
#
# updating environment:
#
# 16 added, 0 changed, 0 removed
#
# reading sources... [ 6%] README
#
# Loaded extensions:
# sphinx.ext.mathjax (1.8.0) from /home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/ext/math
jax.py
# alabaster (0.7.11) from /home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/alabaster/__init__.py
Traceback (most recent call last):
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/cmd/build.py", line 304, in build_ma
in
app.build(args.force_all, filenames)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/application.py", line 341, in build
self.builder.build_update()
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 347, in
build_update
len(to_build))
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 360, in
build
updated_docnames = set(self.read())
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 468, in
read
self._read_serial(docnames)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 490, in
_read_serial
self.read_doc(docname)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 534, in
read_doc
doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/io.py", line 318, in read_doc
pub.publish()
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/docutils/core.py", line 218, in publish
self.apply_transforms()
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/docutils/core.py", line 199, in apply_trans
forms
self.document.transformer.apply_transforms()
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/sphinx/transforms/__init__.py", line 90, in
apply_transforms
Transformer.apply_transforms(self)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/docutils/transforms/__init__.py", line 171,
in apply_transforms
transform.apply(**kwargs)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/transform.py", line 325, in ap
ply
self.traverse(self.document)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/transform.py", line 297, in tr
averse
self.traverse(child)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/transform.py", line 297, in tr
averse
self.traverse(child)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/transform.py", line 297, in tr
averse
self.traverse(child)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/transform.py", line 287, in tr
averse
newnode = self.find_replace(c)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/transform.py", line 267, in fi
nd_replace
newnode = self.auto_doc_ref(node)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/transform.py", line 175, in au
to_doc_ref
return self.state_machine.run_role('doc', content=content)
File "/home/neil.shephard#samba.sheffield.thefloow.com/.local/lib/python3.6/site-packages/recommonmark/states.py", line 134, in run_r
ole
content=content)
TypeError: 'NoneType' object is not callable
I've looked through the last two calls and I think this might be down to content not being set, which may be something to do with my index.rst but I'm really out of my depth here.
The recommonmark documentation suggests enabling AutoStructify by adding the following to your config.py file:
from recommonmark.transform import AutoStructify
github_doc_root = 'https://github.com/rtfd/recommonmark/tree/master/doc/'
def setup(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(AutoStructify)
This will give you the following features:
enable_auto_toc_tree: whether enable Auto Toc Tree feature.
auto_toc_tree_section: when enabled, Auto Toc Tree will only be enabled on section that matches the title.
enable_auto_doc_ref: whether enable Auto Doc Ref feature.
enable_math: whether enable Math Formula
enable_inline_math: whether enable Inline Math
enable_eval_rst: whether Embed reStructuredText is enabled.
url_resolver: a function that maps a existing relative position in the document to a http link
Of note is the Auto Doc Ref feature:
It is common to refer to another document page in one document. We
usually use reference to do that. AutoStructify will translate these
reference block into a structured document reference. For example
[API Reference](api_ref.md)
will be translated to the AST of following reStructuredText code
:doc:`API Reference </api_ref>`
And it will be rendered as API Reference
Why is this necessary? Because, unlike Rst, Markdown does not have any knowledge of anything outside of the given document and has no support for Rst style directives. Therefore, there is no mechanism to transform a URL.
Instead, AutoStructify waits until after the recommonmark bridge converts the Markdown to Sphinx's underlying document structure (docutils document object), then it runs a series of transformers on it to provide limited Rst like functionality. Even with AutoStructify, you will never get full feature support when using Markdown. That would require Markdown to have native support for directives, which is not likely to ever happen.

HaxeFlixel findPath

I've got a little problem with the findPath function.
I'm working with a mix of two tutorials (one from Haxeflixel, and the second from haxecoder) and the second one uses CSV instead of Ogmo and uses a findPath when we click.
But when I click, the game crashes, nice.
This is my code: http://hastebin.com/xunidubiyi.avrasm
The problem is on the 86th line (split into multiple lines to fit the width):
var nodes:Array<FlxPoint> = _mWalls.findPath(
FlxPoint.get(
_player.x + 16 / 2,
_player.y + 16 / 2
),
FlxPoint.get(
tileCoordX * 16 + 16 / 2,
tileCoordY * 16 + 16 / 2
)
);
Output:
Invalid field access : allowCollisions
Called from flixel.tile.FlxTilemap::computePathDistance line 1806
Called from flixel.tile.FlxTilemap::findPath line 796
Called from PlayState::update line 87
Called from flixel.FlxState::tryUpdate line 155
Called from flixel.FlxGame::update line 700
Called from flixel.FlxGame::step line 648
Called from flixel.FlxGame::onEnterFrame line 493
Called from openfl._legacy.events.EventDispatcher::dispatchEvent line 98
Called from openfl._legacy.display.DisplayObject::__dispatchEvent line 182
Called from openfl._legacy.display.DisplayObject::__broadcast line 161
Called from openfl._legacy.display.DisplayObjectContainer::__broadcast line 286
Called from openfl._legacy.display.Stage::__render line 1103
Called from openfl._legacy.display.Stage::__checkRender line 351
Called from openfl._legacy.display.Stage::__pollTimers line 1084
Called from openfl._legacy.display.Stage::__doProcessStageEvent line 430
Done(1)
Does anybody know what went wrong and why?

Resources