|
POST
|
If you use str.format() it will automatically make the non-string values text instead of having to do it manually. You can also use += to add to an existing value. label_str += "BR: {} acres\n".format(BR)
... View more
07-14-2016
03:29 PM
|
2
|
0
|
2192
|
|
POST
|
Our organization has a need to create database triggers (in Oracle 11g) that generate a unique number from a sequence. Currently, the triggers look something like this (EID is the unique number we're generating from a sequence). CREATE OR REPLACE TRIGGER WS.SYSTEM_VALVE_EID_TRG -- TRIGGER NAME
BEFORE INSERT ON WS.A13246 -- ADDs TABLE
for each row
declare
max_objectid A13246.objectid%type:=0;
begin
select max(objectid) into max_objectid from SYSTEM_VALVE_PNT;
--determine if the new objectid is greater then the max from base table
if (max_objectid <:new.objectid) then
SELECT SYSVALVE_EID_SEQ.NEXTVAL INTO :NEW.EID FROM DUAL;
end if;
--if new eid is null, new asset
if (:new.eid is null) then
SELECT SYSVALVE_EID_SEQ.NEXTVAL INTO :NEW.EID FROM DUAL;
end if;
end;
/ I tried to alter the SQL to query max objectid from the base table and the A table but I started getting Underlying DBMS error [ORA-040941: table WS.A13246 is mutating, trigger/function may not see it Has anyone done stuff like this? Any advice on how to successfully make triggers on versioned feature classes (besides "don't use triggers")?
... View more
07-12-2016
04:15 PM
|
2
|
1
|
3542
|
|
POST
|
I like the string.format() method because the values your concatenating with the dashes don't have to be strings, it will do the casting automatically. But like Dan mentioned, just make sure the output field is a string with a long enough length to accommodate the new value.
... View more
07-08-2016
04:24 PM
|
1
|
3
|
5462
|
|
POST
|
This is helping me narrow it down. I have ftp.quit() in the finally block but it seems that trying to quit an ftp connection that has timed out throws the same error but as a different error object ("error_temp"). Additionally, error_temp has no attribute "strerror". I had ftp.quit() in a try/except but I was only catching AttributeError or NameError. I think the solution to this is two-fold: Change error logging to use just err insetad of err.message. Catch (and pass) all Exceptions on ftp.quit() instead of just AttributeError or NameError. try:
ftp.quit()
except:
pass
... View more
06-22-2016
11:25 AM
|
0
|
0
|
3520
|
|
POST
|
I agree. But from the looks of the error message, it's clearly saying there's a UnicodeEncodeError on the line with the path name. I don't know what else it could be.
... View more
06-22-2016
09:22 AM
|
0
|
0
|
3218
|
|
POST
|
It has to do with the path. the slash u is reserved to identify unicode characters so it's not interpreting your path correctly. Try changing all the path separators (slashes) to a back slash and put an r in the front. Like this... r"C:\Users\w2sohi\Desktop\test\box.tbx" Probably should do the same with your other paths. Further reading on the subject. Filenames and file paths in Python
... View more
06-22-2016
08:43 AM
|
0
|
2
|
3217
|
|
POST
|
There's an FTP site hosted by another organization that we routinely download data from. One of the downloads is very large and takes a while to download. The FTP server has a 120 second timeout so if the download goes too slowly for whatever reason, the script is disconnected. The error message is from ftplib and says 421 Timeout (120 seconds): closing control connection. Our script has everything in a big try/except/finally. The main logic with a log success message is in the try, there's an except Exception as err: block that logs a failure message, then there is send email in the finally. It only logs the success or failure, then sends an email with the result. try:
main logic here
log success message here
except Exception as err:
log failure message here
finally:
send email here I know it's skipping the except block because the failure message is not being written to the log but I get the email. I also wrote a little test script that just connects to the ftp, checks for a file, then sleeps for 150 seconds. Again, the except Exception block does not catch the ftp timeout error. EDIT I just looked at the script again and I have it logging with err.message instead of just err. That might be it...
... View more
06-21-2016
03:24 PM
|
0
|
2
|
3520
|
|
POST
|
I need to catch the exception because the script is running as a scheduled task that sends an email and logs a success or failure.
... View more
06-21-2016
01:21 PM
|
0
|
0
|
3520
|
|
POST
|
More specifically, I'm using ftplib and if the server times out, my traditional except Exception as err: is not catching it. I found one solution to use except ftplib.all_errors and it seems to work but I'd like to know if there's a more generic way to catch these "other" exceptions.
... View more
06-21-2016
11:46 AM
|
0
|
6
|
5685
|
|
BLOG
|
I've found that summary statistics (using the COUNT statistics option) also works well for getting a frequency count on a field and it's available with the ArcGIS Desktop Basic license. However, I still agree that it seems silly to have Frequency only available with an Advanced license.
... View more
06-20-2016
03:09 PM
|
0
|
0
|
418
|
|
POST
|
As usual, Joshua Bixby has a more elegant solution.
... View more
06-20-2016
11:48 AM
|
0
|
1
|
2198
|
|
POST
|
Maybe IdentityManager's generateToken()? IdentityManager | API Reference | ArcGIS API for JavaScript 4.0 Or Working with Proxy Services | ArcGIS for Developers
... View more
06-17-2016
08:26 AM
|
0
|
0
|
1384
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 4 weeks ago | |
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM |