This is my first Erlang project, so obviously I have a long way to go. My problem is that Erlang keeps looking for a file called ".erlang". Here, for example, is my first project incantation:
C:\Users\niels\Documents\Edev>mix new hello
=ERROR REPORT==== 25-Sep-2022::21:14:02.952000 ===
file:path_eval(["U:\\","c:/Users/niels/AppData/Roaming/erlang"],".erlang"): no such device or address
* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating mix.exs
* creating lib
* creating lib/hello.ex
* creating test
* creating test/test_helper.exs
* creating test/hello_test.exs
Your Mix project was created successfully.
You can use "mix" to compile it, test it, and more:
cd hello
mix test
Run "mix help" for more commands.
My interpretation is that Erlang looks for the file ".erlang", first in the root of the U: drive (which Windows set up as my home folder) and then in my private "erlang" folder. The mix command seems to have worked but that error message annoys me. I did try to create an empty file ".erlang" and put it in my c:/Users/niels/AppData/Roaming/erlang folder but the error message persists.
The mix tool you use is for Elixir not Erlang. The Erlang equivalent tool you need is rebar3.
Related
For years I've been running a Docker container on my local machine and using it as a remote Python interpreter via SSH in PyCharm. This works great (though 2022.2.1 brought a lot of new bugs that have been slowly being ironed out) for running my code! I'm now on 2022.2.3.
However, I'm having issues running unit tests. In the past (i.e. before version 2022.2.1), I could simply right click my tests directory (a direct child of my main project directory) and click Run Python tests in test... and it would all work as expected.
Now, though, when I click this, I receive an error message about "No such file or directory."
I've tried everything I can think of- I've setup my path mappings in the Python test run config to exactly match those shown in my Python run config, and have tried every version of directory and subdirectory in the mappings and working directory, but I always receive an error about either having an empty test suite (no tests found), or that the directory "must be in the project."
It seems like no matter what I do, PyCharm is trying to create a temp directory somewhere, or is trying to read from some temp directory that I never specified, because I see errors this like:
AssertionError: /tmp/pycharm_project_405/docker/tests: No such file or directory
Yet I never created, specified, or requested a temp directory of any sort, let alone one named /tmp/pycharm_project_405/; this is a mystery to me.
PyCharm with an SSH interpreter is rapidly becoming unusable for me and my team because we cannot figure out how to set this up. Can anybody please offer some guidance on what we need to do?
Thank you all so very much!
I tried:
Changing run config for Python tests to match the working directory and path mapping of Python run configs (which work)
Directly specifying the path to the tests from the container's perspective
Setting up run config templates
Specifying one directory up/down from the actual tests
Expected:
Unit tests to be found and run as they were in previous versions of PyCharm
Answer
Create a run config for testing
In the testing run config, set Target: to Custom
Set the correct remote interpreter
Set Working directory to the test folder
Set TWO path mappings: 1) Map the code directory (in my case, the parent directory of the tests folder) and 2) Map the test directory itself
Voila!!!
my question my look silly but I'm complete yellow bird in programming.
Have challenge to compile using waf.io. I went thru basic instructions https://waf.io/apidocs/tutorial.html?highlight=start. But there is missing basic information: where I should put all these commands?
You must put these commands in a file named wscript. This file should be in the directory where your other project files are.
Then you will use the waf command in the same directory to run it.
Look at the waf book.
I need to convert my iOS project to 64-bit friendly (to get rid of compiler warnings, as in this question. The solution apparently is to run ConvertCocoa64.
I've managed to locate ConvertCocoa64 (which is no longer included in /Developer/Extras/64BitConversion/ConvertCocoa64) as the Apple docs suggest, but here (search for Auxiliary Tools)
So I've download the script. But my question is, how do I run this on my project? Please assume a total newbie level of knowledge here when it comes to the terminal and running scripts. Do I drop the script inside my project folder and just double click it? Or do I access it from the terminal? The docs say run this command:
/Developer/Extras/64BitConversion/ConvertCocoa64 `find . -name '*.[hm]' | xargs`
But since that folder doesn't exist, where do I run it?. I tried dropping the script in the Developer folder, but when I type ConvertCocoa64 it says command not found.
Find where the command is located now. You'll want to run it in the terminal using the full path to the command, as in your example, just with the real path.
A good way to get the full path is to locate the command in the Finder and drag it to an open terminal window - this also "escapes" any spaces in the path for you. The easiest way to hit all your files as arguments to the command is to cd (change directory) to your project first (in the terminal).
This should get you set up to follow the directions you have.
If I'm not mistaking, to run script, you should place dot . before command. Doesn't really matters, where script is situated as long, as it doesn't rely on it heavily
> cd ~/path/to/script/dir/
> ./ConvertCocoa64 ...
Im trying to translate my chrome app to ios. I run the command cca create myapp --copy-from=manifest.json Some errors exist cp: copyFileSync: could not write to dest file (code=ENAMETOOLONG): $PATH_TO_PROJECT/project/platforms/ios/www/platform/..../www/platform/config.xml
where .... is 40 repeated directories of /www/platform
The translation succeeds and im able to run my project with android however, when trying to run in xcode i see an almost identical error saying File name too long.
Anyone have simmilar issues? Anyone able to get ios translations to run?
This is the result of a bug in the way we "import" your project when you specify --copy-from or --link-to arguments to cca create when your import directory is the same as your output directory.
Since the import in your example is a parent folder of the output, it copies itself over and over, recursively until the system kills the process. We have added protection against doing this (by warning during cca create if we detect this case), but that version hasn't released to npm just yet (sorry!).
The fix for the issue is simple: just create your project in another directory that is outside of your packaged app! i.e., either:
# From within packaged app directory
cca create ../myapp --copy-from=./manifest.json
or
# From outside packaged app directory
cca create myapp --copy-from=$APP_DIR/manifest.json
Disclaimer: The author of this question has mostly theoretical knowledge of Erlang/OTP.
I have a small OTP application which calls some non-Erlang executable inside the myapp/ebin directory via open_port(). When I run the application itself everything goes well and the port to the executable is successfully opened.
But when I try to run unit tests for the application, the ones that depend on the open_port() fail, because when started with EUnit the application tries to find the executable under myapp/.eunit/ebin.
How can I change that behaviour without changing the code of the application itself? How can I run EUnit tests with the same current directory as when running the application itself? (I mean it would not be a good idea to change the code which provides the path to the executable just to be able to run EUnit).
Edit: I followed the advice in the Erlang mailing list, but code:priv_dir(myapp_name) returns {error, bad_name}.
Edit: I can see that .eunit/ contains modulename.beam files and ebin/ contains both modulename.beam files and modulename_tests.beam files. Now I am completely lost. When I run make test, rebar runs eunit command, which calls each modulename_tests.beam file in the ebin/ directory which calls a corresponding modulename.beam file in the .eunit/ directory (filename:absname("") clearly shows that modulename.beam files are executed from .eunit/ during test). Why is it so? Why do we need to run modulename.beam files from the .eunit/ directory instead of ebin/?
Why do we actually need to have the very same .beam files in myapp/ebin and myapp/.eunit/ebin?
P.S. I have read the official documentation and did not find the solution.
EUnit does not do this by itself - the .eunit directory is a convention used by Rebar.
To use erlang start script ".erlang" , and it can solve your problem.
In the .erlang file, to use code:add_pathz/N to add your necessary path.
Before reading couchdb source code there is example of how to use priv directory. Maybe the solution is helpful to you. It wrap open_port with start_port function, and set the directory in start_port function.
In file couch_os_daemon.erl
start_port(Command) ->
PrivDir = couch_util:priv_dir(),
Spawnkiller = filename:join(PrivDir, "couchspawnkillable"),
Port = open_port({spawn, Spawnkiller ++ " " ++ Command}, ?PORT_OPTIONS),
{ok, Port}.
stop_port(#daemon{port=Port, kill=undefined}=D) ->
?LOG_ERROR("Stopping daemon without a kill command: ~p", [D#daemon.name]),
catch port_close(Port);
stop_port(#daemon{port=Port}=D) ->
?LOG_DEBUG("Stopping daemon: ~p", [D#daemon.name]),
os:cmd(D#daemon.kill),
catch port_close(Port).
In file couch_util.erl
priv_dir() ->
case code:priv_dir(couch) of
{error, bad_name} ->
% small hack, in dev mode "app" is couchdb. Fixing requires
% renaming src/couch to src/couch. Not really worth the hassle.
% -Damien
code:priv_dir(couchdb);
Dir -> Dir
end.
start_driver(LibDir) ->
case erl_ddll:load_driver(LibDir, "couch_icu_driver") of
ok ->
ok;
{error, already_loaded} ->
ok = erl_ddll:reload_driver(LibDir, "couch_icu_driver");
{error, Error} ->
exit(erl_ddll:format_error(Error))
end.
You can grep priv, many example can be found.