environment variable set in make not seen by all sub-shells

Advertisements I need to set env variables in a makefile and use them in a python script invoked by the makefile. For some reason the python script is not able to see these env variables. export VAR := env_var PY_VAR := python -c "import os; print(‘VAR=’ + str(os.environ.get(‘VAR’)))" all: @echo -n "echoing: VAR=" @echo $${VAR}… Read More environment variable set in make not seen by all sub-shells

Source .R file to Rmarkdown does not work with German Umlaut

Advertisements In order to slim down my Rmarkdown code I would like to write some code in R files and then source to Rmarkdown: my_script_01.R library(tidyverse) df1 <- tribble( ~id, ~col1, 1, "Äb", 2, "Ab", 3, "ÖB", 4, "OB" ) df1 df2 <- tibble(id = c(1:4), tester = c("umlaut", "no_umlaut", "umlaut", "no_umlaut")) df3 <- left_join(df1,… Read More Source .R file to Rmarkdown does not work with German Umlaut

Flask render template doesn't render my html page keep getting "internal server error"

Advertisements Running flask 2.1 w/ python 3.10 trying to create a small app here’s my main.py file contents and directory setup from waitress import serve app = Flask(__name__, template_folder=’/templates’) @app.route("/") def startService(): return "Simple Web app" @app.route("/home") def ohok(): return render_template(‘home.html’) if __name__ == "__main__": serve(app, host="127.0.0.1", port=8080) I have my home.html file correctly formatted… Read More Flask render template doesn't render my html page keep getting "internal server error"

How to call the Win32 GetCurrentDirectory function from C#?

Advertisements The prototype of GetCurrentDirectory DWORD GetCurrentDirectory( [in] DWORD nBufferLength, [out] LPTSTR lpBuffer ); DWORD is unsigned long, LPTSTR is a pointer to wchar buffer in Unicode environment. It can be called from C++ #define MAX_BUFFER_LENGTH 256 int main() { TCHAR buffer[MAX_BUFFER_LENGTH]; GetCurrentDirectory(MAX_BUFFER_LENGTH, buffer); return 0; } I tried to encapsulate this win32 function in… Read More How to call the Win32 GetCurrentDirectory function from C#?

Why is StreamWriter adding random bytes to a file?

Advertisements I’m trying to translate a virtual key code with ToAsciiEx() and write it to a debug file. For some reason, the output file contains a load of random trash bytes interspersed with the key codes I want to log. I’m importing ToAsciiEx() like this: [DllImport("user32.dll")] static extern int ToAsciiEx(uint uVirtKey, uint uScanCode, byte[] lpKeyState,… Read More Why is StreamWriter adding random bytes to a file?

Why is this requests get not working with this url

Advertisements If i run this Python code my program just hangs up. (I don`t get any error.) import requests url = "https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/generative/dcgan.ipynb&quot; r = requests.get(url) But this works perfectly fine as expected. import requests url = "https://stackoverflow.com&quot; r = requests.get(url) Using curl to get the github file worked also fine. curl https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/generative/dcgan.ipynb So can you… Read More Why is this requests get not working with this url