When running this command
haxe -main Main.hx
I'm getting this error
Main.hx:2: characters 7-33 : Type not found : createjs.easeljs.Container
Main.hx
package ;
import createjs.easeljs.Container;
import createjs.easeljs.Shape;
import createjs.easeljs.Stage;
import createjs.easeljs.Text;
import createjs.easeljs.Ticker;
import js.Browser;
import js.html.CanvasElement;
import js.html.Element;
I've included the javascript file for the createjs library and I also installed the library using the command
haxe install createjs
You have to include the createjs haxelib with the -lib argument during compilation:
haxe -main Main.hx -lib createjs
Related
My Remix VSC extension is not able to compile any contract that has an import statement. This happens even if the imports are local files (located in the same folder than the compiling contract). This is a sample of the contract I try to compile with its import statement:
pragma solidity 0.4.24;
import "./Bank.sol";
contract WETH9 is ERC20Like {
function deposit() public payable;
}
I am able to compile it with the Remix Desktop IDE, though, but for the VSC extension I just get this error:
public\contracts\Setup.sol:3:1: ParserError: Source "Bank.sol" not found: Deferred import import "./Bank.sol"; ^------------------^
Am I missing any kind of setup? I have not found anything regarding this matter.
tflite_support's task library is missing. I've install the tflite_support with pip install tflite-support. I've tried using help() function to get the pakage content with help(tflite_support) and got the output 'PACKAGE CONTENTS
_pywrap_codegen
_pywrap_flatbuffers codegen
flatbuffers (package)
metadata
metadata_schema_py_generated
schema_py_generated'. There is no task library inside like how the tflite website shows https://www.tensorflow.org/lite/inference_with_metadata/task_library/object_detector#run_inference_in_python. I get the same result doing it in my window pc. Am I doing anything wrong or the task library is just missing?
I'm using tflite-support 0.4.1 and it looks like the task module is not supported on Windows:
import flatbuffers
import platform
from tensorflow_lite_support.metadata import metadata_schema_py_generated
from tensorflow_lite_support.metadata import schema_py_generated
from tensorflow_lite_support.metadata.python import metadata
from tflite_support import metadata_writers
if platform.system() != 'Windows':
# Task Library is not supported on Windows yet.
from tflite_support import task
There's also a note about it in the task_library docs.
I am trying to compile a Python package that I recently migrated from Python2 to Python3.
When running the source code in Python3 it works as expected, so do the source and compiled versions for Python2, but when I cythonize and compile the Python3 package the resulting binaries throw this error when importing a certain module:
dynamic module does not define module export function (PyInit_NKPD)
EDIT:
When I then close the Python interpreter, open it again and import the same model it works.
Interestingly when I put the code on my local drive it imports fine, but when I put it on my server and import it from there I get the above error. And to make matters worse, sometimes it imports fine from the server as well if I just wait a while and try again:
lockjaw:controller frank$ python3.7
Python 3.7.7 (v3.7.7:d7c567b08f, Mar 10 2020, 02:56:16)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import common
added to sys.path: /opt/ohufx/transfer/NUBRIDGE_COMPILE/osx/NKPD/src
trying to import model.NukepediaDB...
NukepediaDB imported
trying to import model.NKPD...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "src/controller/common.py", line 15, in init controller.common
import model.NKPD # this does not import
ImportError: dynamic module does not define module export function (PyInit_NKPD)
>>> import common
added to sys.path: /opt/ohufx/transfer/NUBRIDGE_COMPILE/osx/NKPD/src
trying to import model.NukepediaDB...
trying to import model.NKPD...
NKPD imported
model.NKPD always seems to import fine, but model.NKPD seems to be the stumbling block, even though this may be a red herring. It almost behaves like sometimes the server connection drops out after the first import, though in that case the other incarnations (Python 2/source code) would throw errors as well (not to mention a whole lot of other things would break in my office).
I have reduced the package to three modules with nothing but import and print statements which can be found here (including the resuling C++ and binary files).
The structure is very simple:
Where common is the module I import to test by cd-ing into the src/controller folder, opening Python3.7 and importing common. Common then imports model.NukepediaDB and model.NKPD, the latter causing the trouble.
I cythonized the python files with this line:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 py2cpp.py
Then compiled with this:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 setup.py build_ext --inplace
I would love to understand why the import sometimes fails when run from the server, as I have to distribute this package to others and need to ensure it runs reliably.
Thanks,
Frank
I have the following structure in my directory :
PROJECT
- classes
tunnelvisionlabs
postgresql
PostgreSqlLexer.class
PostgreSqlLexerAtnSimulator.class
PostgreSqlLexerUtils.class
- lib
antlr-4-7.jar
- BasicTest.java
In BasicTest.java, i have these imports:
package com.tunnelvisionlabs.postgresql.test;
import com.tunnelvisionlabs.postgresql.PostgreSqlLexer;
import com.tunnelvisionlabs.postgresql.PostgreSqlLexerUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Token;
import org.junit.Assert;
import org.junit.Test;
I try to compile with the following command :
javac -cp .:./lib/* BasicTests.java
I get these errors :
BasicTests.java:28: error: cannot find symbol
import com.tunnelvisionlabs.postgresql.PostgreSqlLexer;
^
symbol: class PostgreSqlLexer
location: package com.tunnelvisionlabs.postgresql
BasicTests.java:29: error: cannot find symbol
import com.tunnelvisionlabs.postgresql.PostgreSqlLexerUtils;
^
symbol: class PostgreSqlLexerUtils
location: package com.tunnelvisionlabs.postgresql
In the PostgreSqlLexer and PostgreSqlLexerUtils classes, i have this package declared at the beginning:
package com.tunnelvisionlabs.postgresql;
What do i need to do for my program to find these classes ? I tried adding the classes directory in lib and using the same command as before, so that the classpath also contains the classes directory, but it doesn't change anything.
If I read your project structure correctly, the source folder where BasicTest.java sits is at the same level as the lib folder. If so, then you can using the following javac classpath:
javac -cp .:lib/* BasicTests.java
^^^ lib/ is already where you are calling this
Review the following reference answer for more information:
Including all the jars in a directory within the Java classpath
In the Swift REPL, how to import (a.k.a. load, evaluate, require) a typical text *.swift file?
I want to use the code from this file: ~/src/Foo.swift
Syntax like this doesn't work: import ~/src/Foo.swift
For comparison:
An equivalent solution in the Swift REPL for a framework is: import Foundation
An equivalent solution in the Ruby REPL for a *.ruby file is: require "~/src/foo"
These are similar questions that are /not/ what I'm asking:
How to use/make a Swift command-line script, executable, module, etc.
How to use/make an XCode playground, project, library, framework, etc.
How to launch the REPL with a pre-existing list of files.
You need to use -I, so if your modulename.swiftmodule file is in ~/mymodules than launch swift with
swift -I ~/mymodules
and then you will be able to import your module
import module name
Should be that easy
In swift,you can't import a typical *.swift file.
For Import Declaration can only be the following syntax:
“
import-declaration → attributesopt import import-kindopt import-path
import-kind → typealias| struct| class| enum| protocol| var| func
import-path → import-path-identifier| import-path-identifier.import-path
import-path-identifier → identifier| operator”
From: Apple Inc. “The Swift Programming Language (Swift 2)”。 iBooks.
which can be described as these formats:
import module
import import kind module.symbol name
import module.submodule
import head.swift is incompatible with import import-kind module.symbol-name
Usually compile the files you want to import as a framework.Then it can be regarded as a module. use -F framework_directory/ to specify 3rd-party frameworks' search path.
Create a file. For example:
// test.swift
import headtest
print("Hello World")
open your terminal
goto the directory where you create the file.
execute command line
swift -F headtest test.swift
And done.
Simply insert the shebang line at the top of your script:
#!/usr/bin/env xcrun swift
You can copy/paste the source code into the repl and execute it.
Not ideal, obviously, but sometimes useful.
Now Swift REPL supports packages. We can do this by the following steps:
In Xcode, select menu File > New > Package. Choose a name for the package, for example MyLibrary.
Copy your codes or .swift files to the Sources/MyLibrary/ directory in your package.
Remember to make your interface public.
In the command line, go to the package directory and run REPL
Like this
cd MyLibrary/
swift run --repl
In the REPL, import your library
Like this
import MyLibrary
Now you can your codes in the REPL.
It looks like it's not possible to import file and get Xcode to use REPL for it using specifications you gave. I think you can still do it creating a proper framework, but it's not exactly what you was looking.