File watcher for Cython in Pycharm - cython

Cython's *.pyx files need to be compiled for it to function with other py files. Because of this, I would like a file watcher for PyCharm just like for *.coffee files and for *.ts files.
How would one create a file watcher for Cython in Pycharm. A step by step tutorial would be greatly appreciated.

The easiest way would be "Compile on Save".
As an example, in Netbeans the "Compile on Save" feature can be enabled via "Build -> Compiling"
As for the python-demon itself, you could start it by using gunicorn, store md5 hash for each file, revalidate them all the time, and rebuild as soon as hash key was changed for the file.

Related

Converting python script to exe. Failed to execute script

I have made a game using pygame and now want to convert the script to an exe file. However, when doing this and starting the exe file I get an error saying "Failed to execute script (main.py)". I have tried everything from youtube videos to reading similar questions on Stack Overflow. But nothing works, I get the same error every time. How can I solve this?
Does it have to do something with my imports?
The import that I use in my script:
pygame
random
winsound
mixer (from pygame)
Avoid all of these problems and use PyInstaller (link to related question):
Download this library with pip by typing in the Command Prompt:
py -m pip install pyinstaller
Then, type cd [path to the file].
Finally, type py -m PyInstaller --onefile [script name].py.
PyInstaller will turn your code into one .exe file, in the folder dist, analyzing the modules you need.
After the installation, you can then delete all the other files, like the folder build for example.
If you need other attached files, like images, put them in the folder where the .exe file has been created.
Anyways, if you type exit() anywhere in your code, PyInstaller will raise an error. Simply import sys and type sys.exit() instead.

xxx.mex: failed to load: No such file or directory

For some time, I've been using some .mex files I created. Now I have a new computer. I copied all the files over and reinstalled Cygwin and Octave. When I try to execute any of the .mex routines I get a message like:
error: testm: /cygdrive/c/A/Cwin/...../quad.mex: failed to load: No such file or directory
The file is definitely there and I'm having no trouble loading .m files from the same directory. It does not say there is anything wrong with the file. I'm guessing this is some sort of configuration problem. I am running Octave 4.2.1. When I start it, I get the following message:
Octave was configured for "x86_64-unknown-cygwin".
Could that have something to do with it? I think I'm developing x64 paranoia, since all my Excel .dll macros no longer work either. Thanks.

File watcher on a SCSS file

I'm completely stumped. I have tried to the best of my being to fix this.
I have a SCSS file, that has a watcher on it, but the watcher does not seem to be working. A normal CSS file is not being made at all. Here is my SCSS file:
As well, I am using the WebStorm IDE.
Error message:
An exception occurred while executing watcher 'SCSS'. Watcher has been disabled. Fix it.: Cannot run program "C:\Users\Luke\WebstormProjects\untitled\myTestWebsite\main.scss" (in directory "C:\Users\Luke\WebstormProjects\untitled\myTestWebsite"): CreateProcess error=193, %1 is not a valid Win32 application
Program path:
Your Program should point to the Sass Gem of Ruby instead you are pointing to your scss file. This is not correct:
Find the sass.bat file on your computer and use the path to that file in the program value
in my case the correct path is: c:\Ruby22\bin\sass.bat
Webstorm automatically watches every scss file you create and creates a css file. You do not need to create a file watcher for every independent scss file
Small detail: I should add --style compressed to the arguments. This creates a minified version of the css file and the load time is decreased

How to configure PhpStorm to use LESS

I would start to use LESS so I try to configure my PhpStorm v8.0.3 to automatically compile .less into .css files.
I have installed node.js and installed less ( npm install -g less ), then I tried to set IDE but I obtained errors.
In Program input I don't know what write, if I leave empty the program say
"Please set program to run!"
If I use a macro the most of time I obtain error permissions
"error = 13"
You need less plugin for phpstorm https://plugins.jetbrains.com/plugin/7059?pr=idea after install restart phpstorm and open .less file
Phpstorm suggest you to add File Watcher for compiling less files automatically.
You need to point your Program field to your lessc file (lessc.cmd on Windows).
Here is what I'm using on Windows:
P.S.
I'm keeping my .less files in /assets/less/ folder and compiled files in /assets/css/ -- hence the ../css/ part in file output paths. If you want to keep compiled files next to sources .. then just remove that part.
https://confluence.jetbrains.com/display/PhpStorm/File+Watchers+in+PhpStorm

How to configure package.json to add a "self compiled binary" as a dependency?

I am very new to the concept of npm-install. Please throw some insights into where I might be going wrong. I have a .js file through which I am supposed to invoke a binary with some command line arguments.I did write package.json setting the main parameter to the javascript file and I am using preinstall script that compiles the code and creates a binary that is supposed to be used by my java script file.
Couple of questions:
How do I make package.json take this compiled binary as dependency for the js file?
npm install runs fine for me but I do not see any output folder whatsoever. I was hoping it would generate a .node_module in pwd and copy the contents onto bin/ folder in that. May be, I am missing something.
npm info prepublish test#0v.0.1
npm verb from cache <pwd>/package.json
npm verb readInstalled returning test#0.0.1
npm verb exit [ 0, true ]
npm info ok
Can someone please through some insights into this issue?
You don't have to include your binary file in package.json. If you're using Express, put it in the node-modules folder within the parent directory. Otherwise, you can either specify the whole path to the file where you call it or put the file in the parent directory. For global installations, the node-modules folder is usually created at: C:\Users\[Username]\AppData\Roaming\npm\node_modules.
I figured out a way to handle it. Using a js module and using my node as required in that module causes npm to setup my node in node_modules/ folder. I used a pre-install shell script to compile my binary and used the relative path to use the binary upon execution.
Thanks for all who replied.