I am facing a very weird issue in setting the workspace. When I setup the workspace inside python window in ArcMap/ArcCatalog, it just works fine. But the moment I do the same in a standalone python script, the things do not work at all. I tried other options like creating connection file in scratch folder and then setting it as a workspace but still no luck. I am facing this issue on ArcGIS Desktop 10.2.1 and my database is 64 bit Oracle.
I had ArcGIS Pro 2.1 installed on the same machine hence I also tried the same thing after uninstalling ArcGIS Pro but still no luck.
I had the same problem. This works when you set in PyScripter, menu Run, Python Engine, Internal.
I like to use ArcCatolog to provide the the path: with it open, navigate to the workspace and up at the top of the window is the actual path. Click, copy and paste it into your code:
arcpy.env.workspace = r'X:\your\copied\path\here'
Not working for me
I hate it when that happens; thing is, your actual path names have spaces in them, right? If you take them out in the python script it's not going t find them....
I meant, I created a new connection file in a directory where the sde file and directory name didn't have any spaces.
Hmmm. As you stated in your op; this is weird issue. Not sure what's going on here....
I have raised a ticket with Esr tech support on this, will keep you posted
That's the route to go at this point. It's just so very odd...
I had the same problem, and I solved it with copying the sde file to location where there won't be space character in the path. Also, I have renamed the sde file. Example: C:\sde\myconnection.sde