Background
Hello,
I’m compiling Jython (Python2) on Windows.
I want to convert a string variable to a raw string because I want to make a path for a photo or self-written module.
Sample code
This cord make a path and no problem with import self wrote module
I can make a path if I directly write r
to a string , but I want to do this for a variable.
import sys
from sys import path
from java.lang.System import getProperty
sys.path.append(r"C:\Users\For Programming\fiji-win64\Fiji.app\ReserchScript")
import GrainAnalyzer # self-written Module
This cord dose not work_1
import sys
from sys import path
from java.lang.System import getProperty
modulepath1 = ("C:\Users\For Programming\fiji-win64\Fiji.app\ReserchScript")
sys.path.append(modulepath1)
import GrainAnalyzer # self-written Module
#> No module named GrainAnalyzer
This cord dose not work_2
import sys
from sys import path
from java.lang.System import getProperty
modulepath1 = ("C:\Users\For Programming\fiji-win64\Fiji.app\ReserchScript")
modulepath1 = repr(modulepath1)
sys.path.append(modulepath1)
import GrainAnalyzer # self-written Module
#> No module named GrainAnalyzer
If my English is difficult to understand , please tell me that. i rewrite about this.
Apologies in advance if this is covered elsewhere, can’t find it easily. Thanks.